﻿

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function redirect(url)
{

	eval("window.location='" + url + "'");
}
/*
function redirect_http()
{
	var location_string = window.location.toString();
	var https_index = location_string.indexOf('https');
	if(https_index >= 0)
	{
		var new_loc = location_string.replace('https','http') ;
		eval("window.location='" + new_loc+ "'" );
	}
	
}
*/




function HighlightArea(infoDivId,left_x, left_y, right_x, right_y)
{
	
	var width = right_x - left_x;
	var height = right_y - left_y;
	
	br=navigator.appName;
	brversion=parseInt(navigator.appVersion);	
	var infoDiv = document.getElementById(infoDivId);	
	infoDiv.style.width = width + 'px';
	infoDiv.style.height = height + 'px';
	infoDiv.style.borderColor = '#Ffc507';	
	
	var us_img = document.getElementById("us_map_image");
	
	var offset_x_y = findPos(us_img);
	
	if (br=='Microsoft Internet Explorer')
	{	
			
		var srcEvent = window.event;
		var theLeft = 0;
		var theTop = 0;
		if (document.documentElement && document.documentElement.scrollTop)
		{
			theTop = document.documentElement.scrollTop;
			theLeft = document.documentElement.scrollLeft;	
		}
		else if (document.body){
			theTop = document.body.scrollTop;
			theLeft = document.body.scrollLeft;
		}

		positionX = left_x + offset_x_y[0] ;// 217;//offset from left of page
		positionY = left_y + offset_x_y[1] ;// 228;//offset from top of page
		infoDiv.style.visibility = 'visible';		
		infoDiv.style.left = positionX + 'px';
		infoDiv.style.top = positionY + 'px';
	}
	else if(br=='Netscape')
	{
	
		var positionX  = 0;
		var positionY = 0;
		positionX = left_x + offset_x_y[0] - 3;// 217;//offset_x_y[0]; ;
		positionY = left_y + offset_x_y[1] - 1;// 228;//offset_x_y[0];
		infoDiv.style.visibility = 'visible';
		infoDiv.style.left = positionX + 'px';
		infoDiv.style.top = positionY + 'px';
		
	}
	else
	{
		alert('Browser Not Defined');
	}
	

}

function UnHighlightArea(infoDivId)
{			
	var infoDiv = document.getElementById(infoDivId);
	window.status = '';	
	infoDiv.style.visibility = 'hidden';
	
}
