// JavaScript Document
  function overlayopen(divid,blackoverlayid)
  {
   var browserName = whichBrs();
   var leftPos = (screen.width / 2) - 390;
   var topPos = (screen.height / 2) - 320;
   
   if(divid=="widgetonLoad")
   {
     leftPos = (screen.width / 2) - 250;
     topPos = (screen.height / 2) - 190;
   }
   
   var bodywidth;
   var bodyheight;
   
   document.getElementById(divid).style.left=leftPos+"px";
   document.getElementById(divid).style.top=topPos+"px";
      
   bodywidth = document.body.scrollWidth;
   bodyheight = document.body.scrollHeight;

   document.getElementById(blackoverlayid).style.height=bodyheight+"px";	

   if(browserName=="IE")
  	{
  	 	document.getElementById(blackoverlayid).style.width=bodywidth+"px";
  	 	document.getElementById(blackoverlayid).style.height=bodyheight+"px";	
  	}

   if(browserName=="Firefox")
  	{
  		document.getElementById(blackoverlayid).style.height=bodyheight+"px";	
 			document.getElementById(divid).style.top=topPos-30+"px";	  		
  	}

  	document.getElementById(divid).style.display="block";
  	document.getElementById(blackoverlayid).style.display="block";
  }	
  
  
  function overlayclose(divid,blackoverlayid)
  {
  	document.getElementById(divid).style.display="none";
  	document.getElementById(blackoverlayid).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;
}

var browserName = whichBrs(); 

function setContainerHeight()
{
	var maxheight="";
	var leftpanelheight = document.getElementById("leftpanel").offsetHeight;
	var midpanelheight = document.getElementById("rightpanel").offsetHeight;
	var rightpanelheight = document.getElementById("innerhome-mid-bloc").offsetHeight;
	
	if(leftpanelheight>=midpanelheight && leftpanelheight>=rightpanelheight)
	{
		maxheight = leftpanelheight;
	}
	else if(midpanelheight>=leftpanelheight && midpanelheight>=rightpanelheight)
	{
		maxheight = midpanelheight;
	}
	else
	{
		
      maxheight = rightpanelheight;
	  document.getElementById("leftpanel").style.height = maxheight-77+"px";
	  document.getElementById("rightpanel").style.height =  maxheight-77+"px";
	  document.getElementById("innerhome-mid-bloc").style.height = maxheight+"px";
	}

 if(maxheight!= rightpanelheight)
	{
		document.getElementById("leftpanel").style.height = maxheight+"px";
		document.getElementById("rightpanel").style.height =  maxheight+"px";
	    document.getElementById("innerhome-mid-bloc").style.height = maxheight+77+"px";
    }
 
	/*if(leftpanelheight<=midpanelheight || midpanelheight<=leftpanelheight)
	{
	   if(midpanelheight<=rightpanelheight)
		{
			document.getElementById("rightpanel").style.height=rightpanelheight-77+"px";
			document.getElementById("leftpanel").style.height=rightpanelheight-77+"px";
		}
		else if(rightpanelheight<=midpanelheight)
        {
			document.getElementById("rightpanel").style.height=midpanelheight+"px";
			document.getElementById("rightpanelheight").style.height=midpanelheight+77+"px";
		}
		else if(rightpanelheight<=midpanelheight)
        {
			document.getElementById("rightpanel").style.height=midpanelheight+"px";
			document.getElementById("rightpanelheight").style.height=midpanelheight+77+"px";
		}
		
	}
	else if((rightpanelheight<leftpanelheight) || (rightpanelheight<midpanelheight))
	{	
		if(leftpanelheight<=midpanelheight)
		{
			document.getElementById("leftpanel").style.height=midpanelheight+"px";
			document.getElementById("innerhome-mid-bloc").style.height=midpanelheight+77+"px";
		}
		if(midpanelheight<=leftpanelheight)
		{	
			document.getElementById("rightpanel").style.height=leftpanelheight+"px";
			document.getElementById("innerhome-mid-bloc").style.height=leftpanelheight+77+"px";
		}
	}	*/
}

function goToURL(url){
newWin = window.open(url,'_self');
}

function openViriSignPopup(){
myWindow = window.open('http://www.verisign.com/ssl/index.html?sl=t31290225400000002&gclid=CM7q9J_wrYsCFQmJTAodG1sROg','myWindow','menubar=no,width=800,height=700,toolbar=no,directories=no,resizable=no,scrollbars=no,location=no,status=yes');
}

