﻿function makeWin(tUrl, strheight, strwidth) {
	agent = navigator.userAgent;
	windowName = "DefinitionWindow";
	
	var vwidth = strwidth;
	var vheight = strheight;
	var vtop = ((screen.height - vheight)/2);
	var vleft = ((screen.width - vwidth)/2); 
	params  = "";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=1,";
	params += "resizable=1,";
	params += "width=" + vwidth + ",";
	params += "height=" + vheight + ",";
	params += "top=" + vtop + ",";
	params += "left=" + vleft;
	
	win = window.open(tUrl, windowName, params);
	if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
	    win = window.open(url, windowName , params);
	}
	if (!win.opener) {
	    win.opener = window;
	}
}


function hideItemLayer(Layer) 
{	
	document.getElementById('div' + Layer).style.display = "none";
}

function showItemLayer(Layer)
{	
    //Hide all
    for (i = 1; i < 21; i++)
    {
        if (document.getElementById('divItem' + i) != null)
            hideItemLayer('Item' + i);
        else
            break;
    }

    //Show 1 layer
    document.getElementById('div' + Layer).style.display = "block";	
}

var mapCounter = 0;

function showLocation(latitude, longitude, description)
{
    var icon = new GIcon();
    icon.image = "/Common/Images/custom/pushpin.gif";
    icon.iconSize = new GSize(47, 24);
    icon.iconAnchor = new GPoint(6, 20);
    icon.infoWindowAnchor = new GPoint(5, 1);

    var point = new GLatLng(latitude, longitude);
    var marker = new GMarker(point, icon);
    GEvent.addListener(marker, "click", 
        function() 
        {
            marker.openInfoWindowHtml(description);
        }
    );
    map.addOverlay(marker);
    if (mapCounter == 0)
        marker.openInfoWindowHtml(description);
    mapCounter++;
}

function centerAndDisplayLocation(latitude, longitude, description)
{
    var icon = new GIcon();
    icon.image = "/Common/Images/custom/pushpin.gif";
    icon.iconSize = new GSize(47, 24);
    icon.iconAnchor = new GPoint(6, 20);
    icon.infoWindowAnchor = new GPoint(5, 1);

    var point = new GLatLng(latitude, longitude);
    var marker = new GMarker(point, icon);
    GEvent.addListener(marker, "click", 
        function() 
        {
            marker.openInfoWindowHtml(description);
        }
    );
    map.addOverlay(marker);
    marker.openInfoWindowHtml(description);
    map.setCenter(new GLatLng(latitude, longitude), 13);
}

function disableButtons(f)
{
    for (i=1; i<f.elements.length; i++)
    {
        if (f.elements[i].type == 'submit')
            f.elements[i].disabled = true;
    }
}


function makeWin(tUrl, strheight, strwidth) {
	agent = navigator.userAgent;
	windowName = "DefinitionWindow";
	
	var vwidth = strwidth;
	var vheight = strheight;
	var vtop = ((screen.height - vheight)/2);
	var vleft = ((screen.width - vwidth)/2); 
	params  = "";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=1,";
	params += "resizable=1,";
	params += "width=" + vwidth + ",";
	params += "height=" + vheight + ",";
	params += "top=" + vtop + ",";
	params += "left=" + vleft;
	
	win = window.open(tUrl, windowName, params);
	if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
	    win = window.open(url, windowName , params);
	}
	if (!win.opener) {
	    win.opener = window;
	}
}


	function showDiv(e)
		{		
		    document.getElementById(e).style.display = 'block';   
		}
		
	function openCloseDiv(e)
	{		
	    //var control = document.getElementById(e);
	    
	    if (document.getElementById(e).style.display == 'block')
	    {
	        document.getElementById(e).style.display = 'none'; 
	    }
	    else
	    {
	        document.getElementById(e).style.display = 'block';
	    }	    
	}
		
	function checkIfIE()
	    {
	        var browserName=navigator.appName; 

	        if (browserName=="Microsoft Internet Explorer")
                 {
                  document.getElementById('LoginTextboxLiner').style.backgroundPosition="left 1px";
                  document.getElementById('PasswordTextboxLiner').style.backgroundPosition="left 1px";
                 }
	    }
		
	function toogleLogInOption(e)
	    {
	        if (e == 'switchToPersonal')
	        {
	            document.getElementById('logIntoPersonal').style.display = 'block';
	            document.getElementById('logIntoBusiness').style.display = 'none';
	        }
	        
	        if (e == 'switchToBusiness')
	        {
	            document.getElementById('logIntoPersonal').style.display = 'none';
	            document.getElementById('logIntoBusiness').style.display = 'block';
	        }
	    }
		
	function collapseTierThreeMenu()
	    {
	        document.getElementById('tier3Subs').style.overflow = 'hidden';	  
	        document.getElementById('tier3Subs').style.height = '30px'; 
	        document.getElementById('OpenButtonTD').style.display = 'block';   
	         
	        
	        var allHTMLTags=document.getElementsByTagName('*');
	        
                 for (i=0; i<allHTMLTags.length; i++) 
                 {
                     if (allHTMLTags[i].className == 'subListHeader') 
                     {
                        allHTMLTags[i].style.border = 'none';
                     }
                 }	        
	    }
	    
	 function openTierThreeMenu()
	    {
	        document.getElementById('tier3Subs').style.overflow = 'auto';	  
	        document.getElementById('tier3Subs').style.height = 'auto';  
	        
	        var allHTMLTags=document.getElementsByTagName('*');
	        
                 for (i=0; i<allHTMLTags.length; i++) 
                 {
                     if (allHTMLTags[i].className == 'subListHeader') 
                     {
                        allHTMLTags[i].style.borderBottom = 'solid 1px #000';
                     }
                 }	        
	    }
	    
	 
	 function imageOver(id, filepath)
	 {
	    document.getElementById(id).src=filepath;	 
	 }
	 
	 function imageOut(id, filepath)
	 {
	    document.getElementById(id).src=filepath;	 
	 }
	    
