function submitSearchdom(root)
	{
	   document.searchForm.minDuration.value=1;
       if(document.searchForm.duration.value==7)
          document.searchForm.minDuration.value=4;
       if(document.searchForm.duration.value==10)
          document.searchForm.minDuration.value=8;
	   document.searchForm.dest.value ="";
	   var iKnow = document.getElementById('package.city').value;
       var autoSuggested = document.getElementById('cityAuto').value;
var frm=document.searchForm;
 


       if(iKnow == "" && (autoSuggested == "" || autoSuggested=='Enter your destination here') )
		{
		}
		else if(iKnow != "")
		{
	    	document.searchForm.dest.value = iKnow;
		}
		else if(!(autoSuggested == "" || autoSuggested=='Enter your destination here'))
		{
			document.searchForm.dest.value = autoSuggested;
		}
		if(autoSuggested=='Enter your destination here')
		{
		   document.getElementById('cityAuto').value='';
		}
		if(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
		{
		   document.searchForm.category.value=document.getElementById("search_"+0).innerHTML;
		}
		if(document.searchForm.month.value !="-1" || document.searchForm.duration.value != "-1")
		{        	document.forms[0].submit();
		return;
		}

        var destModified = document.searchForm.dest.value;
	    if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
	       && !(document.searchForm.theme.value == null || document.searchForm.theme.value == '' || document.searchForm.theme.value == 'undefined' )
	       && !((destModified == null || destModified == '' || destModified == 'undefined') ))
        {
           var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
           var dest = ReplaceAll(destModified.toLowerCase(),' ','_');
           var theme = ReplaceAll(document.searchForm.theme.value.toLowerCase(),' ','_');
           document.location.href = root+"/trips-" + theme +"-"+ category +"-"+ dest+".html";
        }
        else if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
	       && !(document.searchForm.theme.value == null || document.searchForm.theme.value == '' || document.searchForm.theme.value == 'undefined' ))
        {
           var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
           var theme = ReplaceAll(document.searchForm.theme.value.toLowerCase(),' ','_');
           document.location.href = root+"/tours-" + theme +"-"+ category +".html";
        }
        else if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
	       && !((destModified == null || destModified == '' || destModified == 'undefined')))
        {
           var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
           var dest = ReplaceAll(destModified.toLowerCase(),' ','_');
           document.location.href = root+"/travel-" + category +"-"+ dest+".html";
        }
        else if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' ))
        {
        	var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
        	var urlToSubmit =root+"/packages-" + category +".html";
            document.location.href = urlToSubmit;
        }
}

function ReplaceAll(Source,stringToFind,stringToReplace){
  var temp = Source;
  var index = temp.indexOf(stringToFind);
  while(index != -1)
  	{
       temp = temp.replace(stringToFind,stringToReplace);
       index = temp.indexOf(stringToFind);
    }
  return temp;

}

function isEnterKey(evt,url)
  {
      var charCode = (evt.which) ? evt.which : event.keyCode
     
      if ( charCode == 13) {
		submitSearchList(url);
      } else {

      }
  }
  
