/* Custom jquery scripts for wedshooter */

function showWsPopup(message,popupId) {


	var popupWidth = 300;
	var popupHeight = 150;
	
	   var intH = 0, intW = 0;

	    if(self.innerHeight) {
	       intH = window.innerHeight;
	       intW = window.innerWidth;
	    } 
	    else {
		if(document.documentElement && document.documentElement.clientHeight) {
		    intH = document.documentElement.clientHeight;
		    intW = document.documentElement.clientWidth;
		}
		else {
		    if(document.body) {
			intH = document.body.clientHeight;
			intW = document.body.clientWidth;
			
		    }
		}
	    }
	      

	var xCenter = (intW/2)-(popupWidth/2);
	xCenter = parseInt(xCenter);
	var yCenter = (intH/2)-(popupHeight/2);
	yCenter = parseInt(yCenter);		
	
	var closeButton = '<div style="text-align:right;"><a id="closeWsPopup">Close</a></div>';
	
	$(""+popupId+"").html(closeButton+"<p>"+message+"</p>");
	$(""+popupId+"").css("top", yCenter+"px");
	$(""+popupId+"").css("left", xCenter+"px");
	
	$(""+popupId+"").fadeIn("fast");
	
	$("#closeWsPopup").click(function () {
		hideWsPopup(popupId);
	});
}

function hideWsPopup(popupId) {
	$(""+popupId+"").fadeOut("fast");
}

function wsShowTooltip(tooltipLink,tooltipContent) {
	var tooltipLinkOffset = $(""+tooltipLink+"").offset();
	var tooltipLinkX = tooltipLinkOffset.left;
	var tooltipLinkY = tooltipLinkOffset.top;
	
	
	$("#tooltipBox").html($(""+tooltipContent+"").html());
	$("#tooltipBox").css("top",tooltipLinkY-75+"px");
	$("#tooltipBox").css("left",tooltipLinkX+100+"px");
	$("#tooltipArrow").css("left",tooltipLinkX+71+"px");
	$("#tooltipArrow").css("top",tooltipLinkY-3+"px");	
	$("#tooltipArrow").fadeIn("fast");
	$("#tooltipBox").fadeIn("fast", function(){
		//applyDropShadow('#tooltipBox');
	});
}

function wsHideTooltip() {
	//wsHideShadow();
	$("#tooltipArrow").fadeOut("fast");
	$("#tooltipBox").fadeOut("fast");
}

function wsHideShadow() {
	$("#tooltipBox").removeShadow();
}

function applyDropShadow(elementSelector) {
	$(""+elementSelector+"").dropShadow({color:"black", opacity:1, blur:2, left:1, top:1});
}

function wsLoadPage(elementSelector, pageURL) {
	$(""+elementSelector+"").load(pageURL);
	return false;
}



