// JavaScript Document
var xmlHttp;

function getPic(url) {
	xmlHttp = testAjax()
	if (xmlHttp == null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	
	xmlHttp.onreadystatechange = stateChangedGetPic
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedGetPic() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { 
		document.getElementById("fullsize").innerHTML = xmlHttp.responseText 
		show('div#fullsize',1);
	}
}

function getSubCategories(url,sid) {
	xmlHttp = testAjax()
	if (xmlHttp == null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	if (sid != '') {
		url = url + '&SID=' + sid;
	}
	
	xmlHttp.onreadystatechange = stateChangedGetSubcategories
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedGetSubcategories() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { 
		document.getElementById("subcategories").innerHTML = xmlHttp.responseText 
	}
}

function getSubCategories2(url,sid) {
	xmlHttp = testAjax()
	if (xmlHttp == null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	if (sid != '') {
		url = url + '&SID=' + sid;
	}
	
	xmlHttp.onreadystatechange = stateChangedGetSubcategories2
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedGetSubcategories2() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { 
		document.getElementById("subcategories2").innerHTML = xmlHttp.responseText 
	}
}

function testAjax() {
	var xmlHttp = null;
	try {
    // Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
    } catch (e) {
    // Internet Explorer
    	try {
      		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