function makemevis(a)
{var st=document.getElementsByTagName("div");

for(i=0;i<st.length;i++)
	{
	var aa=st[i].id;
	if(aa.indexOf("departure_") >-1)
		{
st[i].style.display="none";
		}
	}
	
document.getElementById(a).style.display="block";
}
function removeme()
{
document.getElementById("phonenumbers").style.display="none";
document.getElementById("blackoverlayphone").style.display="none";
}
function phonenumbers()
{
var maintableHeight = document.getElementById("maintable").offsetHeight;
document.getElementById("phonenumbers").style.display="block";
document.getElementById("blackoverlayphone").style.display="block";
var browserName = whichBrs(); 
   if(browserName=="IE")
  	{
  	 	var bodywidth = document.body.scrollWidth;
  	 	var bodyheight = document.body.scrollHeight;
  	 	document.getElementById("blackoverlayphone").style.width=bodywidth+"px";
  	 	document.getElementById("blackoverlayphone").style.height=bodyheight+"px";	
  	}
   if(browserName=="Firefox")
  	{
  		document.getElementById("blackoverlayphone").style.height=maintableHeight+480+"px";	
  	}
	if(browserName=="Safari")
  	{
  		document.getelementbyid(iframeclosebtn).style.left=leftpos+524+"px";
    	document.getelementbyid(iframeclosebtn).style.top=toppos-12+"px";
  	}
document.getElementById("phonenumbers").style.position="absolute";
 	

getpackagelisting(rootpath+'/transform.transform?style=/xslt/phonenumbers_xsl&content=phonenumbers_xml&domorobt=dom&rnd='+Math.random(),'phonenumbers')
}
function deselectallsortingstates()
{
document.getElementById("priority_img").src=rootpath+"/images/options-rightimg.jpg";
document.getElementById("priority_img").style.height="12px";
document.getElementById("duration_img").src=rootpath+"/images/options-rightimg.jpg";
document.getElementById("duration_img").style.height="12px";
document.getElementById("dicountedRates_img").src=rootpath+"/images/options-rightimg.jpg";
document.getElementById("dicountedRates_img").style.height="12px";
}

function selectedstate()
{


}
var sortingstate="";
var sortOrder='ASC';
flag=0;
function sortme(c,a,b,context)
{

deselectallsortingstates();
if(a!='includeflights' && a!='nosorting')
	{
if(sortOrder=='DESC' && sortingstate==a)
	{
	sortOrder='ASC';
	}
else if(sortOrder=='ASC' && sortingstate==a)
	{
	sortOrder='DESC';
	}

if(a=='priority' && flag==0)
{
	sortOrder='DESC';
	flag=1;
}
else 
{
	if(flag==1)
	{	sortOrder='ASC';
		flag=0;
	}
}

if(sortOrder=="ASC")
	{
document.getElementById(a+"_img").src=rootpath+"/images/asc.gif";
document.getElementById(a+"_img").style.height="6px";
}
else
	if(sortOrder=="DESC")
	{
document.getElementById(a+"_img").src=rootpath+"/images/dsc.gif";
document.getElementById(a+"_img").style.height="6px";

}
	}

sortingstate=a;
var includeflights='';
/*
if(document.getElementById("includeflightss").checked==true)
	{
 includeflights='&containsFlight=on';
	}
	else
	{ includeflights='';
	}
*/
document.getElementById(b).innerHTML="Populating...";
var sliderdefaultsort="";

if(document.getElementById("priority").checked==true)
	{
	sliderdefaultsort='priority';
	}
else if(document.getElementById("pkg_duration").checked==true)
	{
	sliderdefaultsort= 'duration';
		}
else if(document.getElementById("dicountedRates").checked==true)
	{
	sliderdefaultsort= 'dicountedRates';
	}
	
	
	ExcludeThemes="";
	var selectedthemeslength=document.getElementsByName('refinethemes').length;
var st=document.getElementsByName('refinethemes');
for(i=0;i<selectedthemeslength;i++)
	{
if(st[i].checked==true)
		{
ExcludeThemes +=','+st[i].value;
		}
	}
var ExcludeThemeslength=ExcludeThemes.length;
	if(ExcludeThemes.charAt(0)==',')
	{
ExcludeThemes=ExcludeThemes.substring(1,ExcludeThemeslength);
	}

if(ExcludeThemes=="")
	{

	}
	else
	{ExcludeThemes="&includeThemes="+ExcludeThemes;

	}
	var duration_variable='';
	if(max_duration=="" || min_duration=="" || min_duration==max_duration || max_duration==null || min_duration==null)
	{

	}else
	{duration_variable='&duration='+max_duration+'&minDuration='+min_durationnew;
	}


	if(a=='nosorting')
	{

										

getpackagelisting('/'+context+'/india/includes/searchajax?sortName='+getsortname()+'&sortOrder='+sortOrder+c+includeflights+'&minRate='+min_rate+'&rate='+max_rate+duration_variable+ExcludeThemes,b);
											
	
	}
	else
	{
if(a=='includeflights')
		{
a=getsortname();
}

	getpackagelisting('/'+context+'/india/includes/searchajax?sortName='+a+'&sortOrder='+sortOrder+c+includeflights+'&minRate='+min_rate+'&rate='+max_rate+duration_variable+ExcludeThemes,b)
	

	}
}

