// JavaScript source code


var xmlHttp ;
var PathStr ; 

function initXMLHttpRequest()
{
	try
	{    
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e)
	{   
		// Internet Explorer    
		try
		{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;       
			}     
		}
	}  
}



/////////////////////////////////////////////////////////////////////////
//AdvSelectCityList(ID)
//CheckCustomerEmail
/////////////////////////////////////////////////////////////////////////
function AdvSelectCityList()
{  
	ID = document.getElementById("AdvRegion").value ;
	PathStr = "SelectCityList.asp?multi=1&ID=" + ID
	//check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("AdvCitySelect").innerHTML = xmlHttp.responseText ;
		}
	}
	
	//read the ajaxfunc from asp file
	xmlHttp.open("GET" , "IncludeFile/ajax/" + PathStr , true);
	xmlHttp.send(null);
}


/////////////////////////////////////////////////////////////////////////
//AdvSelectCityList(ID)
//CheckCustomerEmail
/////////////////////////////////////////////////////////////////////////
function AdvSelectSubCatList()
{  
	/*var arSelected = new Array();
	ob = document.getElementById("AdvCat1").value ;
	
	while (ob.selectedIndex != -1)
	{
		if (ob.selectedIndex != 0) 
			arSelected.push(ob.options[ob.selectedIndex].value);
			selected.push(mySelect.options.value);
		ob.options[ob.selectedIndex].selected = false;
	}
	// You can use the <B>arSelected</B> array for further processing.
	*/
	
	
	ID = document.getElementById("AdvCat1").value ;
	PathStr = "SelectSubCatList.asp?multi=1&ID=" + ID + "&rand=" + Math.random() ;
	//check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("AdvCat2Select").innerHTML = xmlHttp.responseText ;
		}
	}
	
	//read the ajaxfunc from asp file
	xmlHttp.open("GET" , "IncludeFile/ajax/" + PathStr , true);
	xmlHttp.send(null);
}	





/////////////////////////////////////////////////////////////////////////
//SelectCityList(ID)
//CheckCustomerEmail
/////////////////////////////////////////////////////////////////////////
function SelectCityList()
{  
	ID = document.getElementById("Region").value ;
	PathStr = "SelectCityList.asp?ID=" + ID
	//check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("CitySelect").innerHTML = xmlHttp.responseText ;
		}
	}
	
	//read the ajaxfunc from asp file
	xmlHttp.open("GET" , "IncludeFile/ajax/" + PathStr , true);
	xmlHttp.send(null);
}	


/////////////////////////////////////////////////////////////////////////
//SelectCityList(ID)
//CheckCustomerEmail
/////////////////////////////////////////////////////////////////////////
function SelectSubCatList()
{  
	ID = document.getElementById("Cat1").value ;
	PathStr = "SelectSubCatList.asp?ID=" + ID + "&rand=" + Math.random() ;
	//check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("Cat2Select").innerHTML = xmlHttp.responseText ;
		}
	}
	
	//read the ajaxfunc from asp file
	xmlHttp.open("GET" , "IncludeFile/ajax/" + PathStr , true);
	xmlHttp.send(null);
}	



/////////////////////////////////////////////////////////////////////////
//CheckCustomersDetails(Email , Password , Action)
//CheckCustomerEmail
/////////////////////////////////////////////////////////////////////////
function CheckCustomersDetails(Email , Password , Action)
{  
	if (Action == "CheckCustomerEmail")
	{
		PathStr = "CheckCustomersDetails.asp?Email=" + Email + "&Action=" + Action + "&rand=" + Math.random() ; 
	}
	else
	{
		PathStr = "CheckCustomersDetails.asp?Email=" + Email + "&Pass=" + Password + "&Action=" + Action + "&rand=" + Math.random() ; 
	}
	//check if your browser support AJAX .
	initXMLHttpRequest ();
	
	/*xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			//document.getElementById("OffersTable").innerHTML=xmlHttp.responseText;
			
			alert (1);
			return xmlHttp.responseText ;
			
			/*if (xmlHttp.responseText == "0")
			{
				//NotFound Sam Email
				alert (1);
				tmpSession = 1 ; 
				return "0" ;
			}
			else
			{	
				//Found Sam Email
				alert (2);
				tmpSession = 2 ;
				return "1" ;
			}	
			
			
		}
		
	}
	*/
	//read the ajaxfunc from asp file
	xmlHttp.open("GET","IncludeFile/ajax/" + PathStr,false);
	xmlHttp.send(null);
	

	if (xmlHttp.responseText == "0")
	{
		//NotFound Sam Email
		return false ;
	}
	else
	{	
		//Found Sam Email
		return true ;
	}	
	//return xmlHttp.responseText;

}	
















