function showwait(){
	document.getElementById("wait").style.visibility="visible";
}

function hidewait(){
	document.getElementById("wait").style.visibility="hidden";
}

function viewid(id){
    if(document.getElementById(id)){
    	document.getElementById(id).style.display ='';
	}
}

function dviewid(id,note){
 	if(document.getElementById(id)){
  		viewid(id);
 		document.getElementById(id).innerHTML=note;
	}
}

function hiddeen(id){
    if(document.getElementById(id)){
		document.getElementById(id).style.display ='none';
	}
}

function mainload(url , inid, POST){
 	var xmlhttp=false;
 	var my_respons = '';
        viewid(inid);
        dviewid(inid ,'<center><span style="color: #0092dd; line-height: 20px;">در حال بارگزاری...</span><br/><img src="images/loading.gif" /></center>') ;
    if(!xmlhttp) { 
try
 {
 xmlhttp=new XMLHttpRequest();
 }
catch (e)
 {
 try
  {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
	 }
    }
    if(!xmlhttp) { xmlhttp=new XMLHttpRequest();}
     	xmlhttp.open('POST', url, true);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); POST=POST+'&my_time='+escape(new Date().getTime());
        xmlhttp.send(POST); 
        xmlhttp.onreadystatechange = function() {
              if(xmlhttp.readyState == 4  && xmlhttp.status == 200){
				my_respons=xmlhttp.responseText;
				my_respons = my_respons.replace('\n', '');
				my_respons = my_respons.replace('\r', '');
				document.getElementById(inid).innerHTML =my_respons;
             }
        }
}

function loadmenu(page,class_new,POST){
mainload(page,class_new,POST);		
}

function tracking(code,ads){

		if (code == '')
		{
		dviewid('tracking_error' ,'<font color="red">كد رهگيري را وارد نماييد</font>')
		}
		else
		{	
		hiddeen('tracking_error')
		mainload( 'tracking.php?title=0&code=' + code + '&ads=' + ads, 'main' ,'')
		}
}

function domainiv(domainnoe,host){

		if (domainnoe == '' || host == '')
		{
		dviewid('domain_error' ,'<font color="blue">لطفا نوع هاست و دامنه را انتخاب نمایید</font>')
		hiddeen('domain_new')
		}
		else
		{	
		hiddeen('domain_error')
		mainload( 'domain.php?domain=' + domainnoe + '&host=' + host, 'domain_new' ,'')
		}
}

function loadPage(page) {
		mainload( page, 'main' ,'')
}

function loadPagea(page) {
		mainload( page, 'main' ,'')
		loadmenu('viewproduce.php?noe=userbasket','userbasket','')
}

function loadbasket() {
		loadmenu('viewproduce.php?noe=userbasket','userbasket','')
}
