// JavaScript Document
//alert('start');

function checkandsubmit()
{
	if(document.searcher.act)
	{
		var sch = document.getElementById("searchx").value;
		for (var i = 0; i<document.searcher.elements.length; i++) 
		{
			if ((document.searcher.elements[i].name.indexOf('act') > -1)) 
			{	
				if (document.searcher.elements[i].checked) 
				{
					var acter = document.searcher.elements[i].value;
					if(acter == 'local')
					{
						location.href = 'searchnews.php?searchx='+sch;
					}
					else if(acter == 'web')
					{
						document.searcher.submit();
					}
				}
			}
		}
	}
}

var newwindow;
function poptastic(url, width, height)
{
	
	newwindow=window.open(url,'name','height='+height+',width='+width +'left=120,top=80, resizable=1,scrollbars=0');
	if (window.focus) {newwindow.focus()}
}
function poptastic2(url, width, height)
{
	
	newwindow=window.open(url,'name','height='+height+',width='+width +', resizable=1,scrollbars=1');
	if (window.focus) {newwindow.focus()}
}

function poptastic3(url, width, height)
{
	
	newwindow=window.open(url,'name','height='+height+',width='+width +'left=120,top=80, resizable=0,scrollbars=0');
	if (window.focus) {newwindow.focus()}
}


function show(id)
{
	
	var id1 = document.getElementById(id);
	if(id1.style.display == "none")
	id1.style.display = "block";
	else if(id1.style.display == "block")
	id1.style.display = "none";


}


function validateloginn()
{


	var errornum = 0;

		if(document.log.username && document.log.username.value=='' )
		{
		alert("Please enter UserName");
		document.log.username.focus();
		errornum++;
		return false;
		}
		if(document.log.password && document.log.password.value=='' )
		{
		alert("Please enter Password");
		document.log.password.focus();
		errornum++;
		return false;
		}

		
	if(errornum < 1)
	{	
	return true;	
	}
	
}
function showhidelayershiden(id, id2 , id3)
{

	if(document.getElementById(id))
	{

		document.getElementById(id).style.display = 'block';
	}
	
	if(document.getElementById(id2))
	{

		document.getElementById(id2).style.display = 'none';
	}
	
	if(document.getElementById(id3))
	{
		document.getElementById(id3).style.display = 'none';
	}
	
	/*
	if(document.getElementById(id4))
	{
		document.getElementById(id4).style.display = 'none';
	}
	
	if(document.getElementById(id5))
	{
		document.getElementById(id5).style.display = 'none';
	}
	*/
}


function checkNametime(idd)
{
	alert('here' + idd);
	setTimeout("checkName(idd)", 3000);
}








function getXMLHttpRequestObject()

{

  var XMLHttpRequestObject = false;
  if (window.XMLHttpRequest)

  {
              XMLHttpRequestObject = new XMLHttpRequest();
  }
  else if (window.ActiveXObject)

  {
              XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");

  }

  if (!XMLHttpRequestObject)

  {
              alert("Your browser does not support Ajax.");
              return false;

  }

  return XMLHttpRequestObject;

}


function getXMLHttpRequestObject2()

{

  var XMLHttpRequestObject2 = false;
  if (window.XMLHttpRequest)

  {
              XMLHttpRequestObject2 = new XMLHttpRequest();
  }
  else if (window.ActiveXObject)

  {
              XMLHttpRequestObject2 = new ActiveXObject("Microsoft.XMLHTTP");

  }

  if (!XMLHttpRequestObject2)

  {
              alert("Your browser does not support Ajax.");
              return false;

  }

  return XMLHttpRequestObject2;

}




var ajaxObj = getXMLHttpRequestObject();

var ajaxObj2 = getXMLHttpRequestObject2();



function checkName2(idd)

{
	

   if(ajaxObj2)

   {
	  

      if (ajaxObj2.readyState == 4 || ajaxObj2.readyState == 0)
      { 
	  	//alert('yes yes');
		// var inputObject = document.getElementById(‘inputbox’);
		 var URL2 = "new3left.php" + "?idnx=" + idd;
		 ajaxObj2.open("GET", URL2, true);
		 ajaxObj2.onreadystatechange = handleResponse2;
         ajaxObj2.send(null);
      }
   }
}

