// JavaScript Document for pulling the customer data
// show the services
var xmlHttp
var strDashMatrix
var workElement;
var currentNum;
var leftNum;
var thisChecked
var varGrandTotal
var timer
var playpausestate
playpausestate = 1
var incYN = "Y";
var masterIndex

function swapBox(theUID,jDiv) {
	
	var DashMatrix = document.getElementById("Dasher").innerHTML;
	var tinydiv = jDiv;
	var showDiv = jDiv + "_holder";
	var hideDiv = document.getElementById("simpleid").innerHTML;
	var hideDiv2 = hideDiv + "_holder";
	
	if(showDiv != hideDiv2) {
		document.getElementById(showDiv).className = 'title_on';
		document.getElementById(tinydiv).className = 'insidetitleOver';
		document.getElementById(hideDiv).className = 'insidetitle';
		document.getElementById(hideDiv2).className = 'title_off';
		document.getElementById("simpleid").innerHTML = tinydiv;
	}
	
	workElement = "theSelProdDetails";
	
	var url = DashMatrix + "includes/functions/AJAX_HE.asp?UID=" + theUID + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)

}

function microOn(theID) {
	var workID = theID;
	document.getElementById(workID).className = 'microOn';
}
function microOff(theID) {
	var workID = theID;
	document.getElementById(workID).className = 'microOff';
}


function swapOp(theID) {
	var workID = theID;
	var selDiv = document.getElementById("simpleid").innerHTML;
	if(workID != selDiv) {
		document.getElementById(workID).className = 'insidetitleOver';
	}
}

function resetOp(theID) {
	var workID = theID;
	var selDiv = document.getElementById("simpleid").innerHTML;
	if(workID != selDiv) {
		document.getElementById(workID).className = 'insidetitle';
	}
}

