function fghSWERRF(bid,type,tt,sc){
	AJAXGet("visits.php?type="+type+"&bb="+bid+"&tt="+tt+"&sc="+sc+"&rr="+Math.floor(Math.random()*11),false,false,false);
	
}
var CountryValue = '';
	 var CityValue    = '';
	 var tCounter  = 0;
function getPTime(){
	 
	 if ( document.getElementById('coID') ){
	    CountryValue  = document.getElementById('coID').options[document.getElementById('coID').selectedIndex].value;
	 }
	 if ( document.getElementById('ciID') ){
	 	CityValue     = document.getElementById('ciID').options[document.getElementById('ciID').selectedIndex].value;
	 	
	 }
   AJAXGet("em.php?ci="+CityValue+"&co="+CountryValue+"&rr="+Math.floor(Math.random()*11),setPrayHtml,false,false);
	
}

function showLI(){
	
	
	if ( document.getElementById('dfSSa').style.display == 'none' ){
	  document.getElementById('dfSSa').style.display="block"; 
	  document.getElementById('DFGh').className = 'active'; 
	}else{
	  document.getElementById('dfSSa').style.display="none"; 
	  document.getElementById('DFGh').className = ''; 
	}
	
}

function setPrayHtml(txt){
	if ( txt.indexOf("Network Access Message") > 0 && tCounter < 4  ){
		// try again 
		getPTime();
		tCounter++;
		return false;
	}
	arr = txt.split('|@@@###|');
	if ( document.getElementById('prayRes') )
	document.getElementById('prayRes').innerHTML = arr[0];
	//if ( document.getElementById('mLeftT10') && CountryValue == ''){
	 dd = arr[1];
	 if ( document.getElementById('mLeftT10') )
	 document.getElementById('mLeftT10').innerHTML = dd;
	//}
}
function AJAXGet() {
	var url = arguments[0];
	var callback = arguments[1];
	
	var bXMLResult = arguments[2];
	var callLoading = arguments[3];
	if(callLoading == ''){
		callLoading = false;
	}
	
	try
        {
                xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
                try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
                catch (e)
                {
                       try { xmlhttp = new XMLHttpRequest(); }
                       catch (e) { xmlhttp=false; }
                }
        }
        
        urlData = url.split("?");
		url= urlData[0];
		data = urlData[1];
		if(data == undefined) {
			data = "";
		}
		url = URL_PATH+url+"?rr="+Math.floor(Math.random()*100000);
		//alert(data);
		xmlhttp.open('POST',url,false);
        xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        //alert(data);
        //alert(url);
        xmlhttp.send(data);
 
        if(xmlhttp.readyState == 4 )
        {      // alert(xmlhttp.responseText);
        	    if ( callback != false )
        	    callback(xmlhttp.responseText);
                //flagImage = document.getElementById("flagIMG");
                //flagImage.src = "http://images.maktoob.com/blog_maktoob/images/flag_yes.gif";
        }
}


// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

