
var xmlHttp


function changePhoto_Prev(firstimg)
{	
	var x;
	
	var y;
	
	y='imgsite';
	
	var t=document.getElementById('hidvalue');

	if(	t.value > firstimg)
	{
		x = (parseInt(t.value)) - 1;
		t.value = x;
		document.getElementById('next').innerHTML='<a href="javascript:void(0)" onclick="changePhoto_Next(6);" style=\"color:#FFFFFF\" >Next</a>';
		if(x==firstimg)
			document.getElementById('prev').innerHTML='Prev';
	}
	else
		x = t.value;
	
	//document[y].src='images/'+x+'.jpg';
	displaySiteTourImage(x);
	
} 


function changePhoto_Next(lastimg)
{	
	var x;
	
	var y;
	
	y='imgsite';
	
	var t=document.getElementById('hidvalue');

	if(	t.value < lastimg)
	{
		x = (parseInt(t.value)) + 1;
		t.value = x;
		document.getElementById('prev').innerHTML='<a href="javascript:void(0)" onclick="changePhoto_Prev(1);" >Prev</a>  ';
		if(x==lastimg) document.getElementById('next').innerHTML="Next";
	}
	else
	{
		x= t.value;
	}
	//document[y].src='images/'+x+'.jpg';
	displaySiteTourImage(x);
	
} 


