
/////////////////////// Function to get States ////////////////*/
var ajax = new sack();

function showMailWindow(CampID,memId)
{
	if (memId == '')
	{
		alert('Please login into your account.');
	}
	else
	{
		document.getElementById('hidCampId').value = CampID;
		document.getElementById('Id_Camp_Email').style.display = '';
	}
}
function mailCamptoFriend(site_url,frm)
{
	if(GenValidation(frm.txtFrndEmail,'Email','','')=='')
	{
		return false;
	}
	else if(EmailValidation(frm.txtFrndEmail)=='')
	{
		return false;
	}
	else
	{
		var frnEmail = document.getElementById('txtFrndEmail').value;
		var cmpId = document.getElementById('hidCampId').value;
		ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?frndEmailId='+frnEmail+'&campId='+cmpId;
		ajax.onCompletion = ajaxResponse;
		ajax.runAJAX();
	}
}
	


function addBackPack(site_url,cmpId)
{
	//var tbl = document.getElementById('tbl_backpack').getElementByTagName("TBODY")[0];
	//var lastrow = tbl.rows.length;
	//var cnt = parseInt(lastrow)+1;
	//alert(cnt);
	//var tr = tbl.insertRow(lastrow);
	ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?addBackPack='+cmpId;
	ajax.onCompletion = backPackResponse;
	ajax.runAJAX();
}

function backPackResponse()
 {
	//alert(ajax.response);  
	eval(ajax.response);
	
 }

function closeTheDiv()
 {
	document.getElementById('Id_Camp_Email').style.display='none'; 
 }
function addBackPack2(site_url,cmpId)
{
	ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?addBackPack2='+cmpId;
	ajax.onCompletion = ajaxResponse;
	ajax.runAJAX();
}


function saveTheSearch(site_url,membId,campIds,sp_opt)// for search container == 1 else 0 
{
	if(campIds == 0)
	{
		alert('Zero results to save the search.');	
		return false;
	}
	if(membId == 0)
	{
		alert('Please login to save the search.');
		return false
	}
	if(sp_opt == 1)
	{
		if(document.getElementById('txtSaveSearchName').value == '')
		{
			alert('Please enter the search name.');
			document.getElementById('txtSaveSearchName').focus();
			return false;
		}
		else
		{
			var searchName = document.getElementById('txtSaveSearchName').value;	
		}
	}
	if(sp_opt == 2)
	{
		if(document.getElementById('txtSaveSearchName_2').value == '')
		{
			alert('Please enter the search name.');
			document.getElementById('txtSaveSearchName_2').focus();
			return false;
		}
		else
		{
			var searchName = document.getElementById('txtSaveSearchName_2').value;	
		}
	}
	
		ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?saveSearchIds='+campIds+'&searchName='+searchName+'&sp_opt='+sp_opt;
		ajax.onCompletion = ajaxResponse;
		ajax.runAJAX();
}



function addChildBackpack(site_url)
{
	
	var cmpId = document.getElementById('hidBackCampId').value;
	
	//alert(cmpId);
	
	if(document.getElementById('ChkChild_0').checked == true)
	{
	 	var all_mem = 1;
	}
	else
	{
		var all_mem = 0;
	}
	var childIds = '';
	for(var j = 1 ; j<=3 ; j++)
	{
		singleId = '';
		if(document.getElementById('ChkChild_'+j))
		{
			if(document.getElementById('ChkChild_'+j).checked == true)
			{
				var singleId = document.getElementById('ChkChild_'+j).value;
				var childIds = singleId+","+childIds;	
			}
		}
	}
	if(childIds == '')
	{
		childIds = "0";	
	}
	ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?addChildBackPack='+cmpId+'&allMem='+all_mem+'&childIds='+childIds;
	ajax.onCompletion = backPackResponse;
	ajax.runAJAX();	
}

function addChildBackpack2(site_url)
{
	
	var cmpId = document.getElementById('hidBackCampId').value;
	
	//alert(cmpId);
	
	if(document.getElementById('ChkChild_0').checked == true)
	{
	 	var all_mem = 1;
	}
	else
	{
		var all_mem = 0;
	}
	var childIds = '';
	for(var j = 1 ; j<=3 ; j++)
	{
		singleId = '';
		if(document.getElementById('ChkChild_'+j))
		{
			if(document.getElementById('ChkChild_'+j).checked == true)
			{
				var singleId = document.getElementById('ChkChild_'+j).value;
				var childIds = singleId+","+childIds;	
			}
		}
	}
	if(childIds == '')
	{
		childIds = "0";	
	}
	ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?addChildBackPack2='+cmpId+'&allMem='+all_mem+'&childIds='+childIds;
	ajax.onCompletion = ajaxResponse;
	ajax.runAJAX();	
}


