function popup(url,width,height) 
{
	OpenWin = this.open(url,"_blank", "toolbar=no,menubar=no,location=no,scrollbars=no,status=no,resize=no,resizable=yes,width="+width+",height="+height+",top=100,left=100'");
}


function load_chart_month(vyear)
{
		document.forms['select_year'].elements['current_year'].value = vyear;
		document.getElementById('chart_visit_month').innerHTML = '<iframe name="frm_vpm" id="frm_vpm" src="sun_modules/chart/visit_per_month.php?year=' + vyear + '&rand=' + new Date().getTime() + '" width="600" height="300" frameborder="0" scrolling="no"></iframe>';
		document.getElementById('chart_visit_day').innerHTML = '<iframe name="frm_vpd" id="frm_vpd" src="sun_modules/chart/visit_per_day.php?year=' + vyear + '&month=1&rand=' + new Date().getTime() + '" width="600" height="300" frameborder="0" scrolling="no"></iframe>';
}
	
function load_chart_day(vmonth)
{
		vyear = document.forms['select_year'].elements['current_year'].value;
		document.getElementById('chart_visit_day').innerHTML = '<iframe name="frm_vpd" id="frm_vpd" src="sun_modules/chart/visit_per_day.php?year=' + vyear + '&month=' + vmonth + '&rand=' + new Date().getTime() + '" width="600" height="300" frameborder="0" scrolling="no"></iframe>';
}


/////////////////////////////////Load Ajax///////////////////////////////////////////////
loadstatustext = 'Loading...';
function ajaxLoad(url,id)
   {
       if (document.getElementById) {
           var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
           }
           if (x)
               {
           x.onreadystatechange = function()
                   {
                       el = document.getElementById(id);
                       el.innerHTML = loadstatustext;
               if (x.readyState == 4 && x.status == 200)
                       {
                       el.innerHTML = x.responseText;
                   }
                   }
               x.open("GET", url, true);
               x.send(null);
               }
       }

function db_district(x)       
   {
	   
   ajaxLoad('_include/district.php?cid='+x,'showdistrict');
   }

function show_district(x)       
   {
   ajaxLoad('_include/inc_district_s.php?id='+x,'district_id');
   }
function show_street(x)       
   {
   ajaxLoad('_include/inc_street_s.php?id='+x,'street_id');
   }

function db_display(x)       
   {
   ajaxLoad('_include/menu_2.php?cat='+x,'showmenu');
   }
function db_display2(x)       
   {
   ajaxLoad('_include/menu_3.php?cat_2='+x,'showmenu2');
   }
   
   
/*AJAX LOAD ADDRESS*/
var ajax = new Array();
function getCityList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('district_id').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = '_include/inc_district_s.php?id='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createCities(index)
{
	var obj = document.getElementById('district_id');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

function getStreets(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('street_id').options.length = 0;	// Empty city select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = '_include/inc_street_s.php?id='+category;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStreets(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createStreets(index)
{
	var obj = document.getElementById('street_id');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		

//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	
	function getCity(stateId) {		
		var strURL="coding/findCity.php?state="+stateId;
		var req = getXMLHTTP();
	
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('airportdiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
	function getCity2(stateId) {		
		var strURL="coding/findCity2.php?state="+stateId;
		var req = getXMLHTTP();
	
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('airportdiv2').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
	function getDistrict(countryId,stateId,cityId) {		
		var strURL="_include/findDistrict.php?country="+countryId+"&state="+stateId+"&city="+cityId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('streetdiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
	


function getDistrict_2(x)       
   {
	   
   ajaxLoad('_include/findDistrict_2.php?district='+x,'district_id');
   }
   
   
function linkto(linkto){ 
	window.location.href=linkto; return true;
}

/* on mouse events change by this */



function mover(src){

    var cls_=src.className; src.style.cursor='pointer'; if(cls_.indexOf("_over")==-1) src.className=cls_+"_over"; }

        

function mout(src){

    var cls_=src.className;	if(cls_.indexOf("_over")>-1) src.className=cls_.replace("_over",""); }

                

function mdown(src,code){

    var cls_=src.className; if(cls_.indexOf("_down")==-1)

    src.className=(cls_.indexOf("_over")!=-1)?cls_.replace("_over","_focus"):cls_+"_focus";

    document.writeln(src.id); if(code!='') eval(code); }