/////////////////////////////////////////////////////////////////////////
//ajaxEngine(PageId)
//Show Windows On Main Screen 
/////////////////////////////////////////////////////////////////////////	

function GalleryAjaxEngine(Id , action , ProjectGalleryID )
{  
	PathStr = "getGallery.asp?Id=" + Id + "&action=" + action + "&ProjectGalleryID=" + ProjectGalleryID ; 

	//Check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			switch(action)
			{
				case "ShowGalleryWindows":
					document.getElementById("GalleryWindows").innerHTML=xmlHttp.responseText;	
					break;    
				case "ShowBigImageWindows":
					document.getElementById("BigImageWindows").innerHTML=xmlHttp.responseText;
					break;
				case "ShowMainGalleryWindows":
					document.getElementById("MainProject").innerHTML=xmlHttp.responseText;	
					break;    
				//default:
					//code to be executed if n is different from case 1 and 2
			}
		}
	}
	xmlHttp.open("GET","IncludeFile/ajaxFunc/" + PathStr,true);
	xmlHttp.send(null);
}

/////////////////////////////////////////////////////////////////////////
//ajaxEngine(PageId)
//Show Windows On Main Screen 
/////////////////////////////////////////////////////////////////////////	

function GalleryPagingPicLine (Id , action , Page)
{  
	PathStr = "getGallery.asp?Id=" + Id + "&action=" + action + "&page=" + Page ; 

	//Check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			switch(action)
			{
				case "GalleryPaging":
					document.getElementById("GalleryWindows").innerHTML = xmlHttp.responseText;	
					break;   
				case "BigImagePaging":
					document.getElementById("BigImageWindows").innerHTML = xmlHttp.responseText;
					break;
				//default:
					//code to be executed if n is different from case 1 and 2
			}
		}
	}
	xmlHttp.open("GET","IncludeFile/ajaxFunc/" + PathStr,true);
	xmlHttp.send(null);
}

function HomeGalleryPaging (Id , action , Page)
{  
	PathStr = "Home_inc.asp?Id=" + Id + "&action=" + action + "&page=" + Page; 

	//Check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			switch(action)
			{
				case "HomeGalleryPaging":
					document.getElementById("ContentWindows").innerHTML = xmlHttp.responseText;	
					break;   
				//default:
					//code to be executed if n is different from case 1 and 2
			}
		}
	}
	xmlHttp.open("GET","" + PathStr,true);
	xmlHttp.send(null);
}


/////////////////////////////////////////////////////////////////////////
//ajaxEngine(PageId)
//Show Windows On Main Screen 
/////////////////////////////////////////////////////////////////////////	

function GalleryPaging (ProjectGalleryID , action , Page)
{  
	PathStr = "getGallery.asp?ProjectGalleryID=" + ProjectGalleryID + "&action=" + action + "&page=" + Page ; 

	//Check if your browser support AJAX .
	initXMLHttpRequest ();
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			switch(action)
			{
				case "GalleryPaging":
					document.getElementById("GalleryWindows").innerHTML = xmlHttp.responseText;	
					break;    
				case "BigImagePaging":
					document.getElementById("BigImageWindows").innerHTML = xmlHttp.responseText;
					break;
				//default:
					//code to be executed if n is different from case 1 and 2
			}
		}
	}
	xmlHttp.open("GET","IncludeFile/ajaxFunc/" + PathStr,true);
	xmlHttp.send(null);
}