/*****************************************************

    Description: Misc function common on all pages
    - Open the help page
    - Clears the search box on focus event

******************************************************/

$(document).ready(function(){

    // Description: Open the help page
    $("a.SecondaryWindow").click(function(){
        var url = $(this).attr("href");
                
        window.open(url,'','toolbar=no,menubar=yes,scrollbars=yes, location=yes, directories=no, status=yes, resizable=yes,height=430,width=630px,top=0,left=50%');
                
        return false;
    });
            
    // Description: Clears the search box on focus
    $("div#Search input").focus(function(){
		if ($("div#Search input").val() == "Search")
			$("div#Search input").val("");
    });
    
    $(".Rounded").corner(); // Allow borders but does mess with CSS layouts
    
    $(".ServiceTeamOverlay").css("border", "solid 3px black"); // Doe not allow border but does not mess with CSS layouts
    
});


//-----------------------
// New Window Functions
//-----------------------
function NewWindow(url, windowId, w, h, scroll, pos)
{
	var win = null;
	
	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;
	}
	if (pos == "full")
	{
		LeftPosition = 0;
		TopPosition = 0;
		w = screen.width - 25;
		h = screen.height - 75;
		//'top=0,left=0,width=screen.width,height=screen.height,channelmode=yes,titlebar=yes,menubar=yes,location=yes,toolbar=yes,status=yes,resizable=yes,scrollbars=yes'
	}
	else if (((pos != "center") && 
					  (pos != "random") && 
					  (pos != "relative")) || pos == null)
	{
		LeftPosition = 20;
		TopPosition  = 20;
	}
	
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win = window.open(url, windowId, settings);
}