function getsortname()
{
var a="";
var inputs=document.getElementsByName('sort');

for(i=0;i<inputs.length;i++)
			{
if(inputs[i].checked==true)
				{
	a=inputs[i].value;
				}
			}
		
return a;
}
function selectclass(tab_id)
{
	
if(tab_id=="rates_tab")
	{document.getElementById("pricetagdates").style.display="none";
	}
	else
	{document.getElementById("pricetagdates").style.display="block";
	}
document.getElementById('overview_tab').className="";
document.getElementById('overview_tab_data').style.display="none";

document.getElementById('itenary_tab').className="";
document.getElementById('itenary_tab_data').style.display="none";
document.getElementById('hotel_tab').className="";
document.getElementById('hotel_tab_data').style.display="none";

document.getElementById('destination_tab').className="";
document.getElementById('destination_tab_data').style.display="none";

document.getElementById('photo_tab').className="";
document.getElementById('photo_tab_data').style.display="none";

document.getElementById('rates_tab').className="";
document.getElementById('rates_tab_data').style.display="none";

document.getElementById(tab_id).className="activeNav";
document.getElementById(tab_id+"_data").style.display="block";

}
  function overlayOpen(getID)
  {
  	var maintableHeight = document.getElementById("maintable").offsetHeight;
  	document.body.style.scrollTop="0px";
  	document.getElementById(getID).style.display="block";
  	document.getElementById("fade").style.height=maintableHeight+40+"px";
  	document.getElementById("fade").style.display="block";
  }	
 function LoadGallery(pictureName,imageFile,captionID,captionText,imagealt)
 {
 	var picture = document.getElementById(pictureName);
   picture.src =imageFile;
   picture.alt =imagealt;
   picture.title =imagealt;
         
   if(captionText=='null')
	 {
		document.getElementById('photogalimg-desc').innerHTML="";
	 }
	 
	 else
	 {
   document.getElementById('photogalimg-desc').innerHTML=captionText;
	 }
	 
	  if(captionID=='null')
	 {
		document.getElementById('photogalimg-title').innerHTML="";
	 }
	 
	 else
	 {
	 document.getElementById("photogalimg-title").innerHTML=captionID;
	 }
  }

/*
function getData(package_id,tab_id,mode)
{
selectclass(tab_id);


}
*/
function selectme(a, category)
{
for(i=0;i<6;i++)
{
	try{
	document.getElementById("search_"+i).className="notselected";
	}catch(error) {
	}
	}
	
	a.className="selected";
	document.getElementById("srch_categories").style.backgroundColor="#fdf9d1";
	document.searchForm.category.value=category;
}
function sendrequestagain(a)
{
}


function AJAXInteraction(div,url, callback) {

    var req = init();
    req.onreadystatechange = processRequest;

    function init() {
      if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
      }
    }

    function processRequest () {
      if (req.readyState == 4) {
        if (req.status == 200) {
          if (callback) {
         if(document.getElementById(div) != null) {
	          callback( document.getElementById(div).innerHTML=req.responseText);
	          //ExpandCollapse('Expandcollapsesection');
       		}
		
       	}
		}
      }
    }

    this.doGet = function() {
      req.open("GET", url, true);
      req.send(null);
    }

    this.doPost = function(body) {
      req.open("POST", url, true);
      req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      req.send(body);
    }
}

function makeRequest(url,div) {
  var ai = new AJAXInteraction(div,url, function() { });
  ai.doGet();


}
function makegetRequest()
{	
}

function getpackagelisting(url,div) {url=url+"&rnd="+Math.random();	
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
/*
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/html');
}
*/
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}

if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.open('GET', url, true);