function redirectURL(){
self.location.href="http://www.makemytrip.com/flights?multicitychecked=true";
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
  	var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
        	curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y){curtop += obj.y;}
    return curtop;
  }
  
function getOffset( el ) {
    var _x = 0;
    var _y = 0;
    while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
        _x += el.offsetLeft - el.scrollLeft;
        _y += el.offsetTop - el.scrollTop;
        el = el.parentNode;
    }
    return { top: _y, left: _x };
}


 
 function setTopPos(obj,setpix)
 {
 	if(obj)
 	   obj.style.marginTop= setpix-271+"px";
  }
 
 function setAbsDivHeightFlex()
 {
 	try{
	document.getElementById("rightpanel").style.height="auto";
	var obj= document.getElementById("blockstars");
    var settopobj =document.getElementById("threefour-container");
    var findTotalHeight=0;
    var findY=parseInt(findPosY(obj),10);
	if(obj.offsetHeight)
		{
			var findDIVHeight =parseInt(obj.offsetHeight,10);
		}
    findTotalHeight=findY+findDIVHeight;
    setTopPos(settopobj,findTotalHeight);
	  }
  catch(error)
  {}
}

 function findHeight(obj)
  {
	var currntheight =0;
  	if(obj.offsetHeight)
  	currntheight+=obj.offsetHeight;
  	return currntheight;  			
  }

function tabChange(tabName,getvideofilename){
	if(tabName=="photos"){
		document.getElementById("videoview").style.display="none";
		document.getElementById("thrsixtydegreeview").style.display="none";
		document.getElementById("photosview").style.display="block";
		document.getElementById("videoloadarea").innerHTML="";
		document.getElementById("threesixtyloadarea").innerHTML="";
		}
	else if(tabName=="video"){
		document.getElementById("photosview").style.display="none";
		document.getElementById("thrsixtydegreeview").style.display="none";
		document.getElementById("videoview").style.display="block";
		document.getElementById("threesixtyloadarea").innerHTML="";
		onclickVideoLoad(getvideofilename);
		}	
	else if(tabName=="threesixty"){
		document.getElementById("photosview").style.display="none";
		document.getElementById("videoview").style.display="none";
		document.getElementById("thrsixtydegreeview").style.display="block";
		document.getElementById("videoloadarea").innerHTML="";
		onclick360Load(getvideofilename);
		}
}


/* videos load area */
function onclickVideoLoad(getvideofilename)
{
	var obj=document.getElementById("videoloadarea");
 	var str='<object width="380" height="380" align="left" id="FLVPlayer" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+getvideofilename+'" name="movie"/><param value="lt" name="salign"/><param value="high" name="quality"/><param value="transparent" name="wmode"/><param value="noscale" name="scale"/><param value="#ffffff" name="bgcolor"/><embed width="380" height="380" type="application/x-shockwave-flash" wmode="transparent" quality="high" bgcolor="#ffffff" wmode="transparent" scale="noscale" src="'+getvideofilename+'" /></object>';
	obj.innerHTML=str;
}

function onclick360Load(getthreesixtyfilename)
{
	var obj=document.getElementById("threesixtyloadarea");
	var str='<object height="300" width="380" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+getthreesixtyfilename+'" name="movie"/><param value="lt" name="salign"/><param value="high" name="quality"/><param value="#ffffff" name="bgcolor"/><embed height="300" width="380" wmode="transparent" src="'+getthreesixtyfilename+'"/></object>';
	obj.innerHTML=str;
}
/* videos load area */


/* photogallery code starts */


function setTitlePos()
{
	var titleObj=document.getElementById("headingBox");
	var titlecurrentTop = findPosY(titleObj);
	if(titleObj.offsetHeight)
	{
	var titlecurrentHeight= titleObj.offsetHeight;
	}
	var exactPos=titlecurrentTop+titlecurrentHeight+"px";

	if(document.getElementById("blockstars"))
	document.getElementById("blockstars").style.top=exactPos;
}
 

 function LoadGallery(pictureName,headingId,imageFile,imageTitle,imageHeading) {
	var picture = document.getElementById(pictureName);  
	picture.src =imageFile;   
	picture.alt =imageTitle;  
	picture.title =imageTitle;   
    document.getElementById(headingId).innerHTML=imageHeading;
 }/* photogallery code ends */

	

