var h_help = null

function runFlashContent(movieSRC,movieWidth,movieHeight) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+movieWidth+'" height="'+movieHeight+'" align="middle">\n');
	document.write('<param name="movie" value="../'+movieSRC+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="../'+movieSRC+'" quality="high" bgcolor="#ffffff" width="'+movieWidth+'" height="'+movieHeight+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />\n');
	document.write('</object>\n');
}

function openPresentation() {
	var left=250
	var top=250
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-640)/2);
	    top = Math.floor((screen.availHeight-480)/2);
	}
	h_help = window.open('/presentation.asp','winPresentation','height=480,width=640,menubar=no,titlebar=yes,status=no,scrollbars=no,resizable=yes,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showContent(elementID,minimizeID,maximizeID) {
	if (element(elementID).style.display == 'none') {
		element(elementID).style.display = '';
		element(minimizeID).style.display = '';
		element(maximizeID).style.display = 'none';
	}
	else {
		element(elementID).style.display = 'none';
		element(minimizeID).style.display = 'none';
		element(maximizeID).style.display = '';
	}
}

function showAllContent(elementTag,minimizeTag,maximizeTag,listArray) {
	listArray = listArray.split(",");
	for(i=0;i<listArray.length;i++) {
		showContent(elementTag+listArray[i],minimizeTag+listArray[i],maximizeTag+listArray[i]);
	}
}

function element(id) {
	if (document.getElementById != null){			// 1st Choice
		return document.getElementById(id)			// No N4, IE4
	}
	if (document.all != null){						// 2nd Choice
		return document.all[id]						// IE Only
	}
	if (document.layers != null){					// 3rd Choice
		return document.layers[id]					// N4 Only
	}
	return null;									// Give Up
}


//-------------------------------------------------------------------------
//
// Help popup windows
//
// TCD Technologies, LLC
//-------------------------------------------------------------------------

function showhelp(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-518)/2);
	    top = Math.floor((screen.availHeight-200)/2);
	}
	h_help = window.open('help.asp?id=' + id,'SMARTSWITCH','height=200,width=518,menubar=no,titlebar=yes,status=no,scrollbars=yes,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showpicture(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-518)/2);
	    top = Math.floor((screen.availHeight-400)/2);
	}
	h_help = window.open('picture.asp?pid=' + id,'SMARTSWITCH','height=400,width=518,menubar=no,titlebar=yes,status=no,scrollbars=yes,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showswitch(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-568)/2);
	    top = Math.floor((screen.availHeight-380)/2);
	}
	h_help = window.open('showswitch.asp?id=' + id,'SMARTSWITCH','height=380,width=568,menubar=no,titlebar=yes,status=no,scrollbars=yes,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showpage(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-600)/2);
	    top = Math.floor((screen.availHeight-400)/2);
	}
	h_help = window.open('showpage.asp#' + id,'SMARTSWITCH','height=400,width=600,menubar=no,titlebar=yes,status=no,scrollbars=yes,resize=yes,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showdetails(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-620)/2);
	    top = Math.floor((screen.availHeight-420)/2);
	}
	h_help = window.open('showdetails.asp?ID=' + id,'SMARTSWITCH','height=420,width=620,menubar=no,titlebar=yes,status=no,scrollbars=yes,resizable=no,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showpdf(pdffile)
{
	var left=20,top=20

	h_help = window.open(pdffile,'SMARTSWITCH','height=450,width=600,menubar=no,titlebar=no,status=no,scrollbars=yes,resizable=yes,left=20,top=20')
	h_help.focus()
	window.onunload = close_help
}

function printpreview(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-630)/2);
	    top = Math.floor((screen.availHeight-400)/2);
	}
	h_help = window.open('printpreview.asp?orderid=' + id,'SMARTSWITCH','height=400,width=630,menubar=yes,titlebar=yes,status=no,scrollbars=yes,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function download(url)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-600)/2);
	    top = Math.floor((screen.availHeight-400)/2);
	}
	h_help = window.open('agree.asp?url=' + url,'SMARTSWITCH','height=400,width=600,menubar=no,titlebar=yes,status=no,scrollbars=1,resizable=1,left=' + left + ',top=' + top)
	h_help.focus()
	window.onunload = close_help
}

function showRGB(id)
{
	var left=250,top=250

	// Center Window
	if (window.screen) 
	{
	    left = Math.floor((screen.availWidth-568)/2);
	    top = Math.floor((screen.availHeight-380)/2);
	}
	if (id==1)
		h_help = window.open('RGB_switch.htm','SMARTSWITCH','height=380,width=600,menubar=no,titlebar=yes,status=no,scrollbars=yes,left=' + left + ',top=' + top)
	else
		h_help = window.open('RGB_display.htm','SMARTSWITCH','height=380,width=600,menubar=no,titlebar=yes,status=no,scrollbars=yes,left=' + left + ',top=' + top)
	
	
	h_help.focus()
	window.onunload = close_help
}

function close_help()
{
	if (h_help.closed == false)
		h_help.close()
}