function goSearchSubmit(site_url)
{
	if(document.getElementById('selZipDist'))
	{							   
		if(document.getElementById('selZipDist').value != 0 )
		{
			if(document.getElementById('txtZip').value == '') 
			{
				alert('Please enter the zip.');
				document.getElementById('txtZip').focus();
				return false			
			}
		}
	}
	
	document.Form_Name_MidCont.action = site_url+'/search-results.html';
	document.Form_Name_MidCont.submit();
}

function showResultsOnMap(site_url)
{
	document.Form_Name_MidCont.action = site_url+'/search.html';
    document.getElementById('show_on_map').value=1;
	document.Form_Name_MidCont.submit();
}

function getstates(site_url,val)
{
	ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?country='+val;
	ajax.onCompletion = ajaxResponse;
	ajax.runAJAX();
}


function ajaxResponse()
{
	//alert(ajax.response);
	eval(ajax.response);
}
function closeMailWindow()
{
	document.getElementById('txtFrndEmail').value ='';
	document.getElementById('IdEmailMsg').innerHTML ='';
	document.getElementById('Id_Camp_Email').style.display='none';
}
	
function postCategorySearch(site_url,catId)
{	
	document.getElementById('hid_category').value = catId;
	document.Form_Name_MidCont.action = site_url+'/search-results.html';
	document.Form_Name_MidCont.submit();
}

function postSubCategorySearch(site_url,subCatId)
{	
	document.getElementById('hid_subcategory').value = subCatId;
	document.Form_Name_MidCont.action = site_url+'/search-results.html';
	document.Form_Name_MidCont.submit();
}

function postTypeSearch(site_url,cType,cId)
{
	document.getElementById('chk_TType_'+cId).value = cType;
	document.Form_Name_MidCont.action = site_url+'/search-results.html';
	document.Form_Name_MidCont.submit();	
}

function showBroucherDiv(site_url,memb_Id,campId)
{
	if(memb_Id == 0)	
	{
		alert('Please loging to send request.');
	}	
	else 
	{ 
		// to know whether the user enetered the brochure request form while registration.
	
		ajax.requestFile = site_url+'/controllers/ajax_controller/middle-content.php?broucherReqMemId='+memb_Id+'&brocCampIds='+campId;
		ajax.onCompletion = ajaxResponse;
		ajax.runAJAX();	
	}
}
function sendBroucherRequest(cmpId)
{
	if(document.getElementById('txtMessage').value=='')
	{
		alert('Please enter enquiry');
		document.getElementById('txtMessage').focus();
		return false;	
	}
	document.getElementById('hidBroCampId').value = cmpId;
	document.Form_Name.submit();
}

function showDesc(id)
{
	if(document.getElementById('Id_Desc_'+id).style.display == 'none')
	{
		document.getElementById('Id_Desc_'+id).style.display = '';
	}
	else
	{
		document.getElementById('Id_Desc_'+id).style.display = 'none';
	}
}

function showSaveSearch(id) // id to differentiate search container and remaining search pages
{
	if(id==1)
	{
		if(document.getElementById('ID_SaveSearch').className == 'home-pop-box inactive')
		{
			document.getElementById('ID_SaveSearch').className = 'home-pop-box active';
			document.getElementById('ID_SaveSearch').className = 'home-pop-box active';
			document.getElementById('IdSaveSearchMsg').innerHTML = '';
			document.getElementById('txtSaveSearchName').value = '';
		}
		else if(document.getElementById('ID_SaveSearch').className == 'home-pop-box active')
		{
			document.getElementById('ID_SaveSearch').className = 'home-pop-box inactive';
			document.getElementById('IdSaveSearchMsg').innerHTML = '';
			document.getElementById('txtSaveSearchName').value = '';
		}
	}
	if(id == 2)
	{
		if(document.getElementById('ID_SaveSearch_2').className == 'home-pop-box inactive')
		{
			document.getElementById('ID_SaveSearch_2').className = 'home-pop-box active';
			document.getElementById('ID_SaveSearch_2').className = 'home-pop-box active';
			document.getElementById('IdSaveSearchMsg_2').innerHTML = '';
			document.getElementById('txtSaveSearchName_2').value = '';
		}
		else if(document.getElementById('ID_SaveSearch_2').className == 'home-pop-box active')
		{
			document.getElementById('ID_SaveSearch_2').className = 'home-pop-box inactive';
			document.getElementById('IdSaveSearchMsg_2').innerHTML = '';
			document.getElementById('txtSaveSearchName_2').value = '';
		}
		
	}

}
function closeSaveCamps()
{
	document.getElementById('Id_ChildrenBackPack').className ='camp-pop-box inactive';
	document.getElementById('MsgBackId').innerHTML = '';
}