function handleResponse2()
{
   if (ajaxObj2.readyState == 4)

   {
           if (ajaxObj2.status == 200)

      		{
					  var textResponse2 = ajaxObj2.responseText;
					  var displayObj2 = document.getElementById("nb");
					  displayObj2.innerHTML = textResponse2;
              }

   }
}
function checkNamex(idd)

{
var idd  = encodeURIComponent(idd);

   if(ajaxObj)

   {

      if (ajaxObj.readyState == 4 || ajaxObj.readyState == 0)
      {
		// var inputObject = document.getElementById(‘inputbox’);
		 var URL = "homepicsleft.php" + "?pictyphome=" + encodeURIComponent(idd);
		 ajaxObj.open("GET", URL, true);
		 
		 //here pater1
		 ajaxObj.setRequestHeader('Content-type', 'text/xml;charset=utf-8');
		 ajaxObj.onreadystatechange = handleResponse;
         ajaxObj.send(null);
      }
   }
}


function handleResponse()
{
   if (ajaxObj.readyState == 4)

   {
           if (ajaxObj.status == 200)

      		{
					  var textResponse = ajaxObj.responseText;
					  var displayObj = document.getElementById("layer4rightcleft");
					  displayObj.innerHTML = textResponse;
              }

   }
}




function ajaxFunction(idd){
//alert("IGD " + idd);	
	
	var idd = encodeURIComponent(idd);
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//var bawse = ajaxRequest.responseText;
			//alert(bawse);
			document.getElementById("layer4rightcrightaj").innerHTML = ajaxRequest.responseText;
		}
	}

	var queryString = "?pictyphome=" + encodeURIComponent(idd);
	ajaxRequest.open("GET", "homepics.php" + queryString, true);
	//here peter 2
	ajaxRequest.setRequestHeader('Content-type', 'text/xml;charset=utf-8');
	ajaxRequest.send(null); 
}



function ajaxFunction2(idd){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById("nb2").innerHTML = ajaxRequest.responseText;
		}
	}

	var queryString = "?idnx=" + idd;
	ajaxRequest.open("GET", "new3right.php" + queryString, true);
	ajaxRequest.send(null); 
}










function clearhotsearch()
{
	document.hotsearch.reset();
	document.hotsearch.clear();
}
function validatehotsearch()
{
	//alert('me');
	erorx = 0;
	if(document.hotsearch.name)
	{
		if(document.hotsearch.name.value == ''  && document.hotsearch.cathot.value == '')
		{
			erorx++;
			alert('please enter either hotel name or region');
			document.hotsearch.name.focus();
			return false;
		}


		if(erorx < 1)
		document.hotsearch.submit();
	}
	
}



function ajaxFunctionm(idd,catidd){
	
	var idd = encodeURIComponent(idd);
	var catidd = encodeURIComponent(catidd);
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//var bawse = ajaxRequest.responseText;
			//alert(bawse);
			document.getElementById("picerframex").innerHTML = ajaxRequest.responseText;
			var idfocus =  document.getElementById("galpicscontentx");
			idfocus.focus();
		}
	}

	var queryString = "?iddx=" + encodeURIComponent(idd)+"&cidd4="+encodeURIComponent(catidd);
	ajaxRequest.open("GET", "galpicm.php" + queryString, true);
	//here peter 2
	ajaxRequest.setRequestHeader('Content-type', 'text/xml;charset=utf-8');
	ajaxRequest.send(null); 
}



