// Common Javascript file for SpectrumControl.com

// Set the status of the current site for Javascript
//var TheSite = "http://www.specpower.com/"
//var TheSite = "http://192.168.161.28/"
var TheSite = "/"

// PrintPage:	Print the current page
// args:		none
function PrintPage() {
	window.print();
}

// SavePage:	Open the SaveAs dialog to save the current page
// args:		none
function SavePage(){
	document.execCommand('SaveAs', null, 'rfq.htm');
}

// SendMessage:	Open a window with the Email Contact form
// args:		FAMName - Short Family Name
function SendMessage(MailType, FAMName, PageName) {
	var newlocation = "/specmail.asp?mtype=" + MailType + "&fam=" + FAMName + "&page=" + PageName;
	EmailWindow = window.open(newlocation, "emailwin", "width=550,height=550,top=0,left=0,resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,location=no,directories=no");
	EmailWindow.focus();
}

// SendEmail:	Open a window with the Email Contact form
// args:		pmsid - Unique identifier for the PMS
//				PageName - Name of current page
function SendEmail(pmsid,PageName) {
	var newlocation = "/specmail.asp?cn=" + pmsid + "&pr=" + PageName;
	EmailWindow = window.open(newlocation, "emailwin", "width=550,height=550,top=0,left=0,resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,location=no,directories=no");
	EmailWindow.focus();
}

// popupkey:	Open a window displaying a key to the catalog icons
// args:		none
function popupkey(){
	keywindow = window.open('/catalog/toolbox_key.asp', 'key', 'width=280,height=310,top=20,left=20,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no,directories=no');
	keywindow.focus();
}

// OpenConfigWin : Open the Configurator Window
// args:	ConfigPage - name of Config document
//			fhgt - the height of the new Flash window
//			fwdt - the width of the new Flash window
function OpenConfigWin(ConfigPage,fhgt,fwdt){
	var ConfigLoc = ConfigPage;
	var ConfigAtt = "height=500,width=700,top=0,left=0,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no,directories=no";
	var ConfigWin = window.open (ConfigLoc, "ConfigWindow", ConfigAtt);
	
	if (!ConfigWin.opener) {
		ConfigWin.opener = this.window;
	}

	ConfigWin.focus();
}

// OpenFlashWin : Open the Flash Window
// args:	FlashPage - name of Flash document
//			fhgt - the height of the new Flash window
//			fwdt - the width of the new Flash window
function OpenFlashWin(FlashPage,fhgt,fwdt){
	var FlashLoc = "/flash/dsub_config.asp"
	var FlashAtt = "height=500,width=700,top=0,left=0,resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,location=no,directories=no"
	var FlashWin = window.open (FlashLoc, "FlashWindow", FlashAtt);
	
	if (!FlashWin.opener) {
		FlashWin.opener = this.window;
	}

	FlashWin.focus();
}

// ChangeStyle : toggle the mouseover and mouseout styles
function ChangeStyle(obj, newStyle) { 
	obj.className=newStyle; 
} 

function ProductWindow(pagename){
	productWindow = window.open('/' + pagename + '.asp', 'productwin', 'width=520,height=550,top=10,left=10,resizable=yes,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no,directories=no');
	productWindow.focus();
}