function CMSBookmarkPage()
{
	var url = window.location.href;
	var title = window.title;
	
	if (window.external) //IE
	{
		window.external.AddFavorite(url, title);
	} else {
		alert("Your browser does not support automatic bookmark creation.\nPlease use your browser menu or keyboard shortcut:\nIn Firefox:  <CTRL> + D\nIn Opera:  <CTRL> + T");
	}
}

function CMSPrintPage()
{
	window.print();
}

function CMSSendToAFriend(subject)
{
	var subjectText = new String(subject);
	if (subjectText.length == 0) {
		subjectText = "I found this and thought you may be interested.";
	}
	
	var bodyText = "I found this and thought you may be interested: " + window.location.href;
	
	var location = "mailto:?subject=" + subjectText + "&body=" + bodyText;
	window.location.href = location;
}

function CMSSdMaMs(uSDMAMS, dSDMAMS)
{
	var m = "mailto:" + uSDMAMS + "@" + dSDMAMS;
	if (arguments.length == 3) {
		m += "?subject=" + arguments[2];
	}
	window.location.href = m;
}

function CMSOpenMap(mapUrl)
{
	var name = "_blank";
	var features = "location=no,menubar=yes,directories=no,toolbar=yes,status=yes,resizable=yes,scrollbars=yes";

	//Set the window size (window automatically centered by this function)
	var height = 370;
	var width = 470;
	
	var screenHeight = window.screen.height;	
	var screenWidth = window.screen.width;
	var top = parseInt((screenHeight - height) / 2);
	var left = parseInt((screenWidth - width) / 2);
	features += ",top=" + top + "px";
	features += ",left=" + left + "px";
	features += ",width=" + width + "px";
	features +=",height=" + height + "px";
	
	window.open(mapUrl, name, features);
}

function displaySideBarSelect(obj){
	alert(obj.name);

}

function displaySideBarUnSelect(obj){
	if(document.all){
		obj.style="list-style:none";

	}

}

function BindEvent(bindingObject, bindingEvent, boundDelegate)
{
	try
	{
		var bindingEventValue = new String(bindingEvent);
		if (bindingObject.attachEvent)
		{
			bindingObject.attachEvent(bindingEvent, boundDelegate);
		} 
		else if (bindingObject.addEventListener) 
		{
			bindingEventValue = bindingEventValue.toLowerCase().replace("on", "");
			bindingObject.addEventListener(bindingEventValue, boundDelegate, false);
		}
	} catch (e) {}
}

function applyOnline(desinationUrl){
	var url = desinationUrl;
	var features = "location=no,menubar=no,directories=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes";
	var height = 500;
	var width = 700;
	
	var screenHeight = window.screen.height;	
	var screenWidth = window.screen.width;
	var top = parseInt((screenHeight - height) / 2);
	var left = parseInt((screenWidth - width) / 2);
	features += ",top=" + top + "px";
	features += ",left=" + left + "px";
	features += ",width=" + width + "px";
	features +=",height=" + height + "px";
	
	window.open(url, "_blank", features);
}

function onFlashOverClose(){
	document.getElementById('flashOver').style.display = 'none';
}

/**************** JQUERY MOD ****************/
function centerToWindow(obj){
	$(obj).css({top: $('html').scrollTop()+50+'px'});
}

jQuery.fn.outerHtml = function() {
	return $('<div>').append(this).html();
};

/************** POPWIN ************************/
function popWin(content,id){
var popWin = $(
	'<div class="popWinContainer">'+
	'<div class="popWin" id="'+id+'Pop">'+
	'<div class="popWinTopRight"><div class="popWinTopLeft">'+
	'<div class="popWinTopCenter"><div class="popWinCtrls"><span class="popWinCtrl">close <img src="/skins/themes/saphire/images/popWin/closeWindow.gif" width="13" height="12" /></span></div></div>'+
	'</div></div>'+
	'<div class="popWinMiddleRight"><div class="popWinMiddleLeft">'+
	'<div class="popWinMiddleContent">'+$(content).outerHtml()+'</div>'+
	'</div></div>'+
	'<div class="popWinBottomRight"><div class="popWinBottomLeft">'+
	'<div class="popWinBottomCenter"></div>'+
	'</div></div>'+
	'</div></div>'
	);
	maskOver();
	centerToWindow(popWin);
	$('body').append(popWin);
	$(popWin).find('.popWinCtrl').click(function(){
		killMaskOver();
		$(popWin).remove();
	});	
}
function maskOver(){
		var mask = $('<div class="maskOver">&nbsp;<div>');
		$(mask).css('height', $(document).height());
		$('body').append(mask);
}
function killMaskOver(){
		$('.maskOver').remove();
}
function killPopWin(){
	$('.popWin').remove();
}
