<!--
function change(id, newClass) {
	var identity = document.getElementById(id);
	identity.style.visibility=newClass;
}

function checkSelected(id, newClass, requiredValue){
	count
	var identity = document.getElementById('selectObject')
	currentValue = identity.value;
	
	if(requiredValue==currentValue){
		changeDisplay(id, newClass);
	}
	else
	{
		changeDisplay(id, 'none');
	}
}

function checkSelectedPage(id, newClass){
	
	var identity = document.getElementById('selectObject')
	currentValue = identity.value;
	
	if('4'==currentValue||'3'==currentValue){
		//alert('Item Found');
		changeDisplayStatic(id, newClass);
	}
	else
	{	
		//alert('Item Not Found');
		changeDisplayStatic(id, 'none');
	}
}

function changeDisplayStatic(id, newClass) {
	var identity = document.getElementById(id);

	identity.style.display = newClass;

}


function changeDisplay(id, newClass) {
	$oppositeClass = (newClass=='block') ? 'none':'block';
	var identity = document.getElementById(id);
	if(identity.style.display!=newClass){
	identity.style.display = newClass;
	}
	else
	{
	identity.style.display =$oppositeClass;
	}
}

function wchangeDisplay(id, newClass) {
	$oppositeClass = (newClass=='block') ? 'none':'block';
	var identity = window.opener.document.getElementById(id);
	if(identity.style.display!=newClass){
	identity.style.display = newClass;
	}
	else
	{
	identity.style.display =$oppositeClass;
	}
}

function wchangeDisplay(id, newClass) {
	var identity = window.opener.document.getElementById(id);
	identity.style.display =newClass;
}

function wchange(id, newClass) {
	//alert('id = '+id);
	//alert('newClass = '+newClass);
	//alert(window.opener.document.getElementById(id));
	var identity = window.opener.document.getElementById(id);
	identity.style.visibility=newClass;
	//alert(identity.visibility);
}

function miHoverAction(id, newClass) {
		if (miSelected == id) {
			change(id, newClass);
		} 
}

function miHover(id, newClass) {
	miSelected = id;
	//alert(miSelected);
	setTimeout("miHoverAction('"+id+"', '"+newClass+"');", 500);
}

function miClear(id, newClass) {
	change(id, newClass);
	miSelected = '';
}

function printReport() {
	change('layout', 'disappear');
	change('pReport', 'appear print-report');
	print();
	change('pReport', 'disappear');
	change('layout', 'appear');
}

function checkForQuotesAndLength(what,limit) {
		if (limit != "") {
			if (what.value.length>=limit) {
					return false;
				}
		} 
		// A single quote ' = 34 A double quote " = 39
		if ((event.keyCode == 34) || (event.keyCode == 39)) {
			return false;
		}
		//alert(event.keyCode)
}

function Close_Window() {
	/*alert('Thank you the information has been changed');*/
	window.close();
}

function Close_ImgDelWindow(type) {
	window.opener.document[type].src = "images/blank_img.gif";
	window.opener.document.bwwForm['h'+type].value = '';
	window.close();
}

function imgDel(type, formID) {
	document[type].src = "images/blank_img.gif";
	var theFormObj = eval('document.'+formID);
	theFormObj[type].value = '';	
	change('h'+type+'Add','visible');
	change('h'+type+'Del','hidden');
}
function imgDelProduct(type, formID) {
	theString = new String(type);
	theString = theString.replace("Image","");
	document[type].src = "images/blank_img.gif";
	var theFormObj = eval('document.'+formID);
	theFormObj[theString].value = '';	
	change('t'+type+'Add','visible');
	change('t'+type+'Del','hidden');
}
function flashDel(type, formID) {
	document.getElementById( "dyna_text" ).setVariable( 'myText', 'Movie Deleted');
	var theFormObj = eval('document.'+formID);
	theFormObj[type].value = '';
	change('h'+type+'Add','visible');
	change('h'+type+'Del','hidden');
}


function Close_ImgWindow(type, path, img, formID) {
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[type].value = img;
	//alert(window.opener.document[type].src);
	window.opener.document[type].src = '../images/'+path+'/' + img;
	//alert(window.opener.document[type].src);
	wchange('h'+type+'Add','hidden');
	wchange('h'+type+'Del','visible');
	window.close();
}

function Close_UploadImgWindow(type, path, img, formID) {
	//alert(type);
	//alert(window.opener.document[type].src);
	window.opener.document[type].src = '../images/'+path+'/' + img;
	//alert(window.opener.document[type].src);
	wchange('t'+type+'Add','hidden');
	window.close();
}

