
var NeedHelp = null;
function PopUpHelp(IsCutomize) 
{ 
	if (NeedHelp != null && !NeedHelp.closed) NeedHelp.close(); 
	
	// alert(location.href);
	var myLocation = document.location.href.toLowerCase();
	var _index1 = myLocation.lastIndexOf("/");
	if (_index1 == -1) _index1 = 0;
	var _index2 = myLocation.lastIndexOf("?");
	if (_index2 == -1) _index2 = myLocation.length;
	var pageName = myLocation.substring(_index1 + 1, _index2);
    if (pageName == "") pageName = "default.aspx";
	strURL = "siteRefer=DaVinciBG.com&pageRefer=" + pageName;
	// alert(myLocation);

    if (IsCutomize == "Customize" && strURL.indexOf('default.aspx') != -1)
		strURL = "Information/customCharts.aspx?" + strURL;
	else if (IsCutomize == "Customize" && strURL.indexOf('default.aspx') == -1)
		strURL = "../Information/customCharts.aspx?" + strURL;
	else
	{
	    if (strURL.indexOf('default.aspx') != -1)
		    strURL = "Information/pophelp.aspx?" + strURL;
	    else if (myLocation.indexOf('secure') != -1)		
		    strURL = "http://www.DaVinciBG.com/Information/pophelp.aspx?" + strURL;
	    else
		    strURL = "../Information/pophelp.aspx?" + strURL;
	}

	var strOptions="left=250,top=30,screenX=250,screenY=30";
 	strOptions += "toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1,height=880,width=770"; 
 	NeedHelp = window.open(strURL, 'NeedHelp', strOptions); 
 	NeedHelp.focus();
// window.open('" + aUrl + "','NeedHelp','left=252,top=170,screenX=252,screenY=170,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1,width=770,height=770'); 
} // PopUpHelp

var MapInfo = null;
function InfoPopUp(strURL) 
{ 
	if (MapInfo != null && !MapInfo.closed) MapInfo.close(); 
	var strOptions = "";
	// alert(document.location.href);
	// var strOptions="left=252,top=25,screenX=252,screenY=25"; 
 	// strOptions += "toolbar=1,location=1,status=1, menubar=1,scrollbars=1,resizable=1,height=700,width=770"; 
 	MapInfo = window.open(strURL, 'MapInfo', strOptions); 
 	MapInfo.focus();
}

function GoHome()
{
	if (_myLocation.indexOf('secure') != -1 || _myLocation.indexOf('Secure') != -1)
		document.location.href = "http://www.DaVinciBG.com/default.aspx";
	else if (_myLocation.indexOf("default") == -1 && _myLocation.indexOf("Default") == -1)
		document.location.href = "../default.aspx";
	else 
		document.location.href = "default.aspx";
}

var FreeShipDetail = null;

function OpenFreeShipDetail()
{
	if (FreeShipDetail != null && !FreeShipDetail.closed) FreeShipDetail.close(); 

	if (_myLocation.indexOf('default.aspx') != -1 || _myLocation.indexOf('Default.aspx') != -1)
		strURL = "Information/freeship-detail.htm";
	else if (_myLocation.indexOf('secure') != -1 || _myLocation.indexOf('Secure') != -1)		
		strURL = "http://www.DaVinciBG.com/Information/freeship-detail.htm";
	else
		strURL = "../Information/freeship-detail.htm";

	var strOptions="left=250,top=100,screenX=250,screenY=100";
 	strOptions += "toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1,height=350,width=400"; 
 	FreeShipDetail = window.open(strURL, 'FreeShipDetail', strOptions); 
 	FreeShipDetail.focus();
}

var win = null;
function NewWindow(mypage, myname, w, h, scroll, pos) {
    if (pos == "random") { LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100; TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100; }
    if (pos == "center") { LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100; TopPosition = (screen.height) ? (screen.height - h) / 2 : 100; }
    else if ((pos != "center" && pos != "random") || pos == null) { LeftPosition = 0; TopPosition = 20 }
    settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
    win = window.open(mypage, myname, settings);
}

function showCarto(id, name, zoom) {
    var cartoviewer = '';
    cartoviewer = window.open('/cartoviewer/cartoviewer.aspx?path=' + id + '&title=' + name + '&zoom=' + zoom, "cartoview", "width=600,height=660,toolbar=0,menubar=0,location=0,scrollbars=0,resizable=0");
    if (window.focus) {
        cartoviewer.focus();
    }
}
