// begin of init httpresponse
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var loadingImage = '/images/ajax-loader.gif';

function MM_findObj(n, d) { //v4.01
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}	
	if(!(x=d[n])&&d.all) x=d.all[n];   
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); 
	return x;
}

function MM_validateForm() { //v4.0
	var i,p,q,test,name,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) {
		test=args[i+2];
		val=MM_findObj(args[i]);
		if (val) { 
			name=args[i+1];
			if ((val=val.value)!="") {
				if (test.charAt(0) == 'P') { 
					vals=MM_findObj(args[i+3]);				
					if (val != (vals=vals.value)) {
						errors+='- Security No. doesn\'t match Re-Security No.! Please correct\n';
					}
				}
			} else if (test.charAt(0) == 'R') {
				errors += '- '+name+' is required.\n'; 
			} else if (test.charAt(0) == 'P') {
				errors += '- '+name+' is required.\n'; 
			} else if (test.charAt(0) == 'C') { 
				errors += '- '+name+' is required.\n'; 
			}
		}
	} 
	if (errors) alert('The following error(s) occurred:\n'+errors);
	document.MM_returnValue = (errors == '');
}

function load_three_random_wallpapers(id_category) {
	MM_findObj('list_id').innerHTML = '<img src="/images/ajax-loader.gif">';
	xmlhttp.open("GET", '/ajax_random_3_wallpapers.php?action=change_status&id_category='+id_category,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			MM_findObj('list_id').innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}