function displaySiteTourImage(imageno)
{	
	if( (xmlHttp=GetXmlHttpObject())==null) return;
	
	var url="getsitetour_image.php";
	url+="?imageno="+imageno;
	url+="&sid="+Math.random();

	xmlHttp.onreadystatechange=function()
	{
		document.getElementById('divsite').innerHTML = '<img src="images/ajax_loader.gif" />Loading';

		if (xmlHttp.readyState==4)
			document.getElementById("divsite").innerHTML=xmlHttp.responseText;	
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function limitText(textArea, length)
{
	if (textArea.value.length > length)
		textArea.value = textArea.value.substr(0,length);		
}


function submitForm()
{
   if(document.getElementById('filUpload1').value=='')
   		alert('Please select image to upload');
   else	
		document.frmUploadFiles.submit();
}



function reduceOpacity(obj)
{
	(document.all)?obj.filters.alpha.opacity=50:obj.style.opacity=0.6;
}

function increaseOpacity(obj)
{
	(document.all)?obj.filters.alpha.opacity=100:obj.style.opacity=1;
}




/*-------------------------------------------------------------------------------------------------------*/
function showStateList(country,state)
{	
	if(!state) state='';
	
	if( (xmlHttp=GetXmlHttpObject())==null) return;
	
	var url="list_state.php";
	url+="?country_id="+country;
	url+="&state_id="+state;
	url+="&sid="+Math.random();

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


/*-------------------------------------------------------------------------------------------------------*/
function stateChanged() 
{ 
	document.getElementById('divState').innerHTML = '<img src="images/ajax_loader.gif" />';
	
	if (xmlHttp.readyState==4)
		document.getElementById("divState").innerHTML=xmlHttp.responseText;
}


//displaying subcategory in signup form

function showCategoryList(str,scat)
{	
	if(!scat) scat='';
	
	if( (xmlHttp=GetXmlHttpObject())==null) return;
	
	var url="list_subcategory_activity.php";
	url=url+"?category_name="+encodeURIComponent(str);
	url=url+"&sub_cat="+encodeURIComponent(scat);
	url=url+"&sid="+Math.random();

	xmlHttp.onreadystatechange=stateActivityCategoryChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateActivityCategoryChanged() 
{ 
	document.getElementById('divsubcategory').innerHTML = '<img src="images/loading_01.gif" />';
	
	if (xmlHttp.readyState == 4)
		document.getElementById("divsubcategory").innerHTML=xmlHttp.responseText;
}
//end of category list





//this is for displaying social.php in home.php
/* Show Social */
function showSocial()
{	
	if( (xmlHttp=GetXmlHttpObject())==null) return;

	var url="social.php";
	xmlHttp.onreadystatechange=showSocialChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function showSocialChanged() 
{ 
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';

	if (xmlHttp.readyState==4)
		document.getElementById("divHome").innerHTML=xmlHttp.responseText;
}

/* end Show Social */

//this is for displaying guru.php in home.php
/* Show guru */
function showGuru()
{	
	if( (xmlHttp=GetXmlHttpObject())==null) return;

	var url="guru.php";
	xmlHttp.onreadystatechange=showGuruChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showGuruChanged() 
{ 
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';

	if (xmlHttp.readyState==4)
		document.getElementById("divHome").innerHTML=xmlHttp.responseText;
}
/* end of guru */


/* Show Professional */
function showProfessional()
{	
	if( (xmlHttp=GetXmlHttpObject())==null) return;

	var url="professional.php";
	xmlHttp.onreadystatechange=showProfessionalChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showProfessionalChanged() 
{ 
	if(xmlHttp.readyState == 1){
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';
	}
	
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("divHome").innerHTML=xmlHttp.responseText;
	}
}
/* end Show Professional */

/* Show Personal */
function showPersonal()
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="personal.php";
	xmlHttp.onreadystatechange=showPersonalChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showPersonalChanged() 
{ 
	if(xmlHttp.readyState == 1){
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';
	}
	
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("divHome").innerHTML=xmlHttp.responseText;
	}
}
/* end Show Personal */


/* Show datepack*/
function showDatePackNew()
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="datepack_new.php";
	xmlHttp.onreadystatechange=showDatepackChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showDatepackChanged() 
{ 
	if(xmlHttp.readyState == 1){
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';
	}
	
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("divHome").innerHTML=xmlHttp.responseText;
	}
}

// Activity pack
 
function showActivityPackNew()
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="new_activitypack.php";
	xmlHttp.onreadystatechange=showActivitypackChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showActivitypackChanged() 
{ 
	if(xmlHttp.readyState == 1){
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';
	}
	
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("divHome").innerHTML=xmlHttp.responseText;
	}
}


//End of activity pack

/* Show datepack*/
function showDatePackEdit()
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="datepack_edit.php";
	xmlHttp.onreadystatechange=showDatepackEdited;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showDatepackEdited() 
{ 
	if(xmlHttp.readyState == 1){
	document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';
	}
	
	if (xmlHttp.readyState==4)
	{ 
	
	document.getElementById("divHome").innerHTML=xmlHttp.responseText;
	}
}



 /* Show friend pack */
function showFriendPackNew()
{	

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="new_friendpack.php";
xmlHttp.onreadystatechange=showFriendpackChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function showFriendpackChanged() 
{ 
if(xmlHttp.readyState == 1){
document.getElementById('divHome').innerHTML = '<img src="images/loading_01.gif" />';
}

if (xmlHttp.readyState==4)
{ 
document.getElementById("divHome").innerHTML=xmlHttp.responseText;
}
}


/* Show Basic user information */
function showBasicUserInfo()
{	
	if( (xmlHttp=GetXmlHttpObject())==null) return;
	
	document.getElementById('divHome').innerHTML = '<img src="images/ajax_loader.gif" />Loading...';
	
	var url="basicuserinfo.php?rndid="+Math.random();
	
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{ 
			document.getElementById("divHome").innerHTML=xmlHttp.responseText;
			var cnt=document.getElementById('cbocountry').value;
			var st=document.getElementById('state_id').value;
			showStateList(cnt,st);
		}
	};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function showPersonalChanged() 
{ 
	document.getElementById('divHome').innerHTML = '<img src="images/ajax_loader.gif" />Loading...';
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("divHome").innerHTML=xmlHttp.responseText;
	}
}
/* end Show basic info of user */


function GetXmlHttpObject()
{


	var xmlHttp; 
	var browser = navigator.appName; 

	try
	{
		if(browser == "Microsoft Internet Explorer")
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		else
			xmlHttp = new XMLHttpRequest();
			
		return xmlHttp;
	}
	catch(e)
	{
		alert ("Your browser does not support AJAX!");
		return null;
	}

	
}



function DispContent() 
{ 

	document.getElementById('divHome').innerHTML = '<img src="images/ajax_loader.gif" /> Loading ...';

	if (xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
			document.getElementById('divHome').innerHTML=xmlHttp.responseText;
	}
}



function closeStartupPage(str)
{	
	//document.getElementById('close').style.visibility="hidden";
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	
	var url="closestartup_page.php";
	url=url+"?user_id="+str;
	
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=DispContent;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function includeScoop(userid,curpage,reccount)
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  
	var url="recentscoop.php?sid="+Math.random();
	
	url=url+'&curpage='+curpage+'&reccount='+reccount;
	
	url=url+'&userid='+userid;
//alert(url);
	document.getElementById('divScoop').innerHTML = '<img src="images/ajax_loader.gif" /> Loading...Please wait..';
	
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
			{
				document.getElementById('divScoop').innerHTML=xmlHttp.responseText;
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function includeScoopList(userid,curpage,reccount,a)
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	var url="recentscoop.php";
	
	url=url+"?sid="+Math.random();
	
	url=url+"&sf="+a;
	
	url=url+'&userid='+userid+'&curpage='+curpage+'&reccount='+reccount;
	
	//alert(url);
	
	xmlHttp.onreadystatechange=function()
	{
		document.getElementById('divScoop').innerHTML = '<img src="images/ajax_loader.gif" />  Loading...Please wait';

		if (xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
				document.getElementById('divScoop').innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function saveNotification()
{	
	if(document.getElementById('txtname').value.length==0)
	{
		alert('Please Enter Fullname');
		document.getElementById('txtname').focus();
		return;
	}
	/*if(emailcheck(document.getElementById('txtemail').value)==false)
	{
			document.getElementById('txtemail').focus();
			return false;
	}*/

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	var url="savenotification.php";
	
	url=url+"?fname="+document.getElementById('txtname').value;
	url=url+"&madd="+document.getElementById('txtmailadd').value;
	url=url+"&tel="+document.getElementById('txttel').value;
	url=url+"&email="+document.getElementById('txtemail').value;
	url=url+'&txtcarea='+document.getElementById('txtcarea').value;
	
	url=url+'&initial='+document.getElementById('txtinitial').value;
	
	if(document.getElementById('optagree1').checked == true)
		url=url+'&agree=yes';
	else if(document.getElementById('optagree2').checked == true)
		url=url+'&agree=no';
	
	url=url+"&sf="+Math.random();
	
	xmlHttp.onreadystatechange=function()
	{
		document.getElementById('divnotification').innerHTML = '<img src="images/ajax_loader.gif" /> Sending Mail to PickMyPack Corporation';

		if (xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
				document.getElementById('divnotification').innerHTML=xmlHttp.responseText;
				//window.location.hash ="balakrishnan.php";
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function storeUserTheme(id)
{	

	if( (xmlHttp=GetXmlHttpObject())==null) return;
	
	var url="themecolor.php";
	url+="?id="+id;
	url+="&sid="+Math.random();

	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
				window.location.reload();
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function showRecentUserPhoto()
// Function to display a random user photo on login page.
{	
	if( (xmlHttp=GetXmlHttpObject())==null) return;
	
	document.getElementById('randomphotos').innerHTML = '<img src="images/ajax_loader.gif" />Please wait...';
	
	var url="randomprofilephoto.php?n=5&rndid="+Math.random();
	
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{ 
			document.getElementById("randomphotos").innerHTML=xmlHttp.responseText;
			
		}
	};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 