function ajaxFunction2m(idd,catidd,p){
	
	var idd = encodeURIComponent(idd);
	var catidd = encodeURIComponent(catidd);
	var p = encodeURIComponent(p);
	var ajaxRequest2;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest2 = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest2 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest2 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest2.onreadystatechange = function(){
		if(ajaxRequest2.readyState == 4){
			//var bawse = ajaxRequest.responseText;
			//alert(bawse);
			document.getElementById("galpicscontentx").innerHTML = ajaxRequest2.responseText;
		
		}
	}

	var queryString = "?iddx=" + encodeURIComponent(idd)+"&cidd4="+encodeURIComponent(catidd)+"&p="+encodeURIComponent(p);
	ajaxRequest2.open("GET", "galm_ajax.php" + queryString, true);
	//here peter 2
	ajaxRequest2.setRequestHeader('Content-type', 'text/xml;charset=utf-8');
	ajaxRequest2.send(null); 
}









function ajaxFunction2(idd,catidd,p){
	
	var idd = encodeURIComponent(idd);
	var catidd = encodeURIComponent(catidd);
	var p = encodeURIComponent(p);
	var ajaxRequest2;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest2 = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest2 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest2 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest2.onreadystatechange = function(){
		if(ajaxRequest2.readyState == 4){
			//var bawse = ajaxRequest.responseText;
			//alert(bawse);
			document.getElementById("galpicscontent").innerHTML = ajaxRequest2.responseText;
		
		}
	}

	var queryString = "?iddx=" + encodeURIComponent(idd)+"&cidd4="+encodeURIComponent(catidd)+"&p="+encodeURIComponent(p);
	ajaxRequest2.open("GET", "gal_ajax.php" + queryString, true);
	//here peter 2
	ajaxRequest2.setRequestHeader('Content-type', 'text/xml;charset=utf-8');
	ajaxRequest2.send(null); 
}





function GetXmlHttpObject(handler) 
{ 
var objXMLHttp=null 
if (window.XMLHttpRequest) 
{ 
objXMLHttp=new XMLHttpRequest() 
} 
else if (window.ActiveXObject) 
{ 
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") 
} 
return objXMLHttp 
} 

 function stateChangedx() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
{ 
document.getElementById("galpicscontentx").innerHTML=xmlHttp.responseText;
//document.getElementById("txtResult").focus();
//document.getElementById("namer").focus();
} 
else 
{ 
//alert(xmlHttp.status); 
} 
}

function htmlDatax(url, qStr) 
{ 
//alert('started ' + url + qStr);
if (url.length==0) 
{ 
document.getElementById("galpicscontentx").innerHTML=""; 
return; 
} 
xmlHttp=GetXmlHttpObject() 
if (xmlHttp==null) 
{ 
alert ("Browser does not support HTTP Request"); 
return; 
} 

url=url+"?"+qStr; 
url=url+"&sid="+Math.random(); 
xmlHttp.onreadystatechange=stateChangedx; 
xmlHttp.open("GET",url,true) ; 
xmlHttp.send(null); 
}



function htmlData(url, qStr) 
{ 
//alert('started ' + url + qStr);
if (url.length==0) 
{ 
document.getElementById("galpicscontent").innerHTML=""; 
return; 
} 
xmlHttp=GetXmlHttpObject() 
if (xmlHttp==null) 
{ 
alert ("Browser does not support HTTP Request"); 
return; 
} 

url=url+"?"+qStr; 
url=url+"&sid="+Math.random(); 
xmlHttp.onreadystatechange=stateChanged; 
xmlHttp.open("GET",url,true) ; 
xmlHttp.send(null); 
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
{ 
document.getElementById("galpicscontent").innerHTML=xmlHttp.responseText;
//document.getElementById("txtResult").focus();
//document.getElementById("namer").focus();
} 
else 
{ 
//alert(xmlHttp.status); 
} 
}


 function stateChangedxx() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
{ 
document.getElementById("vidcontentajax").innerHTML=xmlHttp.responseText;
//document.getElementById("txtResult").focus();
//document.getElementById("namer").focus();
} 
else 
{ 
//alert(xmlHttp.status); 
} 
}