http_request.send(null);
http_request.onreadystatechange = function()
{
if (http_request.readyState == 4) {
if (http_request.status == 200) {

result = http_request.responseText;

document.getElementById(div).innerHTML=result;

if(div=='modifyyoursearch') populaterefinebytheme();




} else {
alert('There was a problem with the request.');
}
}

}

}

var themes="";


function populaterefinebytheme()
{
var themelength=document.getElementById("package.theme").options.length;
var obj=document.getElementById("package.theme");
var themestring='<table><tr><td><b>Refine by Theme</b></td></tr><tr><td height="8px"></td></tr><tr><td><table border="0" cellspacing="0" cellpadding="0">';
themestring +='<tr>';
for(i=1;i<=themelength-1;i++)
	{
if(i<themelength-1)
		{
	themes +=obj.options[i].value+',';
		}
		else
		{
			themes +=obj.options[i].value;
		}

if(i % 2 !=0)
		{themestring +='<tr>';
		}
themestring +='<td width="22"><input type="checkbox" onclick="sortme(\''+searchstring+'\',\'nosorting\',\'packageListing\',\''+rootpath.replace("/",'')+'\')" name="refinethemes" id="'+obj.options[i].value+'"  value="'+obj.options[i].value+'" checked="checked"/></td>';
themestring +='<td height="20" width="65">'+obj.options[i].value+'</td>';
			if(i % 2 ==0){																
		themestring +='</tr>';
			}
	}
		themestring +='</tr>';
themestring +='</table></td></tr></table>'
if(document.getElementById("refinebythemes"))
	{
document.getElementById("refinebythemes").innerHTML=themestring;
	}
}
function calculatethemes()
{

}




function holidaythemelisting(context)
{
}




function holidaydestinationlisting(context)
{

}

function destinationlisting(url,div) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
/*
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/html');
}
*/
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}

if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.open('GET', url, true);

http_request.send(null);
http_request.onreadystatechange = function()
{
if (http_request.readyState == 4) {
if (http_request.status == 200) {

result = http_request.responseText;


document.getElementById(div).innerHTML=result;
if(div=='container')
	{
destinationlisting(rootpath+'/transform.transform?style=top3dest_heading_destinationpage_xsl&content=top3dest_heading_destinationpage_xml','top3destination_heading');
	}



if(div=='top3destination_heading')
	{
destinationlisting(rootpath+'/transform.transform?style=tagthis_xsl&content=tagthis_xml','tagthiscontainer');
	}
if(div=='tagthiscontainer')
{
	
	destinationlisting(rootpath+'/transform.transform?style=section1_xsl&content=section1_xml','honeymooncontainer');
}

if(div=='honeymooncontainer')
{destinationlisting(rootpath+'/transform.transform?style=section2_xsl&content=section2_xml','escortedcontainer');
}
if(div=='escortedcontainer')
{destinationlisting(rootpath+'/transform.transform?style=section3_xsl&content=section3_xml','section3');
}
if(div=='section3')
{destinationlisting(rootpath+'/transform.transform?style=section4_xsl&content=section4_xml','section4');
}
if(div=='section4')
{destinationlisting(rootpath+'/transform.transform?style=section5_xsl&content=section5_xml','section5');
}


} else {
alert('There was a problem with the request.');
}
}

}

}








function themelisting(url,div) {
http_request = false;

if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
/*
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/html');
}
*/
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}

if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.open('GET', url, true);

http_request.send(null);
http_request.onreadystatechange = function()
{
if (http_request.readyState == 4) {
if (http_request.status == 200) {

result = http_request.responseText;

document.getElementById(div).innerHTML=result;


if(div=='container')
	{
themelisting(rootpath+'/transform.transform?style=top3theme_heading_themespage_xsl&content=top3theme_heading_themespage_xml','top3theme_heading');
	}
if(div=='top3theme_heading')
	{
themelisting(rootpath+'/transform.transform?style=tagthis_xsl&content=tagthis_xml','tagthiscontainer');
	}
if(div=='tagthiscontainer')
{
	
	themelisting(rootpath+'/transform.transform?style=section1_xsl&content=section1_xml','honeymooncontainer');
}

if(div=='honeymooncontainer')
{themelisting(rootpath+'/transform.transform?style=section2_xsl&content=section2_xml','escortedcontainer');
}
if(div=='escortedcontainer')
{themelisting(rootpath+'/transform.transform?style=section3_xsl&content=section3_xml','section3');
}
if(div=='section3')
{themelisting(rootpath+'/transform.transform?style=section4_xsl&content=section4_xml','section4');
}
if(div=='section4')
{themelisting(rootpath+'/transform.transform?style=section5_xsl&content=section5_xml','section5');
}


} else {
alert('There was a problem with the request.');
}
}

}

}









