function chopt(e){
document.getElementById("ecopt").src = "/images/"+e+".gif";
}	
function change_AD(i){	
 if (!i){ i = 0; }
 if(i==7 || i==9 || i==10){ document.getElementById("bsize").innerHTML = "(125*125)"; }
 else if(i==1){ document.getElementById("bsize").innerHTML = "(728*90)"; }
 else if(i==8){ document.getElementById("bsize").innerHTML = "(160*600)"; }
 else{ document.getElementById("bsize").innerHTML = "(468*60)"; }

 for(var j=0; j<=10; j++) {
 if (j==i && document.getElementById("pos_"+j)) { document.getElementById("pos_"+j).style.display = ""; }
else if (document.getElementById("pos_"+j)){  document.getElementById("pos_"+j).style.display = "none"; }
}
  SetPrice();
}

function validate(frm) {
        
	var ad_type = false;		
	for (counter = 0; counter < frm.ad_type.length; counter++)
		{	
                  if (frm.ad_type[counter].value)	ad_type = true; 
                }	
					
		if (!ad_type){			
		alert("Please select Ad Type.")
		return (false);			
		}		
		if (frm.ad_time.value == "") {			
		alert("Please Enter Ad Time.");			
		frm.ad_time.focus();			
		return (false);		
		}		
		if (isNaN(frm.ad_time.value)) {			
		alert("Please Enter Numeric Value for Ad Time.");			
		frm.ad_time.focus();			
		return (false);		
	}	
		if (frm.elements["position"] && frm.elements["position"].value == 'Sold'){			
		alert("This Ad Place already Sold.")
		return (false);			
		}
	
	var ad_time_type = false;		
	for (counter = 0; counter < frm.ad_time_type.length; counter++)
		{	
		if (frm.ad_time_type[counter].checked)		ad_time_type = true;
         	}			
		if (!ad_time_type){			
		alert("Please select AD Time Type.");			
		return (false);			
		}		
		if (frm.ad_site_url.value == "") {			
		alert("Please Enter Ad Website Url.");			
		frm.ad_site_url.focus();			
		return (false);		
		}
		if (frm.ad_banner_url.value == "") {			
		alert("Please Enter Banner Url.");			
		frm.ad_banner_url.focus();			
		return (false);			
		}		
		if (frm.ader_mail.value == "") {			
		alert("Please Enter email.");			
		frm.ader_mail.focus();			
		return (false);		
		}					
							
	return (true);	
	}	

/*
var xmlHttp;
function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest;
	} 
} 
function DisplayADs(ad) {
        if (ad == "") {ad = 0;}
	createXMLHttpRequest();
	var url="index.php?a=showads&type="+ad;
	xmlHttp.open("GET", url, true);
        xmlHttp.onreadystatechange=CallBack;      
	xmlHttp.send(null);
} 
function CallBack() {
	if (xmlHttp.readyState==1) {
	   document.getElementById("show_ad_site").innerHTML="<center>Processing... <img src=\"images/loading.gif\" align=\"absmiddle\"></center>";
	} 
	if (xmlHttp.readyState==4 && xmlHttp.status==200) {
	   document.getElementById("show_ad_site").innerHTML=xmlHttp.responseText;
	} 
  } 
*/