function launchVideo(theVideo, theTitle) {

//	var divx = document.getElementById('HoverMenuHolder');
	//document.getElementById("HoverShadow").style.bottom = 0 - document.documentElement.scrollTop + 'px';
	//alert(document.documentElement.scrollTop);
//	divx.style.top = 50 + document.documentElement.scrollTop + 'px';

	document.getElementById("HoverShadow").style.display = "block";
	document.getElementById("HoverMenuHolder").style.display = "block";
	document.getElementById("TheTitle").innerHTML = theTitle;

//	document.getElementById("ShareForm").innerHTML=xmlHttp.responseText 
	
	var DashMatrix = document.getElementById("Dasher").innerHTML;
	workElement = "TheVideo";
	
	var url = DashMatrix + "includes/functions/viewTrailer.asp?TPath=" + theVideo + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function closeHoverForm() {
	document.getElementById("HoverShadow").style.display = "none";
	document.getElementById("HoverMenuHolder").style.display = "none";	
	var DashMatrix = document.getElementById("Dasher").innerHTML;
	workElement = "TheVideo";
	
	var url = DashMatrix + "includes/functions/viewTrailer.asp?TPath=&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
}

function searchEval(curVal) {
	if (curVal == "enter search terms") {
		document.SearchForm.Search.value = "";
		document.getElementById("Search").style.color = "#6f6f6f";
	} else if (curVal == "") {
		document.SearchForm.Search.value = "enter search terms";
		document.getElementById("Search").style.color = "#CCCCCC";
	}
}

function viewTrailer(trailerURL) {
	strDashMatrix = document.getElementById("Dasher").innerHTML;
	
	var url = strDashMatrix + "includes/functions/ViewTrailer.asp?TPath=" + trailerURL + "&DashMatrix=" + strDashMatrix + "&sid=" + Math.random();
	workElement = "MP_VidHolder";
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function killcode() {
	playpausestate = 0;
	clearTimeout(timer);
}

function displayNewProd(jProdID, ProdInt) {
	if(jProdID == "undefined" || jProdID == "") {
		alert(jProdID + " = invalid ID.");
	} else {
		strDashMatrix = document.getElementById("Dasher").innerHTML;
	
		var url = strDashMatrix + "includes/ajax/functions/getTopContent.asp?ProdID=" + jProdID + "&DashMatrix=" + strDashMatrix + "&sid=" + Math.random();
		workElement = "theTopContent";
		var jProdInt = "topcontent" + ProdInt;
		
		masterIndex = ProdInt;
		//alert(masterIndex);
		
		document.getElementById("topcontent1").className = "subOff"
		document.getElementById("topcontent2").className = "subOff"
		document.getElementById("topcontent3").className = "subOff"
		document.getElementById("topcontent4").className = "subOff"
		document.getElementById("topcontent5").className = "subOff"

		document.getElementById(jProdInt).className = "subOn"
		xmlHttp=GetXmlHttpObject(postbackDisplay)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
		
		if(playpausestate == 1) {
			timer = setTimeout("flipNext()", 5000);
		}
	}
}

function featureTimer() {
	var currentIndex = masterIndex;
	playpausestate = 1;
	timer = setTimeout("flipNext()", 5000);
}

function flipNext() {
	
	var currentIndex = masterIndex;
	if(currentIndex == "" || currentIndex == "undefined") {
		var currentIndex = "1";
	}

	var feat1 = document.FeatureForm.x1.value;
	var feat2 = document.FeatureForm.x2.value;
	var feat3 = document.FeatureForm.x3.value;
	var feat4 = document.FeatureForm.x4.value;
	var feat5 = document.FeatureForm.x5.value;
		
	if(currentIndex == "1") {
		displayNewProd(feat2, 2);
	} else if (currentIndex == "2") {
		displayNewProd(feat3, 3);
	} else if (currentIndex == "3") {
		displayNewProd(feat4, 4);
	} else if (currentIndex == "4") {
		displayNewProd(feat5, 5);
	} else if (currentIndex == "5") {
		displayNewProd(feat1, 1);
	} else {
		displayNewProd(feat2, 2);
	}
}

function callFeature(DashMatrix, ofeatNum, incYN) {
	var url= DashMatrix + "includes/ajax/Features.asp?valYN=" + incYN + "&FeatureNum=" + ofeatNum + "&oDashMatrix=" + DashMatrix + "&sid=" + Math.random();
	strDashMatrix = DashMatrix
	workElement = "FeatureBox"
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	if (incYN == "Y") {
		playpausestate = 1;
		timer = setTimeout("nextFeature()", 5000);
	//	document.getElementById("playpause").innerHTML = "<a href='Javascript: PlayFeatures();'><img align=absmiddle src=public/images/Pausebutton.gif alt='Click to Pause'></a>";
	} else {
		playpausestate = 0;
		clearTimeout(timer);
	}

}

function PlayFeatures() {
	if (playpausestate == 1) {
		playpausestate = 0;
		clearTimeout(timer);
		document.getElementById("playpause").innerHTML = "<a href='Javascript: PlayFeatures();'><img align=absmiddle src=public/images/Playbutton.gif alt='Click to Play'></a>";
	} else {
		playpausestate = 1;
		timer = setTimeout("nextFeature()", 500);
		document.getElementById("playpause").innerHTML = "<a href='Javascript: PlayFeatures();'><img align=absmiddle src=public/images/Pausebutton.gif alt='Click to Pause'></a>";
	}
}



function nextFeature() {
	curValue = document.getElementById("FeatureIncrement").value;
	maxValue = document.getElementById("FeatureMax").value;
	newValue = Number(curValue) + 1
	var xnuttin = "";
	if (newValue > maxValue) {
		newValue = 1;
	}
	callFeature(xnuttin,newValue,'Y');
}

function UpdateShipCosts(DashMatrix, ordGrandTotal, ShipNumID, ordSubTotal) {
	varGrandTotal = ordGrandTotal;
	var url= DashMatrix + "includes/ajax/functions/EvaluateShipping.asp?SubTotal=" + ordSubTotal + "&ShipID=" + ShipNumID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix
	xmlHttp=GetXmlHttpObject(updateAtAllCosts)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

var responseNumber
function updateAtAllCosts() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			document.getElementById("divxOrderShipCharges").innerHTML = "$" + xmlHttp.responseText;
			responseNumber = Number(xmlHttp.responseText);
			var TotalResponseNum = Number(varGrandTotal) + responseNumber
			TotalResponseNum = TotalResponseNum.toFixed(2)
			document.getElementById("divxOrderGrandTotal").innerHTML = "$" + TotalResponseNum;
		}
}

function showProdTab(TabToShow) {
	document.getElementById("theTab_Overview").style.backgroundColor = "#DDDDDD";
	document.getElementById("theTab_Video").style.backgroundColor = "#DDDDDD";
	document.getElementById("theTab_Photos").style.backgroundColor = "#DDDDDD";
	document.getElementById("theTab_Reviews").style.backgroundColor = "#DDDDDD";
	document.getElementById("prodTab_Overview").style.display = "none";
	document.getElementById("prodTab_Video").style.display = "none";
	document.getElementById("prodTab_Photos").style.display = "none";
	document.getElementById("prodTab_Reviews").style.display = "none";

	if (TabToShow == "prodTab_Overview") {
		document.getElementById("theTab_Overview").style.backgroundColor = "#FFFFFF";		
		document.getElementById("prodTab_Overview").style.display = "block";
	} else if (TabToShow == "prodTab_Video") {
		document.getElementById("theTab_Video").style.backgroundColor = "#FFFFFF";		
		document.getElementById("prodTab_Video").style.display = "block";
	} else if (TabToShow == "prodTab_Photos") {
		document.getElementById("theTab_Photos").style.backgroundColor = "#FFFFFF";		
		document.getElementById("prodTab_Photos").style.display = "block";
	} else if (TabToShow == "prodTab_Reviews") {
		document.getElementById("theTab_Reviews").style.backgroundColor = "#FFFFFF";		
		document.getElementById("prodTab_Reviews").style.display = "block";
	}
}



var cartcheckflag = 0
function openCart() {
	if (cartcheckflag == 0) {
		cartcheckflag = 1; 
		document.getElementById("ShoppingCartBox").style.display = 'block';
	} else { 
		cartcheckflag = 0;
		document.getElementById("ShoppingCartBox").style.display = 'none'; 
	}
}

function showFullSynopsis()
{
	document.getElementById("synopsisShort").style.display = 'none';
	document.getElementById("synopsisFull").style.display = 'block';
}

function showFeature(featureID) {
	var url= "includes/ajax/functions/showFeature.asp?FID=" + featureID + "&sid=" + Math.random();
	workElement = "divfeature";
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}


var searchflag = "false";
function doSearchBox() {
  if (searchflag == "false") {
	document.getElementById("SearchPanel").style.display = 'block';
	searchflag = "true";
  } else {
	document.getElementById("SearchPanel").style.display = 'none';
    searchflag = "false";
  }
}

function confirmOrder()
{
   document.getElementById("SubmitDiv").innerHTML = "Processing your order... please be patient";
}

function sortProduct(theMethod, theValue) {
   window.location="http://67.59.183.226/Store/?Filter=" + theMethod + "&value=" + theValue;
}
function sortProduct2(theMethod, theValue) {
   window.location="http://67.59.183.226/Store/?Filter=" + theMethod + "&value=" + theValue;
}


function editCMSPage(thePageID, DashMatrix, postback) {
	var url= DashMatrix + "includes/ajax/functions/pullCMSPage.asp?PageID=" + thePageID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}



function findX(obj,Element,DashMatrix) { 
var x = 0;
var y = 0;
var workElement;
while (obj) { 
		x += obj.offsetLeft 
		y += obj.offsetTop
		obj = obj.offsetParent; 
		y = y - 1;
		//x = x - 1;
	} 
	workElement = Element;
	document.getElementById(workElement).innerHTML = "<div onClick=this.style.display='none'; style=color:#000000;margin:0px;text-align:center;><img src=" + DashMatrix + "public/images/note_addedToCart.png></div>";
	setTimeout("resetCartElement()", 1000);
//	document.getElementById(workElement).innerHTML = "<img src=" + DashMatrix + "public/images/addedToCart.gif>"
	document.getElementById(workElement).style.display = 'inline';
	document.getElementById(workElement).style.left = x+"px";
	document.getElementById(workElement).style.top = y+"px";
//	document.getElementById("hoverpopup").moveTo(x,y);
} 
function resetCartElement() {
	document.getElementById("hoverpopup").innerHTML = "";
}

function findX2(obj,Element,DashMatrix) { 
var x = 0;
var y = 0;
var workElement;
while (obj) { 
		x += obj.offsetLeft 
		y += obj.offsetTop
		obj = obj.offsetParent; 
		y = y - 1;
		//x = x - 10;
	} 
	workElement = Element;
	document.getElementById(workElement).innerHTML = "<div onClick=this.style.display='none'; style=color:#000000;margin:0px;text-align:center;><img src=" + DashMatrix + "public/images/note_addedToList.png></div>";
	setTimeout("resetCartElement()", 1000);
//	document.getElementById(workElement).innerHTML = "<img src=" + DashMatrix + "public/images/addedToWishlist.gif>"
	document.getElementById(workElement).style.display = 'inline';
	document.getElementById(workElement).style.left = x+"px";
	document.getElementById(workElement).style.top = y+"px";
//	document.getElementById("hoverpopup").moveTo(x,y);
} 




function closeHover(Element) {
	workElement = Element;
	document.getElementById(workElement).style.display = 'none';
} 






/* MESSAGE FUNCTIONS ========================================================== */
function DeletePress(DashMatrix, postback, PressID) {
	var url= DashMatrix + "includes/ajax/functions/deletePress.asp?PressID=" + PressID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function openReplyField() {
	document.getElementById("ReplyField").style.display='block';
}

function RequestMessageAssistance(DashMatrix, Checked, postback) {
	if (Checked == true) { thisChecked = "true"; } else { thisChecked = "false"; }
	var url= DashMatrix + "includes/ajax/functions/reqMsgAssistance.asp?Checked=" + thisChecked + "&sid=" + Math.random();
	strDashMatrix = DashMatrix
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function setReplyMessage(DashMatrix, PresetID) {
	var url= DashMatrix + "includes/ajax/functions/setReplyMessage.asp?DashMatrix=" + DashMatrix + "&PresetID=" + PresetID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = 'ReplyMessage';
	xmlHttp=GetXmlHttpObject(postbackDisplayToValue)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function setEmailValue(DashMatrix, SiteID) {
	var url= DashMatrix + "includes/ajax/functions/setEmailValue.asp?DashMatrix=" + DashMatrix + "&SiteID=" + SiteID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = 'FromEmail';
	xmlHttp=GetXmlHttpObject(postbackDisplayToValue)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function getPublicKey(DashMatrix) {
	document.getElementById("PublicAccessKey").value = '984hGCyTv5SDRasMM563eed5VSDTY5Y';
}
function changeMessageGroup(DashMatrix, postback, msgID, action, groupID) {
	var url= DashMatrix + "includes/ajax/functions/changeMessageGroup.asp?DashMatrix=" + DashMatrix + "&GroupID=" + groupID + "&sid=" + Math.random() + "&MsgID=" + msgID + "&Action=" + action;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function postbackDisplay() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById(workElement).innerHTML=xmlHttp.responseText; 
	}
}
function postbackDisplayToValue() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById(workElement).value=xmlHttp.responseText; 
	}
}
var TheDiv
function revealDiv(divID) {
	TheDiv = divID
	document.getElementById(TheDiv).style.display = 'block';
}
function closeDiv(divID) {
	TheDiv = divID
	document.getElementById(TheDiv).style.display = 'none';
}



function setVideoStill(DashMatrix, FeatureID, StillID, postback) {
	var url= DashMatrix + "includes/ajax/functions/setVidStill.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&FeatureID=" + FeatureID + "&DivID=" + postback + "&StillID=" + StillID;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function setThumbRel(DashMatrix, FeatureID, postback) {
	var url= DashMatrix + "includes/ajax/functions/setVideoThumbnail.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&FeatureID=" + FeatureID + "&DivID=" + postback;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function showhideDivReverse(Checked, postback) {
	workElement = postback;
	if (Checked == true) {
		thisChecked = "true";
		document.getElementById(workElement).style.display="none"; 
	} else { 
		thisChecked = "false";
		document.getElementById(workElement).style.display="block"; 
	}
}

function showhideDiv(Checked, postback) {
	workElement = postback;
	if (Checked == true) {
		thisChecked = "true";
		document.getElementById(workElement).style.display="block"; 
	} else { 
		thisChecked = "false";
		document.getElementById(workElement).style.display="none"; 
	}
}

/* SITE FEATURE FUNCTIONS // ======================================================================================= */
function setSiteFeature(DashMatrix,FeatureID,Thumbnail,URLink,SiteID,SlotNum,postback) {
	var url= DashMatrix + "includes/ajax/functions/setSiteFeatures.asp?URL=" + URLink + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&SiteID=" + SiteID + "&SlotNum=" + SlotNum + "&FeatureID=" + FeatureID + "&DivID=" + postback + "&Thumbnail=" + Thumbnail;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function editSiteFeature(DashMatrix,SiteID,SlotNum,URLink,postback,FeatureID) {
	var url= DashMatrix + "includes/ajax/functions/editSiteFeatures.asp?URL=" + URLink + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&SiteID=" + SiteID + "&SlotNum=" + SlotNum + "&FeatureID=" + FeatureID + "&DivID=" + postback;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function previewFeature(DashMatrix,FeatureID,postback) {
	var url= DashMatrix + "includes/ajax/functions/previewFeature.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&FeatureID=" + FeatureID;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
/* END SITE FEATURE FUNCTIONS // ======================================================================================= */




/* MEMBERS & QUICK LINK  FUNCTIONS // ======================================================================================= */
function removeQuickLink(DashMatrix,ListItemID) {
	var url= DashMatrix + "includes/ajax/functions/removeQuickLink.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&ListItemID=" + ListItemID;
	strDashMatrix = DashMatrix;
	workElement = "ListItem_" + ListItemID;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function addQuickLink(DashMatrix, LinkURL, LinkName, postback) {
	var url= DashMatrix + "includes/ajax/functions/addQuickLink.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&ListItemName=" + LinkName + "&ListURL=" + LinkURL;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
/* END MEMBERS & QUICK LINK  FUNCTIONS // ======================================================================================= */




/* SITE DISPLAY & UPDATE  FUNCTIONS // ======================================================================================= */
function saveSiteSale(DashMatrix, SiteID, ProdID, SalePrice, SaleStart, SaleEnd, postback) {
	var url= DashMatrix + "includes/ajax/functions/saveSiteSalePrice.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&SiteID=" + SiteID + "&ProdID=" + ProdID + "&SalePrice=" + SalePrice + "&SaleStart=" + SaleStart + "&SaleEnd=" + SaleEnd + "&DivID=" + postback;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function lockdownConfirm(theAction)
{
	 var where_to= confirm("Locking down the system will kill all current user sessions and kick everyone out of the system. Are you sure you want to do this?");
	 if (where_to== true)
	 {
	   window.location=theAction;
	 }
}

function deleteConfirm(theAction)
{
	 var where_to= confirm("This action cannot be undone. Are you sure you want to delete?");
	 if (where_to== true)
	 {
	   window.location=theAction;
	 }
}

function confirmBlacklist(theAction)
{
	 var where_to= confirm("Are you sure you want to blacklist this Message / IP Address?");
	 if (where_to== true)
	 {
	   window.location=theAction;
	 }
}

function addMorePress(DashMatrix, TheNumber, postback)
{
	var url= DashMatrix + "includes/ajax/functions/addMorePress.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&PressNum=" + TheNumber;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function ajaxadd(Preset, DashMatrix, postback)  {
		var url= DashMatrix + "includes/ajax/functions/addPresets.asp?DashMatrix=" + DashMatrix + "&Preset=" + Preset + "&sid=" + Math.random();
		strDashMatrix = DashMatrix;
		workElement = postback;
		xmlHttp=GetXmlHttpObject(postbackDisplay)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
}
/* END SITE DISPLAY & UPDATE  FUNCTIONS // ======================================================================================= */



/* SEARCH & RECOMMEND FUNCTIONS // ======================================================================================= */
function TextAreaLimit(current, DivTag, Limit) 
{
	workElement = DivTag;
	currentNum = current.length;
	leftNum = Limit - currentNum;
	document.getElementById(workElement).innerHTML = leftNum + " of " + Limit + " total chars left";
}

function DoLetterForm(TheLetter)
{
	document.LetterForm.LetterValue.value = TheLetter;
	document.LetterForm.submit();
}

function pullProductResults(DashMatrix,SearchOn,postback)  {
	if (SearchOn.length >= 2) {
		document.getElementById("divAutoSuggest").style.display = "block";
		var url= DashMatrix + "includes/functions/search/autoRecProducts.asp?DashMatrix=" + DashMatrix + "&ProdName=" + SearchOn + "&sid=" + Math.random();
		strDashMatrix = DashMatrix;
		workElement = postback;
		xmlHttp=GetXmlHttpObject(postbackDisplay)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
}

function formulateID(DashMatrix,postbackToValue,thisValue,totalChar) {
	var url= DashMatrix + "includes/ajax/functions/formulateID.asp?totalChar=" + totalChar + "&thisValue=" + thisValue + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = postbackToValue;
	xmlHttp=GetXmlHttpObject(postbackDisplayToValue)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function focusIn(TheField) {
	workElement = TheField;
	document.getElementById(workElement).focus();
}
function moreDubbed(DashMatrix, postback, currentCheck) {
	var url= DashMatrix + "includes/functions/admin/DubbedLanguages.asp?currentDubbed=" + currentCheck + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
}


function loadProductPresets(DashMatrix, ProdTypeID, postback) {
	var url= DashMatrix + "includes/functions/admin/Products/LoadProductPresets.asp?ProdTypeID=" + ProdTypeID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
}

function AddProductType(DashMatrix, ProductName, ProductTypeID, Active, postback) {
	var url= DashMatrix + "includes/functions/admin/ProductTypes/AJAXSave.asp?Active=" + Active + "&ProdName=" + ProductName + "&ProdTypeID=" + ProdTypeID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function AddWebsite(DashMatrix, SiteName, SiteURL, Active, DisplayOrder, postback) {
	var url= DashMatrix + "includes/functions/admin/ProductTypes/AJAXSave.asp?Active=" + Active + "&ProdName=" + ProductName + "&ProdTypeID=" + ProdTypeID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}




var SiteDivTag
var checkflagsite = "false";
var thisChecked

function activateSiteContent(DashMatrix, Checked, SiteID, UnitCost) {
	if (Checked == true) { thisChecked = "true"; } else { thisChecked = "false"; }
	var url= DashMatrix + "includes/ajax/functions/activateSiteContent.asp?Checked=" + thisChecked + "&PresetUnitCost=" + UnitCost + "&SiteID=" + SiteID + "&sid=" + Math.random();
	strDashMatrix = DashMatrix
	SiteDivTag = "divSite_" + SiteID;
	xmlHttp=GetXmlHttpObject(SiteContentDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function SiteContentDisplay() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById(SiteDivTag).innerHTML=xmlHttp.responseText; 
	}
}


function updateProdYear(DashMatrix,newYear,currentYear) {
	var url= DashMatrix + "includes/ajax/functions/ProdYear.asp?CurrentYear=" + currentYear + "&NewYear=" + newYear + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix
	xmlHttp=GetXmlHttpObject(ProdYearDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function ProdYearDisplay() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("divProdYear").innerHTML=xmlHttp.responseText; 
	}
}

function showResultsDisplay(showtab) {
	var url= "../../includes/ajax/functions/SetDisplayPrefs.asp?showtab=" + showtab + "&sid=" + Math.random();
	xmlHttp=GetXmlHttpObject(doNothing)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)

	document.getElementById("List").style.display = 'none';
	document.getElementById("Thumbnails").style.display = 'none';
	document.getElementById("tab_List").style.backgroundColor = '#B2CDE1';
	document.getElementById("tab_Thumbnails").style.backgroundColor = '#B2CDE1';
	
	if (showtab == "List") {
		document.getElementById("List").style.display = 'inline';
		document.getElementById("tab_List").style.backgroundColor = '#FFFFFF';
	} else if (showtab == "Thumbnails") {
		document.getElementById("Thumbnails").style.display = 'inline';
		document.getElementById("tab_Thumbnails").style.backgroundColor = '#FFFFFF';
	}
}
function doNothing() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//document.getElementById("writeDisplayPrefs").innerHTML=xmlHttp.responseText; 
	}
}


function showTabEdit(showtab) {
	document.getElementById("Details").style.display = 'none';
	document.getElementById("Sites").style.display = 'none';
	document.getElementById("Assets").style.display = 'none';
	document.getElementById("Notes").style.display = 'none';
	document.getElementById("tab_Details").style.backgroundColor = '#B2CDE1';
	document.getElementById("tab_Sites").style.backgroundColor = '#B2CDE1';
	document.getElementById("tab_Assets").style.backgroundColor = '#B2CDE1';
	document.getElementById("tab_Notes").style.backgroundColor = '#B2CDE1';
	
	if (showtab == "details") {
		document.getElementById("Details").style.display = 'inline';
		document.getElementById("tab_Details").style.backgroundColor = '#FFFFFF';
	} else if (showtab == "sites") {
		document.getElementById("Sites").style.display = 'inline';
		document.getElementById("tab_Sites").style.backgroundColor = '#FFFFFF';
	} else if (showtab == "assets") {
		document.getElementById("Assets").style.display = 'inline';
		document.getElementById("tab_Assets").style.backgroundColor = '#FFFFFF';
	} else if (showtab == "notes") {
		document.getElementById("Notes").style.display = 'inline';
		document.getElementById("tab_Notes").style.backgroundColor = '#FFFFFF';
	}
}

function showTabEdit1(showtab) {
	document.getElementById("Details").style.display = 'none';
	document.getElementById("Sites").style.display = 'none';
	//document.getElementById("Assets").style.display = 'none';
	document.getElementById("Notes").style.display = 'none';
	document.getElementById("tab_Details").style.backgroundColor = '#B2CDE1';
	document.getElementById("tab_Sites").style.backgroundColor = '#B2CDE1';
	//document.getElementById("tab_Assets").style.backgroundColor = '#B2CDE1';
	document.getElementById("tab_Notes").style.backgroundColor = '#B2CDE1';
	
	if (showtab == "details") {
		document.getElementById("Details").style.display = 'inline';
		document.getElementById("tab_Details").style.backgroundColor = '#FFFFFF';
	} else if (showtab == "sites") {
		document.getElementById("Sites").style.display = 'inline';
		document.getElementById("tab_Sites").style.backgroundColor = '#FFFFFF';
	//} else if (showtab == "assets") {
	//	document.getElementById("Assets").style.display = 'inline';
	//	document.getElementById("tab_Assets").style.backgroundColor = '#FFFFFF';
	} else if (showtab == "notes") {
		document.getElementById("Notes").style.display = 'inline';
		document.getElementById("tab_Notes").style.backgroundColor = '#FFFFFF';
	}
}


var checkflag = "false";
function showMemberPanel() {
  if (checkflag == "false") {
	document.getElementById("MemberPanel").style.display = 'block';
	checkflag = "true";
  } else {
	document.getElementById("MemberPanel").style.display = 'none';
    checkflag = "false";
  }
}


var checkflag = "false";
function check(field) {
  if (checkflag == "false") {
    transferBilling()
	checkflag = "true";
    return "Uncheck All";
  } else {
    document.getElementById("ShipToFName").value = '';
	document.getElementById("ShipToLName").value = '';
	document.getElementById("ShipToAddress").value = '';
	document.getElementById("ShipToCity").value = '';
	document.getElementById("ShipToState").value = '';
	document.getElementById("ShipToZip").value = '';
	document.getElementById("ShipToCountry").value = '';
	
    checkflag = "false";
    return "Check All";
  }
}
function transferBilling()
{
	document.getElementById("ShipToFName").value = document.getElementById("BillToFName").value;
	document.getElementById("ShipToLName").value = document.getElementById("BillToLName").value;
	document.getElementById("ShipToAddress").value = document.getElementById("BillToAddress").value;
	document.getElementById("ShipToCity").value = document.getElementById("BillToCity").value;
	document.getElementById("ShipToState").value = document.getElementById("BillToState").value;
	document.getElementById("ShipToZip").value = document.getElementById("BillToZip").value;
	document.getElementById("ShipToCountry").value = document.getElementById("BillToCountry").value;
}
function handleBilling() 
{
	if (TheForm.BillToName.value == "") {
		alert("You must enter a billing name.");
		return false;
	}
	else if(TheForm.BillToAddress.value == "") {
		alert("You must enter a billing address.");
		return false;
	}
	else {
		return true;
	}
}

/* SHOPPING FUNCTIONS ============================================================================== */

function removeCartItem(DashMatrix, ItemID)
{
	var url= DashMatrix + "includes/ajax/RemoveFromCart.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&ItemID=" + ItemID;
	strDashMatrix = DashMatrix
	xmlHttp=GetXmlHttpObject(UpdateCartCount)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

var postbackX
function AddToWishlist(DashMatrix,fItemID,fItemSize,fItemQty)
{
	var url= DashMatrix + "includes/ajax/UpdateWishlist.asp?ItemID=" + fItemID + "&ItemSize=" + fItemSize + "&ItemQty=" + fItemQty + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	//postbackX = divPostback;
	xmlHttp=GetXmlHttpObject(UpdateWishlist)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function UpdateWishlist() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
//			document.getElementById("CartContentNum").innerHTML=xmlHttp.responseText; 
			// Show the shopping cart
	//		document.getElementById(postbackX).innerHTML = "Added to your cart";
			//visShoppingCart(strDashMatrix);
		}
}

function AddToCart(DashMatrix,fItemID,fItemSize,fItemQty)
{
	var url= DashMatrix + "includes/ajax/UpdateCart.asp?ItemID=" + fItemID + "&ItemSize=" + fItemSize + "&ItemQty=" + fItemQty + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	//postbackX = divPostback;
	xmlHttp=GetXmlHttpObject(UpdateCartCount)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function updateProdQty(DashMatrix,fItemID,fItemSize,fItemQty)
{
	if (fItemQty.length < 1 || isNaN(fItemQty) || fItemQty == " " || fItemQty == "  " || fItemQty == "") {	
		fItemQty = 1;
	}
	var url= DashMatrix + "includes/ajax/UpdateCart.asp?UpdateTo=Qty&ItemID=" + fItemID + "&ItemSize=" + fItemSize + "&ItemQty=" + fItemQty + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	//postbackX = divPostback;
	xmlHttp=GetXmlHttpObject(UpdateCartCount)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}


function UpdateCartCount() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			document.getElementById("cartFocus").innerHTML=xmlHttp.responseText; 
			// Show the shopping cart
	//		document.getElementById(postbackX).innerHTML = "Added to your cart";
			updateShoppingCart(strDashMatrix);
			//visShoppingCart(strDashMatrix);
		}
}

function UpdateCartCountShow() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			document.getElementById("CartContentNum").innerHTML=xmlHttp.responseText; 
			// Show the shopping cart
	//		document.getElementById(postbackX).innerHTML = "Added to your cart";
			visShoppingCart(strDashMatrix);
		}
}

function getCalendarMonth(DashMatrix, Month, TripID, PeopleCount)
{
var url= DashMatrix + "includes/ajax/BookingCalendar.asp?PeopleCount=" + PeopleCount + "&Month=" + Month + "&sid=" + Math.random() + "&TripID=" + TripID + "&DashMatrix=" + DashMatrix;
document.getElementById("BookingCalendar").innerHTML="<img src='" + DashMatrix + "images/Loading.jpg' align='absmiddle'>";
xmlHttp=GetXmlHttpObject(PullCalendar)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
				function PullCalendar() 
				{ 
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
					{ 
						document.getElementById("BookingCalendar").innerHTML=xmlHttp.responseText 
					}
				}

function updateShoppingCart(strDashMatrix)
{
var url= strDashMatrix + "includes/ajax/ShoppingCart.asp?DashMatrix=" + strDashMatrix + "&sid=" + Math.random();
xmlHttp=GetXmlHttpObject(CartUpdateAs)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
function CartUpdateAs() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		//document.getElementById("ShoppingCart").style.display = 'inline';
		document.getElementById("CartContent").innerHTML=xmlHttp.responseText 
	}
}


function visShoppingCart(strDashMatrix)
{
var url= strDashMatrix + "includes/ajax/ShoppingCart.asp?DashMatrix=" + strDashMatrix + "&sid=" + Math.random();
xmlHttp=GetXmlHttpObject(CartFunction)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
function CartFunction() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("CartContent").innerHTML=xmlHttp.responseText 
	}
}

function closeCart()
{
	document.getElementById("ShoppingCart").style.display = 'none';
}



function removeService(ModuleID)
{
var url="../includes/ajax/AJAX_Components.asp?action=remove&sid=" + Math.random() + "&ModuleID=" + ModuleID;
xmlHttp=GetXmlHttpObject(removeComponent)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
				function removeComponent() 
				{ 
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
					{ 
						document.getElementById("components").innerHTML=xmlHttp.responseText 
					}
				}
// show the services
function showServices()
{
	document.getElementById("allServices").style.display = 'inline';
}
// hide the services
function hideServices()
{
	document.getElementById("allServices").style.display = 'none';
}

function addService(ModuleID)
{
var url="../includes/ajax/AJAX_Components.asp?action=add&sid=" + Math.random() + "&ModuleID=" + ModuleID;
xmlHttp=GetXmlHttpObject(addComponent)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
				function addComponent() 
				{ 
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
					{ 
						document.getElementById("components").innerHTML=xmlHttp.responseText 
					}
				}


function evalCompanyType(TypeString)
{
var url="../includes/ajax/AJAX_CompType.asp?sid=" + Math.random() + "&CompType=" + TypeString;
xmlHttp=GetXmlHttpObject(writeOther)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)	
}
function writeOther() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("otherctype").innerHTML=xmlHttp.responseText;
		document.getElementById("otherctype").style.display = 'inline';
	}
}



function AJAX_Example(add1,add2)
{ 
var url="../includes/ajax/AJAX_Add_Function.asp?sid=" + Math.random() + "&add1=" + add1 + "&add2=" + add2;
xmlHttp=GetXmlHttpObject(addNums)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function addNums() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("thesum").innerHTML=xmlHttp.responseText 
	}
}

var xmlHttp
function getEmailPage(pageid)
{ 
var url="../includes/ajax/AJAX_EmailPage.asp?sid=" + Math.random() + "&pageid=" + pageid;
xmlHttp=GetXmlHttpObject(formemail)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function formemail() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("pullcontent").innerHTML=xmlHttp.responseText ;
		document.getElementById("pullcontent").style.display='block';
	}
}


function getReqInfo(ModuleID)
{ 
var url="../includes/ajax/AJAX_AddToReqInfo.asp?sid=" + Math.random() + "&moduleid=" + ModuleID;
xmlHttp=GetXmlHttpObject(AddModule)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function AddModule() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("pullcontent").innerHTML=xmlHttp.responseText ;
		document.getElementById("pullcontent").style.display='block';
	}
}


function getExplanation(ABC)
{ 
var url="../includes/ajax/AJAX_DisplayInformation.asp?sid=" + Math.random() + "&infoString=" + ABC;
xmlHttp=GetXmlHttpObject(xrsInfo)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function xrsInfo() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("pullcontent").innerHTML=xmlHttp.responseText ;
		document.getElementById("pullcontent").style.display='block';
	}
}

function MSAJAX_newobject(pageref,strVar,strValue)
{ 
var url=pageref + "?sid=" + Math.random() + "&" + strVar + "=" + strValue;
xmlHttp=GetXmlHttpObject(newobj_stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function newobj_stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("newobject").innerHTML=xmlHttp.responseText 
	}
} 

function MSAJAX_saveinfo(pageref,strDatabase,strVars,strValues)
{ 
var url=pageref + "?sid=" + Math.random() + "&db=" + strDatabase + "&Vars=" + strVars + "&Values=" + strValues;
xmlHttp=GetXmlHttpObject(saveinfo_submit)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function saveinfo_submit() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("saveinfo").innerHTML=xmlHttp.responseText 
	}
} 

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{	alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 	var strName="Msxml2.XMLHTTP"
	if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
		strName="Microsoft.XMLHTTP"
		} 
	try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
} 





function RunLoadMSG()
{
	document.getElementById("pullcontent").innerHTML="Loading...";
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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];}
}