function showpromotiondiv(id)
{
document.getElementById("completepromo_"+id).style.display="block";
document.getElementById("incompletepromo_"+id).style.display="none";

}
function showincompletediv(id)
{
document.getElementById("completepromo_"+id).style.display="none";
document.getElementById("incompletepromo_"+id).style.display="block";


}


function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


function validate(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = email;
   if(reg.test(address) == false) {
    
      return false;
   }
return true;
}


function registerMail() {
	if(validate(trim(document.emailRegisterForm["dealsEmail.emailId"].value)))
	{
	
	}
	else
	{	result="Please enter valid email";
				document.getElementById("status").innerHTML = result;
				document.getElementById("status").style.color="red";
				document.getElementById("status").style.display = "block";
		return false;
	}
	http_request = false;
	var emailId = document.emailRegisterForm["dealsEmail.emailId"].value;
	var branch =  document.emailRegisterForm["dealsEmail.branch"].value;
	var url= rootpath+ "/dealsEmail?dealsEmail.branch=" + branch + "&dealsEmail.emailId=" + emailId;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		/*
		 * if (http_request.overrideMimeType) {
		 * http_request.overrideMimeType('text/html'); }
		 */
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
			}
		}
	}

	if (!http_request) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	http_request.open('GET', url, true);

	http_request.send(null);
	http_request.onreadystatechange = function() {
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {

				result = http_request.responseText;
				result="Email Registered Successfully..";
				document.getElementById("status").innerHTML = result;
				document.getElementById("status").style.color="red";
				document.getElementById("status").style.display = "block";

			} else {
				alert('There was a problem with the request.');
			}
		}

	}

}
function deselectsuggestion()
{document.getElementById('package.city').value="";
}
function deSelectDest(e){
			autoSuggested = document.getElementById('cityAuto').value;
			if(!(autoSuggested == "" || autoSuggested=='Enter your destination here')){
				document.getElementById('package.city').selectedIndex = 0;
			}
	}
function resetDest(packageCity){
	if(packageCity.value !='')
	{
	document.getElementById('cityAuto').value = "Enter your destination here";
	}
	else
	{
	document.getElementById('cityAuto').value = "";
	}

}