function Close_productImgWindow(type, path, img, formID) {
	//alert(type);
	//alert(window.opener.document[type].src);
	window.opener.document[type].src = '../images/'+path+'/' + img;
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[type].value = img;
	//alert(window.opener.document[type].src);
	//alert(theFormObj[type].value);
	wchange('t'+type+'Add','hidden');
	///wchange('t'+type+'Del','visible');
	window.close();
}


function Close_LinkImgWindow(type, path, img, formID, theLink, theLocation) {
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[type].value = theLink+'¬'+img+'¬'+theLocation;
	var theFormObj = eval('window.opener.document.'+formID+'.theLink');
	theFormObj.value = theLink;
	window.opener.document[type].src = '../images/'+path+'/' + img;
	wchange('h'+type+'Add','hidden');
	wchange('h'+type+'Del','visible');
	window.close();
}

function Close_FlashWindow(type, path, img, formID) {
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[type].value = img;
	//alert(theFormObj[type].value);
	window.opener.document.getElementById( "dyna_text" ).setVariable( 'myText', 'Movie Loaded');
	wchange('h'+type+'Add','hidden');
	//wchange('h'+type+'Del','visible');
	window.close();
}
function Close_FileWindow(type, path, img, formID) {
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[type].value = img;	
	theFormObj['h'+type].value = img;
	var theFormObj = eval('window.opener.document.'+formID+'.h'+type);
	theFormObj.value = img;
	wchange('h'+type+'Add','hidden');
	wchange('h'+type+'Del','visible');
	window.close();
}

function Close_NewsWindow(theNews, formID, fieldID) {
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[fieldID].value = theNews;
	var theField = 'h'+fieldID;
	theFormObj[theField].value = theNews;
	wchange('h'+fieldID+'Add','hidden');
	wchange('h'+fieldID+'Del','visible');
	window.close();
}

function Close_NavWindow(theText, theHTML, formID, fieldID) {
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj['pcVisible_Content'].value = theText;
	theFormObj['pcHTML_Code'].value = theHTML;
	//var theField = 'h'+fieldID;
	//theFormObj[theField].value = theNews;
	//wchange('h'+fieldID+'Add','hidden');
	//wchange('h'+fieldID+'Del','visible');
	window.close();
}
/**/
function Close_VarWindow(theVariations, theVarString, formID, fieldID) {
	//alert(theVariations);
	//alert("theVarString "+theVarString);
	//alert("formID "+formID);
	//alert("fieldID "+fieldID);
	var theFormObj = eval('window.opener.document.'+formID);
	//alert("theFormObj "+theFormObj);
	theFormObj[fieldID].value = theVarString;
	//alert(theFormObj[fieldID].value);
	var theField = 'h'+fieldID;
	theFormObj[theField].value = theVariations;
	//alert(theFormObj[theField].value);
	wchangeDisplay('h'+fieldID+'Add','none');
	wchangeDisplay('h'+fieldID+'Del','block');
	window.close();
}

function Close_LinkListWindow(theList, formID, fieldID) {
	alert(theList);
	alert(formID);
	alert(fieldID);
	var theFormObj = eval('window.opener.document.'+formID);
	theFormObj[fieldID].value = theList;
	var theField = 'h'+fieldID;
	theFormObj[theField].value = theList;
	wchangeDisplay('h'+fieldID+'Del','block');
	wchangeDisplay('h'+fieldID+'Add','none');
	window.close();
}

function Close_ProductWindow(product, formID, fieldID, productNum) {

	var theFormObj = eval('window.opener.document.'+formID);
	var visiblefieldID = 'v'+fieldID;
	theFormObj[visiblefieldID].value = product;
	var hiddenfieldID = 'h'+fieldID;
	theFormObj[hiddenfieldID].value = product;
	
	wchangeDisplay(fieldID+'Span','none');
	window.close();
	}

function Close_UploadProductImgWindow(type,iPath,fileName,formID,ID){
	var theFormObj = eval('window.opener.document.'+formID);
	//theGroup0
	//theGroupImage0
	theString = new String(type);
	theString = theString.replace("Image","");
	theFormObj[theString].value = fileName;
	window.opener.document[type].src = '../images/'+iPath+'/' + fileName;
	//alert(theFormObj[theString].value);
	//alert(window.opener.document[type].src);
	wchange('t'+type+'Add','hidden');
	wchange('t'+type+'Del','visible');
	window.close();
}