<!--  for number pagination -->
function numPagination(pageid)
{
	document.getElementById('page_no').value=pageid;
	document.Form_Name_MidCont.submit();
}
function campId(val,clink)
{
	//alert(val);
	//alert(clink);
	document.getElementById('hide_camp_id').value=val;
	document.getElementById('hid_Camp_Link').value = clink;
	document.Form_Name_MidCont.submit();
}


////////////////////////////// THIS CODE IS FOR ROTATING IMAGE-BANNER ///////////////////////////////////////

var currentslide=0
////Do not edit pass this line////////////////
var ie=document.all
var dom=document.getElementById
var slidedelay=2000

//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth='575px' //set to width of LARGEST image in your slideshow
var slideheight='92px' //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#CC2299'

function rotateimages(){
contentcontainer='<center>'
if (variableslide[currentslide][1]!="")
contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
contentcontainer+='<img src="'+variableslide[currentslide][0]+'"  style="width:'+slidewidth+'; height:'+slideheight+';" >'
if (variableslide[currentslide][1]!="")
contentcontainer+='</a>'
contentcontainer+='</center>'
if (variableslide[currentslide][2]!="")
contentcontainer+=variableslide[currentslide][2]

if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotateimages()",slidedelay)
}

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotateimages()
}

function homeBannerAdv(variableslide)
{

//configure the below variable to determine the delay between image rotations (in miliseconds)

for (i=0;i<variableslide.length;i++){
var cacheimage=new Image()
cacheimage.src=variableslide[i][0]
}

if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+'; height:'+slideheight+'; overflow:hidden;"></div>')

if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider
}

////////////////////////////// THIS CODE IS FOR ROTATING IMAGE-BANNER ///////////////////////////////////////



///////////////////////CODE FOR CHANGE IMAGES IN CAMP PROFILE\\\\\\\\\\\\\\\\\\\\\\\\\\\
function imgDetails(path,title)
{
	document.getElementById('img_big').src = path;
	document.getElementById('td_imgname').innerHTML = '<strong>Name</strong>:'+title;
	return false;	
}



////////////////////////////// THIS CODE IS FOR ROTATING IMAGE-BANNER ///////////////////////////////////////

var currentslide=0
////Do not edit pass this line////////////////
var ie=document.all
var dom=document.getElementById
var slidedelay=2000

//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth='575px' //set to width of LARGEST image in your slideshow
var slideheight='92px' //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#CC2299'

function rotateimages(){
contentcontainer='<center>'
if (variableslide[currentslide][1]!="")
contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
contentcontainer+='<img src="'+variableslide[currentslide][0]+'"  style="width:'+slidewidth+'; height:'+slideheight+';" >'
if (variableslide[currentslide][1]!="")
contentcontainer+='</a>'
contentcontainer+='</center>'
if (variableslide[currentslide][2]!="")
contentcontainer+=variableslide[currentslide][2]

if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotateimages()",slidedelay)
}

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotateimages()
}

function searchResultsBannerAdv(variableslide)
{

//configure the below variable to determine the delay between image rotations (in miliseconds)

for (i=0;i<variableslide.length;i++){
var cacheimage=new Image()
cacheimage.src=variableslide[i][0]
}

if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+'; height:'+slideheight+'; overflow:hidden;"></div>')

if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider
}

////////////////////////////// THIS CODE IS FOR ROTATING IMAGE-BANNER ///////////////////////////////////////