function selectDefaultCat(){
	try{
	 document.getElementById("search_"+0).className="selected";
	}catch(error) {
	 }
 
	 document.searchForm.category.value=document.getElementById("search_"+0).innerHTML;
 
}
 function initializeoverlay(iframeID,path)
  {

  		//document.getElementById(iframeID).src="/"+path+'&'+new Date();
		document.getElementById(iframeID).src=rootpath+"/loading";

  	
  }	
  

 function overlayOpen(iframeID,blackoverlayid,iframeClosebtn)
  { 
   var browserName = whichBrs(); 
   var maintableHeight = document.getElementById("maintable").offsetHeight;
   var leftPos = (screen.width / 2) - 251;
	 //var topPos = (screen.height / 2) - 255;
	 var topPos = (screen.height / 2) - 320;
   var bodywidth;
   var bodyheight;
   
   if(overlayOpen.arguments.length==4)
  	{
  		document.getElementById(iframeID).src="/"+overlayOpen.arguments[3]+'&'+new Date();
  	}
  	
  	if(overlayOpen.arguments.length==6)
		{
			document.getElementById(iframeID).src="/"+overlayOpen.arguments[3]+"&price="+overlayOpen.arguments[4]+"&destination="+overlayOpen.arguments[5]+"&timestamp="+new Date();
			//alert(document.getElementById(iframeID).src);
			//document.wr(document.getElementById(iframeID).src);
		}

   document.getElementById(iframeClosebtn).style.left=leftPos+525+"px";
   document.getElementById(iframeClosebtn).style.top=topPos+"px";
   document.getElementById(iframeClosebtn).style.display="block";
   
   document.getElementById(iframeID).style.left=leftPos+"px";
   document.getElementById(iframeID).style.top=topPos+"px";
      
   document.getElementById(blackoverlayid).style.height=maintableHeight+480+"px";	
   if(browserName=="IE")
  	{
  	 	bodywidth = document.body.scrollWidth;
  	 	bodyheight = document.body.scrollHeight;
  	 	document.getElementById(blackoverlayid).style.width=bodywidth+"px";
  	 	document.getElementById(blackoverlayid).style.height=bodyheight+"px";	
  	}
   if(browserName=="Firefox")
  	{
  		document.getElementById(blackoverlayid).style.height=maintableHeight+480+"px";	
  		document.getElementById(iframeClosebtn).style.left=leftPos+523+"px";
  		document.getElementById(iframeClosebtn).style.top=topPos-41+"px";
  		document.getElementById(iframeID).style.top=topPos-30+"px";	  		
  	}

	if(browserName=="Safari")
	{
  		document.getElementById(iframeClosebtn).style.left=leftPos+524+"px";
    	document.getElementById(iframeClosebtn).style.top=topPos-12+"px";
  	}

  	document.getElementById(iframeID).style.display="block";
  	document.getElementById(blackoverlayid).style.display="block";
  }	
  
  
  function OverlayClose(iframeID,blackoverlayid,iframeClosebtn)
  {
  	document.getElementById(iframeID).src=rootpath+"/loading";
  	document.getElementById(iframeID).style.display="none";
  	document.getElementById(blackoverlayid).style.display="none";
  	document.getElementById(iframeClosebtn).style.display="none";
  }
  
  
  
function whichBrs() {
		var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("opera") != -1) return 'Opera';
		if (agt.indexOf("staroffice") != -1) return 'Star Office';
		if (agt.indexOf("webtv") != -1) return 'WebTV';
		if (agt.indexOf("beonex") != -1) return 'Beonex';
		if (agt.indexOf("chimera") != -1) return 'Chimera';
		if (agt.indexOf("netpositive") != -1) return 'NetPositive';
		if (agt.indexOf("phoenix") != -1) return 'Phoenix';
		if (agt.indexOf("firefox") != -1) return 'Firefox';
		if (agt.indexOf("safari") != -1) return 'Safari';
		if (agt.indexOf("skipstone") != -1) return 'SkipStone';
		if (agt.indexOf("msie") != -1) return "IE";
		if (agt.indexOf("netscape") != -1) return 'Netscape';
		if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
		if (agt.indexOf('\/') != -1) {
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
		return navigator.userAgent.substr(0,agt.indexOf('\/'));}
		else return 'Netscape';} else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
		else return navigator.userAgent;
}