function htmlDataxx(url, qStr) 
{ 
//alert('started ' + url + qStr);
if (url.length==0) 
{ 
document.getElementById("vidcontentajax").innerHTML=""; 
return; 
} 
xmlHttp=GetXmlHttpObject() 
if (xmlHttp==null) 
{ 
alert ("Browser does not support HTTP Request"); 
return; 
} 

url=url+"?"+qStr; 
url=url+"&sid="+Math.random(); 
xmlHttp.onreadystatechange=stateChangedxx; 
xmlHttp.open("GET",url,true) ; 
xmlHttp.send(null); 
}

function logFocus()
{
	if(document.loger.foc)
	{
		document.loger.foc.focus();
		
	}
}

function validateLogin()
{
	//alert('me');
	erorx = 0;
	if(document.loger.username)
	{
		if(document.loger.username.value == '' || document.loger.username.value == 'username')
		{
			erorx++;
			alert('please enter username');
			document.loger.username.focus();
			return false;
		}

		if(document.loger.password.value == '' || document.loger.password.value == 'password')
		{
			erorx++;
			alert('please enter password');
			document.loger.password.focus();
			return false;
		}
		if(erorx < 1)
		document.loger.submit();
	}
	
}

function showkey(id)
{
	
	var id1 = document.getElementById(id);
	if(id1.style.display == "none")
	id1.style.display = "block";
	else if(id1.style.display == "block")
	id1.style.display = "none";
	else
	id1.style.display = "block";

}




function show(id)
{

	var id1 = document.getElementById(id);
	if(id1)
	{
		if(id1 && id1.style.display == "none")
		id1.style.display = "block";
		else if(id1.style.display == "block")
		id1.style.display = "none";
		else
		id1.style.display = "block";
	}

}

function showx(id)
{
	
	var id1 = document.getElementById(id);
	if(id1.style.display == "none")
	{
	
	id1.style.display = "block";
	id1.style.position = "absolute";
	
	
	}
	else if(id1.style.display == "block")
	{
	id1.style.display = "none";
	
	}
	else
	{
	id1.style.display = "block";
	id1.style.position = "absolute";
	}

}


function showxcon(id)
{
	
	
	var id1 = document.getElementById(id);
	var mainid = document.getElementById('main');
	var maincon = document.getElementById('laycon');

	var object = mainid.style; 
	var object2 = id1.style; 
	var object3 = maincon.style; 

	if(id1.style.display == "none")
	{
	
	id1.style.display = "block";
	id1.style.position = "absolute";
	mainid.style.backgroundColor='#000';


		document.body.style.backgroundColor='#000';
		object.backgroundColor='#000';
		object.opacity = '30'; 
		object.MozOpacity = '30'; 
		object.opacity='0.3';
		object.KhtmlOpacity = '30'; 
		object.filter = "alpha(opacity='30')";
		
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
	object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";



	
	}
	else if(id1.style.display == "block")
	{
	id1.style.display = "none";
	id1.style.position = "absolute";
	mainid.style.backgroundColor='#fff';
	document.body.style.backgroundColor='';
	object.backgroundColor='#fff';
	
	object.opacity = '100'; 
	object.MozOpacity = '100'; 
	object.KhtmlOpacity = '100'; 
	object.filter = "alpha(opacity='100')";
	
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
		object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";
			//document.body.style.backgroundImage = '';
		//object.backgroundImage = '';


	
	}
	else
	{
	id1.style.display = "none";
	id1.style.position = "absolute";
	mainid.style.backgroundColor='#fff';
	
		document.body.style.backgroundColor='';
	object.backgroundColor='#fff';

	object.opacity = '100'; 
	object.MozOpacity = '100'; 
	object.KhtmlOpacity = '100'; 
	object.filter = "alpha(opacity='100')";
		
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
	object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";

	}
	
	
	object2.opacity = '100'; 
	object2.MozOpacity = '100'; 
	object2.KhtmlOpacity = '100'; 
	object2.filter = "alpha(opacity='100')";
	
	object3.opacity = '100'; 
	object3.MozOpacity = '100'; 
	object3.KhtmlOpacity = '100'; 
	object3.filter = "alpha(opacity='100')";

}

