

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goDropDown(strForm,strElement) {
	var objElement = eval('document.' + strForm + '.' + strElement);
	var objElementValue = objElement[objElement.selectedIndex].value;
	if (objElementValue != "") {
		window.location = objElementValue;
	}
}

function returnParent(strURL) {
	if(window.opener) {
		window.opener.location = strURL;
	}
	else if(window.parent) {
		window.parent.location = strURL;
	}
	window.close();
}

//GLOBAL POPUP
var objChildWindow;
function doChildWindow(strURL, objWin, strOptions) {
	//check for open windows and close them
	if (objChildWindow && objChildWindow.closed == false) {
		objChildWindow.close();

		objChildWindow = window.open(strURL, objWin, strOptions);
		objChildWindow.focus();
	}
	else {
		objChildWindow = window.open(strURL, objWin, strOptions);
		objChildWindow.focus();
	}
}

function openPrintPage(strURL) {
	var strOptions;
	strOptions = "toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,left=100,top=100,width=620,height=500";

	doChildWindow(strURL, 'child_window', strOptions);
	objChildWindow.focus();
}

//GLOBAL NEW WINDOW
function openNewWin(strURL, intWidth, intHeight) {
	var strOptions;
	//check for parameters and set defaults
	if ((intWidth == '') || (intHeight == '')) {
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=615,height=345";
	}
	else {
		intWidth += 45;
		intHeight += 45;
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=" + intWidth + ",height=" + intHeight;
	}
	doChildWindow(strURL, 'child_window', strOptions);
	objChildWindow.focus();
}

//VIEW LARGE IMAGE
function openNewImgWin(strImg, strTitle, intWidth, intHeight, strClose) {
	var strOptions;
	var imgObj;
	
	if(strClose == '')
	{
		strClose = "Close window";
	}
	//check for parameters and set defaults
	if ((intWidth == '') || (intHeight == '')) {
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=400,height=400";
	}
	else {
		
		imgObj = new Image();
		imgObj.src = strImg;
		if (imgObj.width != 0) {
			intWidth = imgObj.width;
			intWidth += 45;
		}
		if (imgObj.height != 0) {
			intHeight = imgObj.height;
			intHeight += 45;
		}
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=" + intWidth + ",height=" + intHeight;
	}
	//check for browser and execute
	if (!(objBrowser.bMacNN4)) {
		doChildWindow('', 'child_window' + intWidth, strOptions);
		var strHTML;
		strHTML  = '<html><head><title>' + strTitle + '</title></head><body marginwidth="10" marginheight="10" leftmargin="10" topmargin="10" alink="#999999" vlink="#666666" bgcolor="#ffffff"><font face="verdana" size="1">';
		strHTML += '<div align="center"><img src="../bose_archivos/' + strImg + '" onload="javascript:window.resizeTo(this.width + 50, this.height + 100);"/></div>';
		strHTML += '<div align="right"><a href="javascript:window.close();"><font color="#000000">'+ strClose + '</font></a></div></font> </BODY></html>';
		objChildWindow.document.open();
		objChildWindow.document.write(strHTML);
		objChildWindow.document.close();
	}
	else {
		doChildWindow(strImg, 'child_window', strOptions);
	}
	//focus the new window
	objChildWindow.focus();
}

//EMAIL NEWS LETTER EMAIL VALIDATE
function checkInputEmail(theForm) {
	if ((theForm.enews.value=="") || (theForm.enews.value.indexOf("@") == -1) || (theForm.enews.value.indexOf(".") == -1)) {
		alert("Please enter a valid email address");
		return false;
	}
	return true;
}