function submitSearchList(url) 
	{
	   document.searchForm.minDuration.value=1;
       if(document.searchForm.duration.value==7)
          document.searchForm.minDuration.value=4;
       if(document.searchForm.duration.value==10)
          document.searchForm.minDuration.value=8;
       var destModified="";
	   var iKnow = document.getElementById('package.city').value;
       var autoSuggested = document.searchForm.dest.value;
			

 var frm=document.searchForm;



       if(iKnow == "" && (autoSuggested == "" || autoSuggested=='Enter your destination here') )
		{
		}
	   else if(iKnow != "")
		{
	    	document.searchForm.dest.value = iKnow;
	    	destModified = iKnow;
		}
	   else if(!(autoSuggested == "" || autoSuggested=='Enter your destination here'))
		{
			document.searchForm.dest.value = autoSuggested;
			destModified = autoSuggested;
		}
	
		if(autoSuggested=='Enter your destination here')
		{
		   document.getElementById('cityAuto').value='';
		}
		if(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
		{
		   document.searchForm.category.value=document.getElementById("search_"+0).innerHTML;
		}
		if(document.searchForm.month.value !="-1" || document.searchForm.duration.value != "-1")
		{	
			document.searchForm.dest.value = destModified;
			document.forms[0].submit();
			return;
	    }
		if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
	       && !(document.searchForm.theme.value == null || document.searchForm.theme.value == '' || document.searchForm.theme.value == 'undefined' )
	       && !((destModified == null || destModified == '' || destModified == 'undefined') ))
        {
		   var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
           var dest = ReplaceAll(destModified.toLowerCase(),' ','_');
           var theme = ReplaceAll(document.searchForm.theme.value.toLowerCase(),' ','_');
           document.location.href = url+"/trips-" + theme +"-"+ category +"-"+ dest+".html";
        }
        else if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
	       && !(document.searchForm.theme.value == null || document.searchForm.theme.value == '' || document.searchForm.theme.value == 'undefined' ))
        {
           var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
           var theme = ReplaceAll(document.searchForm.theme.value.toLowerCase(),' ','_');
           document.location.href = url+"/tours-" + theme +"-"+ category +".html";
        }
        else if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' )
	       && !((destModified == null || destModified == '' || destModified == 'undefined')))
        {
           var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
           var dest = ReplaceAll(destModified.toLowerCase(),' ','_');
           document.location.href = url+"/travel-" + category +"-"+ dest+".html";
        }
        else if(!(document.searchForm.category.value == null || document.searchForm.category.value == '' || document.searchForm.category.value == 'undefined' ))
        {
        	var category = ReplaceAll(document.searchForm.category.value.toLowerCase(),' ','_');
        	var urlToSubmit = url+"/packages-" + category +".html";
            document.location.href = urlToSubmit;
        }
	}

	
function callme(a)
{
	if(a.indexOf("&")==-1)
	{
	var winLocString = window.location+"";
	if(winLocString.indexOf(".html") == -1)
	{
		if(winLocString.lastIndexOf("offset") == -1)
		   document.location.href = winLocString +"&offset="+a; 
		else
		   document.location.href =  winLocString.substring(0,winLocString.lastIndexOf("&offset"))+"&offset="+a;
	}
	else
		submitSearchListPagination((parseInt(a)/20)+1);	
		}
	else
	{
		document.getElementById('packageListing').innerHTML="populating...";
		getpackagelisting(rootpath+'/india/includes/searchajax?'+a,'packageListing');
	}
}

function submitSearchListPagination(a)
{
	var winLocString = window.location+"";
	var splitLoc = winLocString.split('.html');
	var indexHyphen = winLocString.lastIndexOf("html");
	var lastElementString = splitLoc[0].substring(((splitLoc[0].length)-1),(splitLoc[0].length));
	var lastElement = parseInt(lastElementString);
	if(isNaN(lastElement))
	{
		document.location.href = splitLoc[0] + "-" + a + ".html";
	}
	else
	{
		if(a==1)
		  document.location.href = splitLoc[0].substring(0,splitLoc[0].lastIndexOf("-")) + ".html";
		else
	      document.location.href =  splitLoc[0].substring(0,splitLoc[0].lastIndexOf("-")) + "-" + a + ".html";
	} 
}
	
function ReplaceAll(Source,stringToFind,stringToReplace){
  var temp = Source;
  var index = temp.indexOf(stringToFind);
  while(index != -1)
  	{
       temp = temp.replace(stringToFind,stringToReplace);
       index = temp.indexOf(stringToFind);
    }
  return temp;

}
	
function ExpandCollapse(getID)	
{
	var obj = document.getElementById(getID);
	var status = document.getElementById(getID).style.display;
	
	/*var cookieVal = readCookie('collapse');
	if(cookieVal==null)
	{
		createCookie('collapse','coll',7); 
		obj.style.display='none';
	}	
	else
	{*/
		if(status==''||status=='none')
			obj.style.display='block';
		else
		  obj.style.display='none';
	//}		
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


