window.onbeforeunload = function () {
   // This fucntion does nothing.  It won't spawn a confirmation dialog
   // But it will ensure that the page is not cached by the browser.
}

function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function getQ(){
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++){
		var pos = pairs[i].indexOf('=');
		if (pos >= 0){
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}
}



getQ();


function reqLaunch(page) {
	
popupWin = window.open("/pages/landingEmail.aspx?itemId="+ QueryString('ItemId') + "#Form");
}

function regLaunch() {
	if(QueryString('ItemId')){
		popupWin = window.open("/pages/formAssembly.aspx?itemId="+ QueryString('ItemId') + "#Form");
	}else{
		popupWin = window.open("/pages/formAssembly.aspx?itemId="+ QueryString('itemId') + "#Form");
	}
}

function formAssembly() {
	if(QueryString('ItemId')){
		popupWin = window.open("/pages/formAssemble.aspx?itemId="+ QueryString('ItemId') + "#Form");
	}else{
		popupWin = window.open("/pages/formAssemble.aspx?itemId="+ QueryString('itemId') + "#Form");
	}
}

function openHtmlPage(page,hWidth,hHeight){
	OpenHWin = this.open(page, "htmlPage", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=" + hWidth + ",height=" + hHeight); 
}

function openNewPage(page){
	OpenHWin = this.open(page, "newPage"); 
}

function Launch(page) { 
	OpenWin = this.open(page, "KirupaStyle", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=700,height=600"); 
}


var curPopSwf = 0;
function popSwf(file,fWidth, fHeight) {
	curPopSwf = curPopSwf + 1; 
	OpenWin = this.open("/pages/swfLoader.aspx?file=" + file + "&fWidth=" + fWidth + "&fHeight=" + fHeight, "SwfLoader" + curPopSwf, "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=" + fWidth + ",height=" + fHeight); 
} 

/*
function openLightBox(img, tbTitle){
	tb_show(tbTitle, img, null);
}
*/

//Lightbox Functions...
function LightBoxYcpFlv(flvUrl, ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/landingPages/lightbox.aspx' + "?iframe&flvSource=" + flvUrl + "&width=" + ifWidth + "&height=" + ifHeight;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	(ifHeight)
	}).trigger('click');
}

function LightBoxFlv(flvUrl, ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/landingPages/lightboxFLP.aspx' + "?iframe&flvSource=" + flvUrl + "&width=" + ifWidth + "&height=" + ifHeight;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	(ifHeight)
	}).trigger('click');
}
function LightBoxHTML(ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/landingPages/lightbox.aspx' + "?iframe&itemId=" + itemId;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	ifHeight
	}).trigger('click');
}
function LightBoxSwf(swfUrl, ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/landingPages/lightbox.aspx' + "?iframe&swfSource=" + swfUrl + "&width=" + ifWidth + "&height=" + ifHeight;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	(ifHeight)
	}).trigger('click');
}



//functions to play external swf files in header...
function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

function playSwf(swf) {
	getFlashMovie("combinedLanding").sendSwfToFlash(swf);
}

function closeSwf(num){
	if(num == "" || num == undefined)
		num = 0;
	getFlashMovie("combinedLanding").removeSwfFromParent(num);
}