function PopupImgCenterWH(page, width, height, formID, fieldID, iPath, winName) {
	  ///var thefieldID = eval('document.'+formID+'.'+fieldID);
	  var thefieldID = eval('document.'+formID);

	   var theformID = eval('document.'+formID);
	  if(formID=='addtbpage'){
		 var pName = theformID.pName.value;
		 var pID = theformID.pID.value;
		// alert(pName);
		// alert(pID);
		 theString = new String(pName);
		 theString = theString.replace(/\s/g,"_");
		 var newFileName = pID+'-'+theString;
		//  alert(newFileName);
	  }
	  var idStr = "&newFileName="+newFileName+"&formID="+formID+"&fieldID="+fieldID+"&iPath="+iPath+"&ID="+thefieldID[fieldID].value;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+idStr,winName,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupNavCenterWH(page, width, height, formID, fieldID, iPath, winName) {
	  var thefieldID = eval('document.'+formID);
	  var theformID = eval('document.'+formID);
	  var idStr = "&formID="+formID+"&fieldID="+fieldID+"&iPath="+iPath+"&ID="+thefieldID[fieldID].value;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+idStr,winName,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupImagesCenterWH(page, width, height, formID, fieldID, iPath, winName) {
	  
	  theString = new String(fieldID);
	  spID = theString.replace("Image","");
	   //alert(spID);
	  var theformID = eval('document.'+formID);
	  var newFileName = theformID[spID].value;
	  //alert(newFileName);
	  var idStr = "?newFileName="+newFileName+"&formID="+formID+"&fieldID="+fieldID+"&iPath="+iPath+"&ID="+theformID[spID].value;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+idStr,winName,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}
function PopupProductImages(page, width, height, formID, fieldID, iPath, winName, ssID) {
	 theString = new String(fieldID);
	 imgID = theString.replace("ID","");
	 imgNum = theString.replace("theGroupID","");
	 imgAlt = theString.replace("ID","Alt");
	
	 var theformID = eval('document.'+formID);
	 var idStr = "&formID="+formID+"&fieldID="+fieldID+"&iPath="+iPath+"&ID="+theformID[fieldID].value+"&Image="+theformID[imgID].value+"&imgNum="+imgNum+"&ssID="+theformID[ssID].value;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	 window.open(page+idStr,winName,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupImgLibCenterWH(page, width, height) {
	  var pIDStr = "&pID="+document.bwwForm.pID.value;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+pIDStr,"bwwPWin","top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupVarsCenterWH(page, width, height,  formID, fieldID, winName) {
	//alert(page);
	 var varStr = "?formID="+formID+"&fieldID="+fieldID;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+varStr,winName,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupPageCenterWH(page, width, height) {
	
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page,"bwwPWin","top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupProductSelCenterWH(page, width, height, product,  formID, fieldID) {
	  var idStr = "?product="+product;
	  var varStr = "&formID="+formID+"&fieldID="+fieldID;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+idStr+varStr,"bwwPWin","top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}
/*----------- Mailer Scripts -----------------------------*/

function Close_MailerImgDelWindow(pos) {
	window.opener.document['Img'+pos].src = "../images/mailer/1pxSpacer.gif";
	window.opener.document.bwwForm['miImg'+pos].value = '';
	window.close();
}


function Close_MailerImg(pos, miID, img) {
	//window.opener.document.bwwForm.pID.value = mmID;
	window.opener.document['Img'+pos].src = "../mailer_images/" + img;
	window.opener.document.bwwForm['miImg'+pos].value = miID;
	window.close();
}



function confirm_deleteRVars(id, retID, rVars, tID, pre) {
	if (confirm('Are you sure you want to delete?')) {
		document.location.href = "delete.php?id="+id+"&return="+retID+"&rVars="+rVars+"&tID="+tID+"&pre="+pre;			
	} else {
		return false;
	}
}
/*----------- End Mailer Scripts -------------------------*/

function Close_Refresh()
{
  window.opener.location.reload();
  window.close();
}


function confirm_delete(id, retID, tID, pre) {
	if (confirm('Are you sure you want to delete?')) {
		document.location.href = "delete.php?id="+id+"&return="+retID+"&tID="+tID+"&pre="+pre;			
	} else {
		return false;
	}
}


function make_live(id, qVal, retID, tID, pre) {
	document.location.href = "make_live.php?id="+id+"&qVal="+qVal+"&return="+retID+"&tID="+tID+"&pre="+pre;
}



function IsPopupBlocker() {
	var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");
	if (oWin==null || typeof(oWin)=="undefined") {
		return true;
	} else {
		oWin.close();
		return false;
	}
}


function PopupCenterWH(page, width, height) {
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page,"bwwPWin","top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupCenterWHS(page, width, height) {
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page,"bwwPWin","top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

function PopupImgCenterWHS(page, width, height) {
	  var pIDStr = "&pID="+document.bwwForm.pID.value;
	  var top=(screen.height-height)/2;
	  var left=(screen.width-width)/2;
	  window.open(page+pIDStr,"bwwPWin","top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}
/*----------- Form Scripts -------------------------*/
function fieldUpdate(srcField, desField, formID){
	var theformID = eval('document.'+formID);
	var srcFieldData = theformID[srcField].value;
	//alert(srcFieldData);
	//alert(theformID[desField].value);
	theformID[desField].value = srcFieldData;
	
}

