/**********************************************************************************
** DATE:		06.04.04
** TEMPLATE:	main_scripts
** DESCRIPTION:	Any JavaScript Actions
** METHODS: 	
** ATTRIBUTE:	
** NOTES:		
** CALLED BY:	Home/Header
**				QualteMatrix/Header
** INCLUDES:	
***********************************************************************************/

/****************************************************************************
** Confirm before deleting
****************************************************************************/
function CustomDelete(Message,DeletePage) {
	if(confirm(Message)) {
		location.href = DeletePage;
	return true;
	}
}

/****************************************************************************
** Redirect link
****************************************************************************/
function Redirect(intURL){
	location.href = intURL;
}

/************************************************************************************
** For all button function requiring redirect URL
************************************************************************************/
function Button(intURL){
	location.href = intURL;
}

/************************************************************************************
** Onload function to resize window
************************************************************************************/
function SizeWindow(W,H){
	window.resizeTo(W,H)
}

/**********************************************************************************
** Open new window, no options allow because the window will resize itself
***********************************************************************************/
function NewWin(intURL){
	var NWin = window.open(intURL,"NW","scrollbars,top=0,left=0,status")
	NWin.focus();
}


/**********************************************************************************
** Only windows with WxH & resize
***********************************************************************************/
function DimWin(intURL,W,H,Resize){
	var intOptions = "top=0,left=0,status,width="+W+",height="+H+",resizable"+Resize;
	var DWin = window.open(intURL,"DW",intOptions)
	DWin.focus();
}


/**********************************************************************************
** Open new window but allow changing of options
***********************************************************************************/
function OptionWin(intURL,Options){
	var intOptions = "scrollbars,top=0,left=0,status,"+Options;
	var DWin = window.open(intURL,"DW",intOptions)
	DWin.focus();
}


/**********************************************************************************
** Xpress Templates
***********************************************************************************/
function Template(URL,ID){
	var intURL = URL+"/Templates/TemplateBlank.cfm?C="+ID;
	var CSI = window.open(intURL,"XpTmpl","scrollbars,top=0,left=0,status")
	CSI.focus();
}

/**********************************************************************************
** XL Templates
***********************************************************************************/
function XLTemplate(URL,ID){
	var intURL = URL+"/XLTemplates/Interfacecfm?C="+ID;
	var CSI = window.open(intURL,"XLTmpl","scrollbars,top=0,left=0,status")
	CSI.focus();
}

/****************************************************************************
** Change between html and text view in ActivEdit
****************************************************************************/
var ActivEditValue = "Text";
function ActiveText(Num,Val){
	if(Val == "HTML" && ActivEditValue != Val){
		aeObjects[Num].DOM.body.innerText = aeObjects[Num].DOM.body.innerHTML;
		document.tabTEXT.src = NormalTabOff.src;
		document.tabHTML.src = HTMLTabOn.src;
	}
	if(Val == "Text" && ActivEditValue != Val){
		aeObjects[Num].DOM.body.innerHTML = aeObjects[Num].DOM.body.innerText;
		document.tabTEXT.src = NormalTabOn.src;
		document.tabHTML.src = HTMLTabOff.src;
	}
	ActivEditValue = Val;
}

/****************************************************************************
** Check ALL
****************************************************************************/
function CheckALL(Fieldname){
	var theForm = eval("document."+Fieldname);
	for(var i=0; i< theForm.length; i++){
		theForm[i].checked = true;
	}
}

/****************************************************************************
** Uncheck ALL
****************************************************************************/
function UncheckALL(Fieldname){
	var theForm = eval("document."+Fieldname);
	for(var i=0; i< theForm.length; i++){
		theForm[i].checked = false;
	}
}