/*
	2008.05.14	gricke
				<javaScriptMethodName> Break function up into 2 so we can detect for a tilde - and determine which big file
	2008.05.07	gricke
				<indexOf('.swf')>
				If image passed is .swf - run as Flash movie
	2006.06.29	gricke
				<checkPromotion> 
				SEE ALSO: Xsl_FSEPG/productPage.xslt
				
	2006.05.10	gricke
				<javaScriptMethodName>: Communication with Flash
				SEE ALSO: 
					JavaScriptFlashGateway.js
					fsepgStyle/productPage.css
					
	2005.12.14	gricke
				Created
				Loads the same files that are used 
				**This file called on every page - ControlPanel 
				
				Xsl_CommonRaw/TemplatesCommon.asp <$JavaScriptAll>
*/
function checkPromotion(AdCode){
	if (document.getElementById('getPath')){
		var dispPath = document.getElementById('getPath');
		var pathIs = window.location;
		var delimiter = 'promo';
		
		pathIs = pathIs.toString();
		
		if(pathIs.indexOf(delimiter) > 0){
			pathIs = pathIs.substring(pathIs.indexOf(delimiter)+delimiter.length,pathIs.length-1);
			//dispPath.innerHTML = pathIs + 'code' + AdCode;
			if(pathIs == AdCode){
				document.getElementById('promoImage').style.display = 'inline';
			}			
		}else{
			//dispPath.innerHTML = '';
		}
	}
}
function javaScriptMethodName(imagePop){	
	if(imagePop.indexOf('~') > 0){
		var newImagePop = imagePop.substring(0,imagePop.indexOf('.')) + "." + imagePop.substring(imagePop.indexOf('~')+1,imagePop.length);
		openImage(newImagePop);
	}else{
		openImage(imagePop);
	}
}
function openImage(imagePop){
	var popImage = document.getElementById('popImage');
	popImage.style.display = 'block';
	var HTMLDisp = '';
	
	if(imagePop.indexOf('.swf') > 0){
		HTMLDisp = HTMLDisp + '<div id=\"imagePop\">';
		HTMLDisp = HTMLDisp + '<a href=\"#\" onclick=\"imagePopClose();return false;\"><img id=\"closeBut\" src=\"images/closeButton.gif\" width=\"21\" height=\"21\" border=\"0\" alt=\"close\" /></a>';
		HTMLDisp = HTMLDisp + '<div id=\"flashcontent2\"></div>';
	
		var flashFile = '/flash/images/' + imagePop;
		var flashWidth = '100%';
		var flashHeight = '100%';
		var flashMin = '6';
		var flashBackground = '#ffffff';
		var so = new SWFObject(flashFile,"flashFileID",flashWidth,flashHeight,flashMin,flashBackground);
		so.addParam("wmode", "transparent");
		so.addParam("base", ".");
						
		HTMLDisp = HTMLDisp + '</div>';
	}else{
		HTMLDisp = HTMLDisp + '<div id=\"imagePop\">';
		HTMLDisp = HTMLDisp + '<a href=\"#\" onclick=\"imagePopClose();return false;\"><img id=\"closeBut\" src=\"images/closeButton.gif\" width=\"21\" height=\"21\" border=\"0\" alt=\"close\" /></a>';
		HTMLDisp = HTMLDisp + '<img src=\"/flash/images/' + imagePop + '\">';
		HTMLDisp = HTMLDisp + '</div>';
	}
	popImage.innerHTML = HTMLDisp;
	if(imagePop.indexOf('.swf') > 0){
		so.write("flashcontent2");
	}
}
function imagePopClose(){
	var popImage = document.getElementById('popImage');
	popImage.style.display = 'none';
}
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="/JavaScriptShell/LiteratureDownload.js">');
document.write('</' + 'script' + '>');

//These overrite what is set in above
xFromRight = 350;
yFromTop = 0;

function HidePdfImage(){
	document['PDFCover'].src = 'images/trans.gif';
	document.getElementById("PDFCoverDiv").style.backgroundColor = 'transparent';
	document.getElementById("PDFCoverDiv").style.padding = '0px';
}
var Features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,' +
   		       'scrollbars=yes,resizable=no,top=100,left=400' 
var NewWinName = 'PopUpWin'

function popwin(NewWinName,Features,winWidth,winHeight){
	Features = Features + ',width=' + winWidth;
	Features = Features + ',height=' + winHeight;
	w = window.open ("",NewWinName,Features)
}
function multiMediaToBigImage(fileDisp){
	if (document.getElementById('multiMedia')){
		var playMultiMedia = document.getElementById('multiMedia');
		var HTMLDisp = '';
		HTMLDisp = HTMLDisp + '<iframe id=\"IframeID\" name=\"Iframe\" src=\"' + fileDisp + '\" width=\"590\" height=\"250\" frameborder=\"0\">s</iframe>';
		HTMLDisp = HTMLDisp + '';
   		playMultiMedia.innerHTML = HTMLDisp;
		document.getElementById('BigImage').style.visibility = 'hidden';
		document.getElementById('multiMedia').style.visibility = 'visible';
	}	
}
function backToGallery(){
	document.getElementById('multiMedia').style.visibility = 'hidden';
	document.getElementById('BigImage').style.visibility = 'visible';
}
function adjustExcelEditor(){
	if (document.getElementById('Edit_ExcelDataEditor')){
		document.getElementById('Edit_ExcelDataEditor').style.top = '-300px';
	}
}
