


var DomainPath="http://www.bhartisoftland.com";
//var DomainPath="http://192.168.1.10/wildlifeindia.co.uk";

function displayMap(categoryString,id)
{

	if(document.getElementById(id))
        {

            document.getElementById(id).innerHTML='<iframe src="'+DomainPath+'/map/bslmap.php?catStr='+categoryString+'&mapWidth=672&mapHeight=730" align="center" name="airline" width="690" height="735" scrolling="No" frameborder="0"></iframe>';
        }
}


function makeCategoryString(divId)
{
    var flag=false;
    var categoryString='';
    for(i=0;i<document.forms[0].length;++i)
    {

        if(document.forms[0].elements[i].type=="checkbox")
        {
            flag=true;
            if(document.forms[0].elements[i].checked==true)
                {
                        //alert('j');
                    categoryString+=document.forms[0].elements[i].value+'|';
                }
        }
    }
    displayMap(categoryString,divId);
    
}


function showMap(destinationCovered)
{
    openGoogleMap(0,destinationCovered);
}

function showBslMap(destinationCovered)
{
    openGoogleMap(0,destinationCovered);
}

function replaceMap(tourId,destinationCovered)
{
	if(document.getElementById('outerMapDiv'))
	{
		document.body.removeChild(document.getElementById('outerMapDiv'));
		openGoogleMap(tourId,destinationCovered);
	}
}

function getScrolledHeight()
{
	
	var yScrolltop;
	if (self.pageYOffset) {
		yScrolltop = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
	}
	return yScrolltop;
}

function getInnerHeight()
{
var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
		myHeight = window.innerHeight;
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
		myHeight = document.documentElement.clientHeight;
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
		myHeight = document.body.clientHeight;
	return myHeight;
}

function getInnerWidth()
{
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
		myWidth = window.innerWidth;
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
		myWidth = document.documentElement.clientWidth;
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
		myWidth = document.body.clientWidth;
	return myWidth;
}

function getOuterWidth()
{		
	outerWidth = window.outerWidth;
	return outerWidth;
}

function getOuterHeight()
{
	outerHeight = window.outerHeight;
	return outerHeight;
}

function openGoogleMap(tourId,destinationCovered)
{
	if(document.getElementById('outerMapDiv'))
	{
		document.body.removeChild(document.getElementById('outerMapDiv'));
	}
 		var myHeight=0,myWidth=0,outerHeight=0,outerWidth=0,Height=0;
		myHeight=getScrolledHeight();
		Height=getInnerHeight();
		myWidth=getInnerWidth();
		var opacity='';
		var innerMapDiv = document.createElement("div");
		var outerMapDiv = document.createElement("div");
		var closeButtonDiv = document.createElement("div");
		var loaderDiv= document.createElement("div");
		
		innerMapDiv.setAttribute('id','mapDiv');
		outerMapDiv.setAttribute('id','outerMapDiv');
		if(navigator.appName == "Microsoft Internet Explorer")
		{
			var styleOuter = outerMapDiv.style;
			var styleInner = innerMapDiv.style;
			var styleLoader = loaderDiv.style;
			styleOuter.position='absolute';
			styleOuter.top=(myHeight+(Height-460)/2)+'px';
			styleOuter.left=((myWidth-640)/2)+'px';
			styleOuter.background='#fFF';
			styleOuter.color='#000';
			styleOuter.border='5px #0099FF solid';
			styleOuter.height='460px';
			styleOuter.width='640px';
			outerMapDiv.setAttribute('style',styleOuter);
			//styleInner.position='absolute';
			styleInner.height='440px';
			//styleInner.width='580px';
			//styleInner.top='16px';
			//styleInner.right='5px';
			//styleInner.background='#0099FF';
			//styleInner.color='#0099FF';
			//innerMapDiv.setAttribute('style',styleInner);
			
			
		}
		else
		{
			//body.setAttribute('class','parentDisable');
			outerMapDiv.setAttribute('style','position:absolute; background-color: #fFF;color: #000;  border: 5px #0099FF solid; top: '+(myHeight+(Height-460)/2)+'px; left: '+((myWidth-640)/2)+'px;height: 460px;width: 640px');
			innerMapDiv.setAttribute('style','position: absolute; left:3px;');
		}
		
		innerMapDiv.innerHTML='<iframe src="'+DomainPath+'/map/bslmap.php?id='+tourId+'&destinationcovered='+destinationCovered+'" align="center" name="bslmap" width="640" height="425" scrolling="No" frameborder="0"></iframe>';
		
		
		
		outerMapDiv.innerHTML='<div class="mapheading">&nbsp;&nbsp;Map</div><div class="mapclose"><a href="javascript:closeBslMapDiv(\'outerMapDiv\');">Close Map</a></div>';
		outerMapDiv.appendChild(innerMapDiv);
		outerMapDiv.appendChild(closeButtonDiv);
		document.body.appendChild(outerMapDiv);
		
    
}
function closeBslMapDiv(outerMapDiv)
{
	document.body.removeChild(document.getElementById(outerMapDiv));
}

function closeDiv(myBody,outerMapDiv)
{
	document.body.removeChild(document.getElementById(outerMapDiv));
	//document.getElementById(myBody).setAttribute('style','display: none;');
}


