var xmlHttp
var tmpTarget
var tmpCanceled
var BookID



//---------------------------------------------------------------------------------------

function Exempel(){

}


function test(){
alert("test")
}

function loadSubcat(CatID){
	tmpTarget = "subcatContainer";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="chooseSubCat.asp?CatID=" + CatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function loadArt(SubCatID){
	tmpTarget = "artContainer";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="chooseArt.asp?SubCatID=" + SubCatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goBannerURL(goURL){
	alert(goURL)

}

function addRecom(connRecomArtID,connSourceArtID,CatID,SubCatID){
	url="addRecomendation.asp?connRecomArtID=" + connRecomArtID + "&connSourceArtID=" + connSourceArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID;
	window.location.href=url;
}

function mailMyList(){
	var strHTML="<table width='300' border='1' cellpadding='5' cellspacing='0' bordercolor='#333' bgcolor='#D6C27D' class='textsmall'>"
  	strHTML = strHTML + "<tr><td align='center' bgcolor='#333333' class='textsmallWhite'><input name='txtEmail' id='txtEmail' type='text' value='Ange e-post' class='text' onClick='javascript:ClearThis(this.id)'> <input type='submit' value='OK' class='text' onClick='javascript:sendMyList()'></td></tr></table>"
	document.getElementById("mailContainer").innerHTML=strHTML;
}



function delItemMyList(ArtID,currArtID,CustomerID,CatID,SubCatID){
	tmpTarget = "myList"
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	}
	var url = "delItemMyList.asp?ArtID=" + ArtID + "&currArtID=" + currArtID +  "&CustomerID=" + CustomerID + "&CatID=" + CatID + "&SubCatID=" + SubCatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function showMyList(ArtID,CustomerID,CatID,SubCatID){
	if (CustomerID=="") {
		alert("Du måste vara inloggad först")
	}
	else
	{
	// Creating gap
	if (navigator.appName != "Microsoft Internet Explorer"){
  	document.getElementById("emptySpace").innerHTML="&nbsp;<br><br><br><br><br>&nbsp;";
	}
	tmpTarget = "myList"
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	}
	var url="myList.asp?ArtID=" + ArtID + "&CustomerID=" + CustomerID + "&CatID=" + CatID + "&SubCatID=" + SubCatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

function addToMyList(ArtID,CustomerID,CatID,SubCatID,tmpPrice,txtArtHeadline,intArtVat,intArtWeight){
	if(CustomerID==""){
		alert("Du måste vara inloggad först")
	}
	else
	{
		// Creating gap
		if (navigator.appName != "Microsoft Internet Explorer"){
		document.getElementById("emptySpace").innerHTML="&nbsp;<br><br><br><br><br>&nbsp;";
		}
		var connArtColorID = document.getElementById("connArtColorID").value;
		var txtArtSize = document.getElementById("txtArtSize").value;
		tmpTarget = "myList"
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		 var url="addToMyList.asp?ArtID=" + ArtID + "&CustomerID=" + CustomerID + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&tmpPrice=" + tmpPrice + "&txtArtHeadline=" + txtArtHeadline + "&intArtVat=" + intArtVat + "&intArtWeight=" + intArtWeight + "&connArtColorID=" + connArtColorID + "&txtArtSize=" + txtArtSize;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
}


function tellafriend(ArtID,SubCatID,CatID){
	tmpTarget = "tellafriend"
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="tellafriend.asp?ArtID=" + ArtID + "&SubCatID=" + SubCatID + "&CatID=" + CatID
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function CopyAddress(){
	document.getElementById("txtCustInvoiceName").value = document.getElementById("txtCustLevName").value;	
	document.getElementById("txtCustInvoiceDepart").value = document.getElementById("txtCustLevDepart").value;	
	document.getElementById("txtCustInvoiceAddress").value = document.getElementById("txtCustLevAddress").value;	
	document.getElementById("txtCustInvoiceZip").value = document.getElementById("txtCustLevZip").value;	
	document.getElementById("txtCustInvoiceCity").value = document.getElementById("txtCustLevCity").value;	
	document.getElementById("txtCustInvoiceCountry").value = document.getElementById("txtCustLevCountry").value;	
}




function collectPriceFrom(cid){
	document.getElementById("tmpFromHere").value=cid

}


function NotConfirm(){
	alert("Du måste kryssa i att du accepterar köpvillkoren")
}

function Confirm(CustomerID){
	if (CustomerID==""){
		document.getElementById("btnAccept").checked=false;
		alert("Du måste logga in först för att göra ett köp")
	}
	else
	{
		if (document.getElementById("btnAccept").checked) {
			document.getElementById("btnBuyContainer").innerHTML="<input name='button' type='button' class='text' id='button' value='BEKR&Auml;FTA ORDER'  onclick='javascript:checkAndSubmit()' />"	
		}
	}
}


function hideSubCat(SubCatID){
	var onOff = document.getElementById("blnSubCatHide" + SubCatID).checked;
	if (onOff==true){
	document.getElementById("hideMess" + SubCatID).style.backgroundColor="#FF9900"
	document.getElementById("hideMess" + SubCatID).innerHTML="<< Artiklar i denna subkategori döljs"
	tmpTarget = "blnSubCatHide" + SubCatID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="hideSubCat.asp?SubCatID=" + SubCatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
	else
	{
	tmpTarget = "blnSubCatHide" + SubCatID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="nohideSubCat.asp?SubCatID=" + SubCatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)	
	}
}

function delSubCatYES(SubCatID){
	url="delSubCat.asp?SubCatID=" + SubCatID;
	window.location.href=url;
}

function delSubCatNO(){
	url="catAdmin.asp";
	window.location.href=url;
}



function moveArticle(ArtID,CatID,SubCatID, newSubCatID){
	url="moveArticle.asp?ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&newSubCatID=" + newSubCatID;
	window.location.href=url;
}


function hideArticle(ArtID,CatID,SubCatID){
	url="hideArticle.asp?ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&f=hidden";
	window.location.href=url;
}

function delArticle(ArtID,CatID,SubCatID){
	url = "delArt.asp?ArtID=" + ArtID + "&pageTarget='delSubCatAdmin.asp'&CatID=" + CatID + "&SubCatID=" + SubCatID + "&f=deleted";
	window.location.href=url;
}

function colorMe(thisColor, target){
	document.getElementById(target).style.backgroundColor=thisColor;	
}

function checkAndSubmit(){
	var noGo=false;
	if (document.getElementById("firstname").value==""){
		MarkRed('firstname');
		noGo=true}
	if (document.getElementById("lastname").value==""){
		MarkRed('lastname');
		noGo=true}
	if (document.getElementById("phone_work").value==""){
		MarkRed('phone_work');
		noGo=true}
	if (document.getElementById("email").value==""){
		MarkRed('email');
		noGo=true}
	if (document.getElementById("txtCustLevAddress").value==""){
		MarkRed('txtCustLevAddress');
		noGo=true}
	if (document.getElementById("txtCustLevZip").value==""){
		MarkRed('txtCustLevZip');
		noGo=true}
	if (document.getElementById("txtCustLevCity").value==""){
		MarkRed('txtCustLevCity');
		noGo=true}
	if (document.getElementById("username").value==""){
		MarkRed('username');
		noGo=true}
	if (document.getElementById("password").value==""){
		MarkRed('password');
		noGo=true}
	
	if (noGo==false) {
		var freeform_TotalArticles = document.getElementById("freeform_TotalArticles").value;
		if (freeform_TotalArticles>0){
			document.MyBasket.submit();
		}
	}
}

function delTv(TvID){
	window.location.href="delTv.asp?TvID=" + TvID;
	
}

function searchCust(){
	var searchCust = document.getElementById("searchCust").value;
	window.location.href="memberAdmin.asp?searchCust=" + searchCust;
}

function searchCustInv(){
	var searchCust = document.getElementById("searchCust").value;
	window.location.href="invoice_customer.asp?searchCust=" + searchCust;
}

function showBuyButton(artStockNumb,arrCC){
	var showFlag=false
	
	if (artStockNumb>0 && arrCC>0){
		var checkSize = document.getElementById("txtArtSize").value;
		var checkColor = document.getElementById("connArtColorID").value;
		if (checkSize!='0' && checkColor>0){
			document.getElementById("btnBuyContainer").innerHTML="<div id='btnBuy' style='width:142px; margin-top:7px;margin-left:30px; cursor:pointer; padding-top:4px; height:23px; background-image:url(images/btnBuy.png); text-align:center' class='textOrange' onclick='javascript:addBasket();'>Lägg i kundvagn</Div>"		
		}
	}
	
	if (artStockNumb>0 && arrCC==0){
		var checkSize = document.getElementById("txtArtSize").value;
		if (checkSize!='0'){
			document.getElementById("btnBuyContainer").innerHTML="<div id='btnBuy' style='width:142px; margin-top:7px;margin-left:30px; cursor:pointer; padding-top:4px; height:23px; background-image:url(images/btnBuy.png); text-align:center' class='textOrange' onclick='javascript:addBasket();'>Lägg i kundvagn</Div>"		
		}
	}
	if (artStockNumb==0 && arrCC>0){
		var checkColor = document.getElementById("connArtColorID").value;
		if (checkColor>0){
			document.getElementById("btnBuyContainer").innerHTML="<div id='btnBuy' style='width:142px; margin-top:7px;margin-left:30px; cursor:pointer; padding-top:4px; height:23px; background-image:url(images/btnBuy.png); text-align:center' class='textOrange' onclick='javascript:addBasket();'>Lägg i kundvagn</Div>"		
		}
	}
}


function copyPrice(pp,ArtID,ArtsiteID){
	var tmpPP = document.getElementById("tmpFromHere").value;
	var intArtprice = document.getElementById("intArtPrice" + ArtID + "_" + tmpPP).value;
	document.getElementById("intArtPrice" + ArtID + "_" + pp).value= intArtprice;
	tmpTarget = "intArtPrice" + ArtID + "_" + pp;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="addSitePrice.asp?connArtsiteID=" + ArtsiteID + "&intArtprice=" + intArtprice;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function SetAllSitePrice(ArtID,NumbSites){
	var intArtprice = document.getElementById("intArtPrice" + ArtID + "_1").value;
	var stopNumbSites = parseInt(NumbSites) + 1;
	for(var i=2; i<stopNumbSites;i++){
		var target = "intArtPrice" + ArtID + "_" + i;
		document.getElementById(target).value = intArtprice;
		document.getElementById(target).style.border = "2px solid #00cc00";
	}
	tmpTarget = "intArtPrice" + ArtID + "_1";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="addAllSitePrice.asp?connArtID=" + ArtID + "&intArtprice=" + intArtprice + "&NumbSites=" + NumbSites;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=noConfirmation;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function addConnartvip(ArtID,CustomerID,intArtPrice){
	var url="addviplist.asp?ArtID=" + ArtID + "&CustomerID=" + CustomerID + "&intArtPrice=" + intArtPrice;
	window.parent.location.href=url;
}

function ShowBasketDeliveryMethod(txtdeliverMethod,tmpID){
	var url="StoreUpdateDeliveryMethod.asp?txtdeliverMethod=" + txtdeliverMethod + "&tmpID=" + tmpID;
	window.parent.location.href=url;
}

function showVIPlist(CustomerID){
	tmpTarget = "vipArea" + CustomerID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="showVIPlist.asp?CustomerID=" + CustomerID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}



function StoreUpdateBasket(tmpID,rowID,connArtID,CatID,SubCatID,dir,connArtColorID,txtArtSize){
	intArtQuantity = document.getElementById("intArtQuantity" + rowID).value;
	var url = "StoreUpdateBasket.asp?tmpID=" + tmpID + "&connArtID=" + connArtID + "&intArtQuantity=" + intArtQuantity + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&dir=" + dir + "&connArtColorID=" +  connArtColorID + "&txtArtSize=" +  txtArtSize;
	window.location.href=url;

}


																					 
function updateBaketQuantity(tmpID,connArtID,intArtQuantity,CatID,SubCatID,dir,connArtColorID,txtArtSize){
	var url = "StoreUpdateBasket.asp?tmpID=" + tmpID + "&connArtID=" + connArtID + "&intArtQuantity=" + intArtQuantity + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&dir=" + dir + "&connArtColorID=" +  connArtColorID + "&txtArtSize=" +  txtArtSize;
	window.location.href=url;
}


function orderInColor(ArtColorID,txtColorValue,arrCC,cc){
	//---------------------------------------------------
	// Settting default colorbackground
	//---------------------------------------------------
	var endLoop = parseFloat(arrCC)+1
	for (var i=1;i<endLoop; i++){
		document.getElementById("color_" + i).style.backgroundColor="#cccccc";
	}
	//---------------------------------------------------
	// Mark choosen color
	//---------------------------------------------------
	document.getElementById("color_" + cc).style.backgroundColor="#ff9900";	
	document.getElementById("connArtColorID").value = ArtColorID;
}

// Nya UpdateSuperField för ver 2

function updateSuper(fieldID,fieldIDName,PaintTarget,FieldName,ChangeToValue,tblName){ 
	var flagChecked = null;
	flagChecked = document.getElementById(PaintTarget).checked;
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var url="http://www.protectiongear.se/updateSuperField.asp?tblName=" + tblName + "&fieldIDName=" + fieldIDName + "&FieldName=" + FieldName + "&fieldID=" + fieldID + "&ChangeToValue=" + ChangeToValue + "&flagChecked=" + flagChecked;
	//location.href=url;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function forgotMyPW(){
	document.getElementById("forgotPW").innerHTML="Inloggningsuppgifter kommer att skickas<br> till den angivna e-postadressen."
}


function forgotInlogg(){
	document.getElementById("forgotPW").innerHTML="<input id='myEmail' name='myEmail' type='text' value='Skriv in Er e-post adress' size='30' class='text' onClick=javascript:ClearThis(this.id)><input type='button' value='Skicka' onClick='javascript:forgotMyPW()' class='text'>"
}

function delLoggo(SuppID,counter){
	tmpTarget = "addLogo" + counter;
	document.getElementById(tmpTarget).style.backgroundColor="#F00";
	document.getElementById(tmpTarget).innerHTML ="Ta bort?<br><a href='delLoggo.asp?SuppID=" + SuppID  + "'>JA</a>&nbsp;&nbsp;<a href='supplier.asp'>NEJ</a>";
}

function addLogo(counter,SuppID){ 
	var strForm = "<FORM METHOD='POST' ENCTYPE='multipart/form-data' ACTION='uploadScriptLogo.asp?SuppID=" + SuppID + "&pictNum=1'>"
	    strForm = strForm + "<INPUT NAME='FILE1' TYPE=FILE class='textSmall' size='1'><INPUT TYPE=HIDDEN NAME='DESCR1' class='textSmall'><br><input type=SUBMIT value='Ladda upp' class='textSmall' /></FORM>"
	document.getElementById("addLogo"+counter).innerHTML=strForm;
}


function delColor(ArtColorID){
	tmpTarget = "delCell" + ArtColorID;
	document.getElementById(tmpTarget).style.backgroundColor="#F00";
	document.getElementById(tmpTarget).innerHTML ="&Auml;r du s&auml;ker?<br><a href='delColor.asp?ArtColorID=" + ArtColorID  + "'>JA</a>&nbsp;&nbsp;<a href='colors.asp'>NEJ</a>";
}



function delSupp(SuppID,counter){
	tmpTarget = "delCell" + counter;
	document.getElementById(tmpTarget).style.backgroundColor="#F00";
	document.getElementById(tmpTarget).innerHTML ="&Auml;r du s&auml;ker?<br><a href='delSupp.asp?SuppID=" + SuppID  + "'>JA</a>&nbsp;&nbsp;<a href='supplier.asp'>NEJ</a>";
}

function delCust(CustomerID,counter,searchCust){
	tmpTarget = "delCell" + counter;
	document.getElementById(tmpTarget).style.backgroundColor="#F00";
	document.getElementById(tmpTarget).innerHTML ="&Auml;r du s&auml;ker?<br><a href='delCust.asp?CustomerID=" + CustomerID  + "&searchCust=" + searchCust + "'>JA</a>&nbsp;&nbsp;<a href='memberAdmin.asp?searchCust=" + searchCust + "'>NEJ</a>";
}

function delVIP(CustomerID){
	tmpTarget = "delCell" + CustomerID;
	document.getElementById(tmpTarget).style.backgroundColor="#F00";
	document.getElementById(tmpTarget).innerHTML ="&Auml;r du s&auml;ker?<br><a href='delVIP.asp?CustomerID=" + CustomerID  + "'>JA</a>&nbsp;&nbsp;<a href='vipAdmin.asp'>NEJ</a>";
}



function markedColor(connArtID,connArtColorID){ 
	if (document.getElementById("color_" + connArtColorID).style.backgroundColor=="#33ff00"){
		// Delete marked color
		document.getElementById("color_" + connArtColorID).style.backgroundColor="#cccccc";
		tmpTarget = "color_" + connArtColorID;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="delMarkedColor.asp?connArtID=" + connArtID + "&connArtColorID=" + connArtColorID;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=noConfirmation 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	else
	{
		// Save marked color
		document.getElementById("color_" + connArtColorID).style.backgroundColor="#33ff00";
		tmpTarget = "color_" + connArtColorID;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="addMarkedColor.asp?connArtID=" + connArtID + "&connArtColorID=" + connArtColorID;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=noConfirmation 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}

}


function markedTempColor(tmpSaveCode,connArtColorID){ 
	if (document.getElementById("color_" + connArtColorID).style.backgroundColor=="#33ff00"){
		// Delete marked color
		document.getElementById("color_" + connArtColorID).style.backgroundColor="#cccccc";
		tmpTarget = "color_" + connArtColorID;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="delTempMarkedColor.asp?tmpSaveCode=" + tmpSaveCode + "&connArtColorID=" + connArtColorID;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=noConfirmation 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	else
	{
		// Save marked color
		document.getElementById("color_" + connArtColorID).style.backgroundColor="#33ff00";
		tmpTarget = "color_" + connArtColorID;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="addTempMarkedColor.asp?tmpSaveCode=" + tmpSaveCode + "&connArtColorID=" + connArtColorID;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=noConfirmation 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}

}

function goStoreArtBasket(){
	url="StoreArtBasket.asp";
	window.location.href=url;
}


function inloggVIP(){
	window.location.href="VIP_inlogg.asp";
}

function goCalcWeight(calcValue){
	//var tmpValue = document.getElementById("otherWeight").value;
	//var newValue = tmpValue * calcValue;
	//document.getElementById("intArtWeight").value="42";
	alert("fkjfjk");
}


function goTV(){
	window.location.href="pgtv.asp"
}

function goMob(){
	var url =  "http://www.facebook.com/group.php?gid=6531771379&ref=ts"
	fbwindow = window.open (url , "fbwindow","resizable=1,location=1,status=1,scrollbars=1,toolbar=1,directories=1,copyhistory=1, width=600px,height=500px");
  	fbwindow.moveTo(100,100);
}

function openChArt(ArtID,CatID,SubCatID){
	var CatID=document.getElementById("filterCat").value;
	url="chArt.asp?ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID;
	location.href=url;
}

// =========================== SEARCH ==========================================

function searchShowDetail(ArtID,CatID,SubCatID){
	url="StoreArtDetail.asp?ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID;
	location.href=url;
}



function searchChBkgr(target,chColor){
	document.getElementById(target).style.backgroundColor=chColor;
}

// ============================================================================

function goNewArt(connCatID,SubCatID){
	url="newArt.asp?connCatID=" + connCatID + "&SubCatID=" + SubCatID;
	location.href=url;

}


function updateSuperField(fieldID,fieldIDName,PaintTarget,FieldName,ChangeToValue,tblName,level){ 
	var flagChecked = null;
	flagChecked = document.getElementById(PaintTarget).checked;
//	//alert(flagChecked)
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 //Update value in field
	 if(!level){
		var url="updateSuperField.asp?tblName=" + tblName + "&fieldIDName=" + fieldIDName + "&FieldName=" + FieldName + "&fieldID=" + fieldID + "&ChangeToValue=" + ChangeToValue + "&flagChecked=" + flagChecked;
	 }
	 else
	 {
		var url=level + "updateSuperField.asp?tblName=" + tblName + "&fieldIDName=" + fieldIDName + "&FieldName=" + FieldName + "&fieldID=" + fieldID + "&ChangeToValue=" + ChangeToValue + "&flagChecked=" + flagChecked;
	 }
	//location.href=url;
	//alert(url);
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function ClearThis(TargetID){
	document.getElementById(TargetID).value="";
}



function insertHTML(startTag, stopTag,TargetName){ 

var textarea = document.getElementById(TargetName);

//alert(typeof(textarea.selectionStart));

// get selection in firefox, safari, opera, ...
if (typeof(textarea.selectionStart) == 'number')

{
	//alert("firefox, safari");

  // get start and end points of selected text

  textarea.sel_start = textarea.selectionStart;

  textarea.sel_end = textarea.selectionEnd;
  
 	//alert(textarea.sel_start);
 	//alert(textarea.sel_end);
	//alert(textarea.value);  

  // get selected and surrounding text

  textarea.sel_text = textarea.value.substring(textarea.sel_start, textarea.sel_end);

  textarea.sel_text_pre = textarea.value.substring(0, textarea.sel_start);

  textarea.sel_text_post = textarea.value.substring(textarea.sel_end, textarea.value.length);
  
//  alert(textarea.sel_text);
//  alert(textarea.sel_text_pre);
//  alert(textarea.sel_text_post);
  
   // inserting TAGS
 
  var txtTextAreaUpdated
 
  textarea.sel_text_pre = textarea.sel_text_pre + startTag;
  textarea.sel_text_post = stopTag + textarea.sel_text_post;
  txtTextAreaUpdated = textarea.sel_text_pre + textarea.sel_text + textarea.sel_text_post;
  
//  alert(textarea.sel_text_pre);
//  alert(textarea.sel_text_post);
 
 document.getElementById(TargetName).value = txtTextAreaUpdated;
}

// get selection in IE

else if (document.selection)

{

  // make sure it's the textarea's selection

  var range = document.selection.createRange();

  if (range.parentElement().id == TargetName)

  {

     // create a selection of the whole textarea

     var range_all = document.body.createTextRange();

     range_all.moveToElementText(textarea);

     // calculate selection start point by moving beginning of range_all to beginning of range

     for (var sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start ++)

       range_all.moveStart('character', 1);

     // get number of line breaks from textarea start to selection start and add them to sel_start

     for (var i = 0; i <= sel_start; i ++)

     {

       if (textarea.value.charAt(i) == '\n')

         sel_start ++;

     }

     textarea.sel_start = sel_start;

     // create a selection of the whole textarea

     var range_all = document.body.createTextRange();

     range_all.moveToElementText(textarea);

     // calculate selection end point by moving beginning of range_all to end of range

     for (var sel_end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; sel_end ++)

       range_all.moveStart('character', 1);

     // get number of line breaks from textarea start to selection end and add them to sel_end

     for (var i = 0; i <= sel_end; i ++)

     {

       if (textarea.value.charAt(i) == '\n')

         sel_end ++;

     }

     textarea.sel_end = sel_end;

     // get selected and surrounding text

     textarea.sel_text = range.text;

     textarea.sel_text_pre = textarea.value.substring(0, textarea.sel_start);

     textarea.sel_text_post = textarea.value.substring(textarea.sel_end, textarea.value.length);
	 
//	 alert(textarea.sel_text_pre);
//	 alert(textarea.sel_text);
//	 alert(textarea.sel_text_post);

 // inserting TAGS
 
  var txtTextAreaUpdated
 
 textarea.sel_text_pre = textarea.sel_text_pre + startTag;
 textarea.sel_text_post = stopTag + textarea.sel_text_post;
 txtTextAreaUpdated = textarea.sel_text_pre + textarea.sel_text + textarea.sel_text_post;
 
 document.getElementById(TargetName).value = txtTextAreaUpdated;
}

}

// this browser doesn't support javascript selections

else

{

  // ...

}

}


function LoggOut(){  //<------------------------------------------------- Gamla
	location.href="http://www.protectiongear.se/adm/loggOut.asp"
}

function LoggOutMe(){ //<------------------------------------------------- Nya i ver 2.0
	window.location.href="loggOut.asp"
}

function ClearInloggFrm(currentPos){
	document.getElementById(currentPos).value="";
	//if (currentPos=="txtMemberPW") {
	//	document.getElementById(currentPos).type="password";
	//}
}

function LoggaInMain(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_newCust.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// Denna ersätter LoggaInMain i PG 2.0
function newRegistration(fromSite,ArtID,CatID,SubCatID, specialVar){
	var url="StoreNewCust.asp?fromSite=" + fromSite + "&ArtID=" + ArtID + "&CatID=" + CatID +  "&SubCatID=" + SubCatID + "&specialVar=" + specialVar;
	window.location.href=url;
}

function LoggaInCol(){ // <--------------------------------- Gamla versionen. Bort
	tmpTarget = "inloggFrm";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_inloggFrm.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function updateExtras(ArtVariationID,connArtID){
	var blnShow=false;
	if (document.getElementById("checkbox_" + ArtVariationID).checked){
	blnShow=true}
	//tmpTarget = "checkbox_" + ArtVariationID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="updateExtras.asp?ArtVariationID=" + ArtVariationID + "&connArtID=" + connArtID + "&blnShow=" + blnShow
	//alert(url)
	url=url+"&sid="+Math.random()	
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function changeShowVAT(CustomerID,blnNO_VAT){
	var tmpVATValue = 0
	
	if (document.getElementById('blnNO_VAT').checked){
	tmpVATValue=-1}
	
	tmpTarget = "VIParea";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="http://www.protectiongear.se/store/vip/start.asp?f=changeVAT&CustomerID=" + CustomerID + "&tmpVATValue=" + tmpVATValue;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	 
}

function testHi(){
	
	alert("test hi");
	}
	
function addVIP(CustomerID){
	url="addVIP.asp?CustomerID=" + CustomerID;
	location.href=url;
	}
	
function ManualVIP(){
	url="addManualVIP.asp";
	location.href=url;
	}

	
function addManualVIP(){
	var CustomerID = document.getElementById("CustomerID").value;
	url="addVIP.asp?CustomerID=" + CustomerID;
	location.href=url;
	}
	
function denyVIP(CustomerID){
	url="denyVIP.asp?CustomerID=" + CustomerID;
	location.href=url;
	}
	
function sendDeny(CustomerID){
	url="denyVIP.asp?CustomerID=" + CustomerID + "&f=sendDeny";
	location.href=url;
	}
	
function closeDeny(CustomerID){
	url="vipAdmin.asp";
	location.href=url;
	}
	
function sendVIPapplication(CustomerID){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/sendVIPapplication.asp?CustomerID=" + CustomerID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	}	
	
function addOrderList(connStoreListID){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/fetchOrderList.asp?connStoreListID=" + connStoreListID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}


function saveOrderList(){
	var txtSaveListPW = document.getElementById("txtSaveListPW").value;
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/saveOrderList.asp?txtSaveListPW=" + txtSaveListPW;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}

function inLoggVIP(){
	alert("koll")
//	document.getElementById("inloggVIP").innerHTML="<a href='javascript:homeVIP()' class='text'>Min sida</a>";
//	var txtMemberID = document.getElementById("txtMemberID_mainInlogg").value;
//	var txtMemberPW = document.getElementById("txtMemberPW_mainInlogg").value;
//	tmpTarget="pageStore"
//	xmlHttp=GetXmlHttpObject();
//	if (xmlHttp==null)
//	{
//	alert ("Your browser does not support AJAX!");
//	return;
//	} 
//	var url="store/vip/inLoggCheck.asp?txtMemberID=" + txtMemberID + "&txtMemberPW=" + txtMemberPW
//	url=url+"&sid="+Math.random();
//	xmlHttp.onreadystatechange=updatedTarget;
//	xmlHttp.open("GET",url,true);
//	xmlHttp.send(null);	
	}
	
function forgotVIP_PW(){
	tmpTarget="forgotPW"
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url="http://www.protectiongear.se/store/vip/forgotPW.asp?f=null"
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
	}

function sendVIP_PW(){
	var txtCustEmail = document.getElementById("txtCustEmail").value;
	if (txtCustEmail.length>0) {
		tmpTarget="forgotPW"
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
		alert ("Your browser does not support AJAX!");
		return;
		} 
		var url="http://www.protectiongear.se/store/vip/sendPW.asp?txtCustEmail=" + txtCustEmail
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		}
	}

function contactSale(){
	tmpTarget="entrence"
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url="contactSale.asp?f=null"
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
	
	}


function backFromSale(){
	tmpTarget="entrence"
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url="indexBack.asp?f=null"
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
	
	}

// Kontrollerar om vissa fält är ifylld
function checkFormNewCust(){
	var txtMess = "Dessa fält måste vara ifyllda; "
	var MessFlag = false;
		
	if(document.frmAddCust.txtCustFirstName.value==""){
		txtMess=txtMess+ "Förnman";
		MessFlag = true;
		document.frmAddCust.txtCustFirstName.style.borderWidth = "2px"
		document.frmAddCust.txtCustFirstName.style.borderStyle = "solid"
		document.frmAddCust.txtCustFirstName.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLastName.value==""){
		txtMess=txtMess+ ", Efternamn";
		MessFlag = true;
		document.frmAddCust.txtCustLastName.style.borderWidth = "2px"
		document.frmAddCust.txtCustLastName.style.borderStyle = "solid"
		document.frmAddCust.txtCustLastName.style.borderColor = "#ff0000"
	}

	if(document.frmAddCust.txtCustEmail.value==""){
		txtMess=txtMess+ ", E-post";
		MessFlag = true;
		document.frmAddCust.txtCustEmail.style.borderWidth = "2px"
		document.frmAddCust.txtCustEmail.style.borderStyle = "solid"
		document.frmAddCust.txtCustEmail.style.borderColor = "#ff0000"
	}

	if(document.frmAddCust.txtMemberID.value==""){
		txtMess=txtMess+ ", Användarnamn";
		MessFlag = true;
		document.frmAddCust.txtMemberID.style.borderWidth = "2px"
		document.frmAddCust.txtMemberID.style.borderStyle = "solid"
		document.frmAddCust.txtMemberID.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtMemberPW.value==""){
		txtMess=txtMess+ ", Lösenord";
		MessFlag = true;
		document.frmAddCust.txtMemberPW.style.borderWidth = "2px"
		document.frmAddCust.txtMemberPW.style.borderStyle = "solid"
		document.frmAddCust.txtMemberPW.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustPhone.value==""){
		txtMess=txtMess+ ", Telefon";
		MessFlag = true;
		document.frmAddCust.txtCustPhone.style.borderWidth = "2px"
		document.frmAddCust.txtCustPhone.style.borderStyle = "solid"
		document.frmAddCust.txtCustPhone.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevAddress.value==""){
		txtMess=txtMess+ ", Adress";
		MessFlag = true;
		document.frmAddCust.txtCustLevAddress.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevAddress.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevAddress.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevZip.value==""){
		txtMess=txtMess+ ", Postnr";
		MessFlag = true;
		document.frmAddCust.txtCustLevZip.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevZip.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevZip.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevCity.value==""){
		txtMess=txtMess+ ", Stad";
		MessFlag = true;
		document.frmAddCust.txtCustLevCity.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevCity.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevCity.style.borderColor = "#ff0000"
	}
	
	
	if (MessFlag==true){
		alert(txtMess);
	}
	else
	{
		document.frmAddCust.submit();	
	}
	
}


function checkFormWannaBeVIP(){
	var txtMess = "Dessa fält måste vara ifyllda; "
	var MessFlag = false;

		
	if(document.frmAddCust.txtCustFirstName.value==""){
		txtMess=txtMess+ "Förnman";
		MessFlag = true;
		document.frmAddCust.txtCustFirstName.style.borderWidth = "2px"
		document.frmAddCust.txtCustFirstName.style.borderStyle = "solid"
		document.frmAddCust.txtCustFirstName.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLastName.value==""){
		txtMess=txtMess+ ", Efternamn";
		MessFlag = true;
		document.frmAddCust.txtCustLastName.style.borderWidth = "2px"
		document.frmAddCust.txtCustLastName.style.borderStyle = "solid"
		document.frmAddCust.txtCustLastName.style.borderColor = "#ff0000"
	}

	if(document.frmAddCust.txtCustEmail.value==""){
		txtMess=txtMess+ ", E-post";
		MessFlag = true;
		document.frmAddCust.txtCustEmail.style.borderWidth = "2px"
		document.frmAddCust.txtCustEmail.style.borderStyle = "solid"
		document.frmAddCust.txtCustEmail.style.borderColor = "#ff0000"
	}

	if(document.frmAddCust.txtMemberID.value==""){
		txtMess=txtMess+ ", Användarnamn";
		MessFlag = true;
		document.frmAddCust.txtMemberID.style.borderWidth = "2px"
		document.frmAddCust.txtMemberID.style.borderStyle = "solid"
		document.frmAddCust.txtMemberID.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtMemberPW.value==""){
		txtMess=txtMess+ ", Lösenord";
		MessFlag = true;
		document.frmAddCust.txtMemberPW.style.borderWidth = "2px"
		document.frmAddCust.txtMemberPW.style.borderStyle = "solid"
		document.frmAddCust.txtMemberPW.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevAddress.value==""){
		txtMess=txtMess+ ", Adress";
		MessFlag = true;
		document.frmAddCust.txtCustLevAddress.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevAddress.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevAddress.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevZip.value==""){
		txtMess=txtMess+ ", Postnr";
		MessFlag = true;
		document.frmAddCust.txtCustLevZip.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevZip.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevZip.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevCity.value==""){
		txtMess=txtMess+ ", Stad";
		MessFlag = true;
		document.frmAddCust.txtCustLevCity.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevCity.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevCity.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustPhone.value==""){
		txtMess=txtMess+ ", Telefon";
		MessFlag = true;
		document.frmAddCust.txtCustPhone.style.borderWidth = "2px"
		document.frmAddCust.txtCustPhone.style.borderStyle = "solid"
		document.frmAddCust.txtCustPhone.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustLevName.value==""){
		txtMess=txtMess+ ", Företag";
		MessFlag = true;
		document.frmAddCust.txtCustLevName.style.borderWidth = "2px"
		document.frmAddCust.txtCustLevName.style.borderStyle = "solid"
		document.frmAddCust.txtCustLevName.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddCust.txtCustOrgNumb.value==""){
		txtMess=txtMess+ ", Orgnr";
		MessFlag = true;
		document.frmAddCust.txtCustOrgNumb.style.borderWidth = "2px"
		document.frmAddCust.txtCustOrgNumb.style.borderStyle = "solid"
		document.frmAddCust.txtCustOrgNumb.style.borderColor = "#ff0000"
	}
	
	
	if (MessFlag==true){
		alert(txtMess);
	}
	else
	{
		document.frmAddCust.submit();	
	}
	
}

function checkFormUniform(){
	var txtMess = "Dessa fält måste vara ifyllda; "
	var MessFlag = false;

		
	if(document.frmAddUniformRequest.txtCustFirstName.value==""){
		txtMess=txtMess+ "Förnman";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustFirstName.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustFirstName.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustFirstName.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddUniformRequest.txtCustLastName.value==""){
		txtMess=txtMess+ ", Efternamn";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustLastName.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustLastName.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustLastName.style.borderColor = "#ff0000"
	}

	if(document.frmAddUniformRequest.txtCustEmail.value==""){
		txtMess=txtMess+ ", E-post";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustEmail.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustEmail.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustEmail.style.borderColor = "#ff0000"
	}

	if(document.frmAddUniformRequest.txtMemberID.value==""){
		txtMess=txtMess+ ", Användarnamn";
		MessFlag = true;
		document.frmAddUniformRequest.txtMemberID.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtMemberID.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtMemberID.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddUniformRequest.txtMemberPW.value==""){
		txtMess=txtMess+ ", Lösenord";
		MessFlag = true;
		document.frmAddUniformRequest.txtMemberPW.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtMemberPW.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtMemberPW.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddUniformRequest.txtCustLevAddress.value==""){
		txtMess=txtMess+ ", Adress";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustLevAddress.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustLevAddress.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustLevAddress.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddUniformRequest.txtCustLevZip.value==""){
		txtMess=txtMess+ ", Postnr";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustLevZip.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustLevZip.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustLevZip.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddUniformRequest.txtCustLevCity.value==""){
		txtMess=txtMess+ ", Stad";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustLevCity.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustLevCity.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustLevCity.style.borderColor = "#ff0000"
	}
	
	if(document.frmAddUniformRequest.txtCustPhone.value==""){
		txtMess=txtMess+ ", Telefon";
		MessFlag = true;
		document.frmAddUniformRequest.txtCustPhone.style.borderWidth = "2px"
		document.frmAddUniformRequest.txtCustPhone.style.borderStyle = "solid"
		document.frmAddUniformRequest.txtCustPhone.style.borderColor = "#ff0000"
	}
	
	
	if (MessFlag==true){
		alert(txtMess);
	}
	else
	{
		document.frmAddUniformRequest.submit();	
	}
	
}


// Dynamisk tabell för uppdatering av fält

function updateThisField(uniqeID, uniqeIDname, fieldID,PaintTarget,ChangeToValue,tblName){ 
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="updateField.asp?uniqeID=" + uniqeID + "&uniqeIDname" +  "&uniqeIDname=" + uniqeIDname + "&fieldID=" + fieldID + "&FieldName=" + FieldName + "&ChangeToValue=" + ChangeToValue + "&tblName=" + tblName;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// --------------------------- EKONOMI FUNKTIONER -----------------------------------

function openAdmCust(){
	url="invoice_customer.asp";
	location.href=url;
}

function openInvoiceList(){
	url="invoice_invoiceList.asp?f=none";
	location.href=url;
}

function openNoInvoice(){
	url="invoice_All.asp?f=none";
	location.href=url;
}

function openGotInvoice(){
	url="invoice_got_All.asp?f=none";
	location.href=url;
}

function openOblitiration(){
	url="invoice_obliterate.asp?f=none";
	location.href=url;
}

function openCredit(){
	url="invoice_credit.asp?f=none";
	location.href=url;
}

function openCreateorder(){
	url="invoice_newOrder.asp?f=none";
	location.href=url;
}

function openAdmin(){
	url="invoice_adm.asp?f=none";
	location.href=url;
}


function updateFieldCustomer(CustomerID,PaintTarget,FieldName,ChangeToValue){ 
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="updateCustomer.asp.asp?CustomerID=" + CustomerID + "&FieldName=" + FieldName + "&ChangeToValue=" + ChangeToValue;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function moveInvoiceList(OrderID,f,f2,intOrderStatus){ 
	var url="invoice_moveInvoiceList.asp?OrderID=" + OrderID +"&f=" + f + "&f2=" + f2 + "&intOrderStatus=" + intOrderStatus;
	location.href=url;
} 

function viewInvoice(OrderID,intOrderStatus) {
	var url =  "/adm/invoice/invoice_custInvoice.asp?OrderID=" + OrderID + "&intOrderStatus=" + intOrderStatus;
	
	
//	if (flag=='new'){
//		var dtmToDay = frmInvoice.dtmToDay.value;
//		var dtmDueToPay = frmInvoice.dtmDueToPay.value;
//		var url =  "/adm/invoice/invoice_custInvoice.asp?OrderID=" + OrderID + "&dtmToDay=" + dtmToDay + "&dtmDueToPay=" + dtmDueToPay + "&flag=" + flag;
//	}
//	if (flag=='newNoDate'){
//		var dtmToDay = "&nbsp;";
//		var dtmDueToPay = "&nbsp;";
//		var url =  "/adm/invoice/invoice_custInvoice.asp?OrderID=" + OrderID + "&dtmToDay=" + dtmToDay + "&dtmDueToPay=" + dtmDueToPay + "&flag=" + flag;
//	}
//	if (flag=='old'){
//		var url =  "/adm/invoice/invoice_custInvoice.asp?OrderID=" + OrderID + "&flag=" + flag;
//	}
//	if (flag=='cred'){
//		var url =  "/adm/invoice/invoice_custInvoice.asp?OrderID=" + OrderID + "&flag=" + flag;
//	}
	mywindow = window.open (url , "mywindow","resizable=1,location=0,status=0,scrollbars=0, width=700,height=800");
  	mywindow.moveTo(0,0);
 }
 
  function viewArt(ArtID) {
	var url =  "/store/store_artDetail_VIP.asp?f=null&ArtID=" + ArtID;
	mywindow = window.open (url , "mywindow","resizable=1,location=0,status=0,scrollbars=0, width=700,height=600");
  	mywindow.moveTo(0,0);
 }
 
 function printInvoice(OrderID,intOrderStatus,f){
	 url="invoice_custInvoice_print.asp?OrderID=" + OrderID + "&intOrderStatus=" + intOrderStatus + "&f=" + f;
	//if (t=='new'){
	//	var dtmToDay = frmInvoice.dtmToDay.value;
	//	var dtmDueToPay = frmInvoice.dtmDueToPay.value;
		//url="invoice_custInvoice_print.asp?f=new&f2=" + f2 + "&intStatus=" + intStatus;
	//}
//	else {
//		url="invoice_custInvoice_print.asp?orderid=" + orderid + "&f=old&f2=" + f2 + "&intStatus=" + intStatus;
//	}
//	day = new Date();
//	id = day.getTime();
//	url = url + "&pageid=" + id;
//	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=700,left = 320,top = 162');");
	mywindow = window.open (url , "mywindow","resizable=1,location=0,status=0,scrollbars=0, width=700,height=800");
  	mywindow.moveTo(0,0);

}

function showEmailForm(intOrderStatus){ 
	tmpTarget="ecoAssignment"
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	}
	var url="invoice_mailInvoice.asp?intOrderStatus=" + intOrderStatus;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	//if (invType=="new"){
//		var dtmEventFromDate = document.getElementById("dtmToDay").value;
//		var dtmEventToDate = document.getElementById("dtmDueToPay").value;
//		var intInvitation = document.getElementById("intInvitation").value;
//		var intCompendium = document.getElementById("intCompendium").value;
//		var intOther = document.getElementById("intOther").value;
		//var url="invoice_All.asp?f=new&f2=emailInvoice&dtmEventFromDate=" + dtmEventFromDate + "&dtmEventToDate=" + dtmEventToDate+ "&intInvitation=" + intInvitation + "&intCompendium=" + intCompendium + "&intOther=" + intOther;
		//var url="invoice_mailInvoice.asp?f=new&dtmEventFromDate=" + dtmEventFromDate + "&dtmEventToDate=" + dtmEventToDate+ "&intInvitation=" + intInvitation + "&intCompendium=" + intCompendium + "&intOther=" + intOther;

	//}
//	if (invType=="old"){
//		var remaind=document.getElementById("remaidInv").checked;
//		//var url="invoice_got_All.asp?f=old&f2=emailInvoice"
//		var url="invoice_mailInvoice.asp?f=old&remaind=" + remaind;
//	}
}


function BackInvoiceGotAll(intOrderStatus){
	if (intOrderStatus==1){
		var url="/adm/invoice/invoice_All.asp?f=none";
	}
	else
	{
		var url="/adm/invoice/invoice_got_All.asp?f=none"
	}
	location.href=url;
}

function sendInvoiceByEMail(intOrderStatus,remind){ 
	tmpTarget="ecoAssignment"
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	if (intOrderStatus==1){
		var dtmToDay = document.getElementById("dtmToDay").value;
		var dtmDueToPay = document.getElementById("dtmDueToPay").value;
//		var intInvitation = document.getElementById("intInvitation").value;
	//	var intCompendium = document.getElementById("intCompendium").value;
	//	var intOther= document.getElementById("intOther").value;
	}
	var txtHeadline = document.getElementById("txtHeadline").value;
	var txtMailMess = document.getElementById("txtMailMess").value;

	if (intOrderStatus==1){
		//var url="invoice_sendinvoice.asp?f=new&txtHeadline=" + txtHeadline + "&txtMailMess=" + txtMailMess + "&intInvitation=" + intInvitation + "&intCompendium=" + intCompendium + "&intOther=" + intOther + "&dtmToDay=" + dtmToDay + "&dtmDueToPay=" + dtmDueToPay;
		var url="invoice_sendinvoice.asp?intOrderStatus=" + intOrderStatus + "&txtHeadline=" + txtHeadline + "&txtMailMess=" + txtMailMess + "&dtmToDay=" + dtmToDay + "&dtmDueToPay=" + dtmDueToPay;
	}
	if (intOrderStatus>1){
		var url="invoice_sendinvoice.asp?intOrderStatus=" + intOrderStatus + "&txtHeadline=" + txtHeadline + "&txtMailMess=" + txtMailMess + "&remind=" + remind;
	}
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

// --------------------------- ANDRA FUNKTIONER -----------------------------------

function EnterPressed(e) {
// Code adapted from Jennifer Madden
// http://jennifermadden.com/162/examples/stringEnterKeyDetector.html

  var characterCode
  if(e && e.which){           // NN4 specific code
    e = e
    characterCode = e.which
  }
  else {
    e = event
    characterCode = e.keyCode // IE specific code
  }
  if (characterCode == 13) return true   // Enter key is 13
  else return false
}


function changeSum(intArtBuyNumbOf,intArtPrice){
	var tmpSum = intArtBuyNumbOf * intArtPrice;
	document.getElementById('intArtPriceDisplay').value = tmpSum + " :-";
}


// FUNKTIONER FÖR ATT SKAPA VARIATIONER AV LAGER FÖR ARTIKEL

function addRowArtVar(btnID){
	//Create a unique ID
	var randomnumber=Math.floor(Math.random()*1000001);
	var d = new Date();
	randomnumber = randomnumber + d.getSeconds();
	//Create extra row
	var tbl = document.getElementById('tblArtVar');
	var lastRow = tbl.rows.length;
	// if there's no header row in the table, then iteration = lastRow + 1
	var row = tbl.insertRow(lastRow-2); 
	// Setting the rows unique id
	row.id = "invRow" + randomnumber;
	// cell 
	var cellOne = row.insertCell(0);
	// Setting the cells unique id
	cellOne.id = "invRow" + randomnumber + "Cell1";
	cellOne.innerHTML="<input name=" + randomnumber + " id=" + randomnumber + " type='button' class='textsmall' value=' + ' onclick='addRowArtVar(this.id)' />";
	var cellTwo = row.insertCell(1);
	var strHTML2 = "<select name='txtArtSize" + randomnumber + "' class='textsmall' id='txtArtSize" + randomnumber + "'>"
        strHTML2 = strHTML2 + "<option value='0' selected='selected'>---</option>"
        strHTML2 = strHTML2 + "<option value='XXXL'>XXXL</option>"
        strHTML2 = strHTML2 + "<option value='XXL'>XXL</option>"
        strHTML2 = strHTML2 + "<option value='XL'>XL</option>"
        strHTML2 = strHTML2 + "<option value='L'>L</option>"
        strHTML2 = strHTML2 + "<option value='M'>M</option>"
        strHTML2 = strHTML2 + "<option value='S'>S</option>"
        strHTML2 = strHTML2 + "<option value='XS'>XS</option>"
      	strHTML2 = strHTML2 + "</select>"
	cellTwo.innerHTML=strHTML2;
	var cellThree = row.insertCell(2);
	 var strHTML3 = "<select name='txtArtColor" + randomnumber + "' class='textsmall' id='txtArtColor" + randomnumber + "'>"
        strHTML3 = strHTML3 + "<option value='0' selected='selected'>- F&auml;rg -</option>"
        strHTML3 = strHTML3 + "<option value='Svart'>Svart</option>"
        strHTML3 = strHTML3 + "<option value='Vit'>Vit</option>"
        strHTML3 = strHTML3 + "<option value='Bl&aring; marin'>Bl&aring; marin</option>"
        strHTML3 = strHTML3 + "<option value='Bl&aring; ljus'>Bl&aring; ljus</option>"
        strHTML3 = strHTML3 + "<option value='Gr&ouml;n m&ouml;rk'>Gr&ouml;n m&ouml;rk</option>"
        strHTML3 = strHTML3 + "<option value='Gr&ouml;n ljus'>Gr&ouml;n ljus</option>"
        strHTML3 = strHTML3 + "<option value='Beige'>Beige</option>"
        strHTML3 = strHTML3 + "<option value='Gul'>Gul</option>"
        strHTML3 = strHTML3 + "<option value='R&ouml;d'>R&ouml;d</option>"
        strHTML3 = strHTML3 + "<option value='Orange'>Orange</option>"
        strHTML3 = strHTML3 + "<option value='Gr&aring; m&ouml;rk'>Gr&aring; m&ouml;rk</option>"
        strHTML3 = strHTML3 + "<option value='Gr&aring; ljus'>Gr&aring; ljus</option>"
     	strHTML3 = strHTML3 + "</select>"
	cellThree.innerHTML=strHTML3;
	var cellFour = row.insertCell(3);
	var connArtID = document.getElementById('connArtID').value;
	cellFour.innerHTML="<input name='intArtStock" + randomnumber + "' id='intArtStock" + randomnumber + "' type='text' class='textsmall' size='6' value='0' onChange='addVarStock(" + randomnumber + "," + connArtID + ",this.value)'/>";
	//Assign rowvalue to a field	
	document.getElementById('loopid').value=(lastRow-3);
	//Change button in the row above to Minus
	document.getElementById("invRow" + btnID + "Cell1").innerHTML="<input name=" + randomnumber + " id=" + randomnumber + " type='button' class='textsmall' value=' - ' onclick='delRowArtVar(this.id)' />";

}

function delRowArtVar(btnID){
	 var delRowNumb = document.getElementById("invRow" + btnID).rowIndex;
	 // Correction of row number
	 delRowNumb = delRowNumb - 1;
	//Delete row
	document.getElementById('tblArtVar').deleteRow(delRowNumb);
	var tbl = document.getElementById('tblArtVar');
	var lastRow = tbl.rows.length;	
	//Assign rowvalue to a field	
	document.getElementById('loopid').value=(lastRow-11);
}

function upDateStock(ArtStockID,connArtID,intArtStock){
	var url="updateVarStock.asp?connArtID=" + connArtID + "&ArtStockID=" + ArtStockID + "&intArtStock=" + intArtStock;
	location.href=url;
}

function addVarStock(rndID,connArtID,intArtStock){
	var txtArtSize = document.getElementById("txtArtSize" + rndID).value;
	var txtArtColor = document.getElementById("txtArtColor" + rndID).value;
	tmpTarget = "intArtTotalStock" + connArtID;
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="addVarStock.asp?connArtID=" + connArtID + "&txtArtSize=" + txtArtSize + "&txtArtColor=" + txtArtColor + "&intArtStock=" + intArtStock;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function newOrder_delInvoiceRow(rid){
	//Delete row
	document.getElementById('tblOrder').deleteRow(document.getElementById("invRow" + rid).rowIndex);
	var tbl = document.getElementById('tblOrder');
	var lastRow = tbl.rows.length;	
	//Assign rowvalue to a field	
	document.getElementById('loopid').value=(lastRow-11);
	//Make plus-button visible
	
	//alert(document.getElementById("invRow" + rid).rowIndex;
	document.getElementById('btnAddRow' + document.getElementById('loopid').value).style.visibility="visible";
//	alert(rid);
//	alert(document.getElementById('loopid').value);
}

function newOrder_getProduct(rowID){
//	alert("Hämtar produkt till rad " + rowID)
	var url =  "/adm/invoice/invoice_productList.asp?rowID=" + rowID;
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}
	else {
		newwindow=window.open(url,'Produkter','toolbar=no,directories=no,resizable=no,location=no,status=no,scrollbars=yes,menubar=no,width=385,height=120');
		if (!newwindow.opener) newwindow.opener = self;
	}
}

function newOrder_setSum(rowID){
	document.getElementById('freeform_sum_' + rowID).value=document.getElementById('freeform_quantity_' + rowID).value * document.getElementById('freeform_price_NOVAT_' + rowID).value;	
	var tmpSum=0;
	var tmpVat0=0;
	var tmpVat6=0;
	var tmpVat12=0;
	var tmpVat25=0;
	for (var i=0;i <= document.getElementById('loopid').value;i++){
		tmpSum = tmpSum + (document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value);	
		if (document.getElementById('freeform_vat_' + i).value=="0"){
		tmpVat0 = tmpVat0 + 0;	
		}
		if (document.getElementById('freeform_vat_' + i).value=="6"){
		tmpVat6 = tmpVat6 + ((document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value)*1.06)-(document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value);	
		}
		if (document.getElementById('freeform_vat_' + i).value=="12"){
		tmpVat12 = tmpVat12 + ((document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value)*1.12)-(document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value);	
		}
		if (document.getElementById('freeform_vat_' + i).value=="25"){
		tmpVat25 = tmpVat25 + ((document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value)*1.25)-(document.getElementById('freeform_quantity_' + i).value * document.getElementById('freeform_price_NOVAT_' + i).value);	
		}
	}
	document.getElementById('freeform_SumExVat').value=Math.round(tmpSum);
	document.getElementById('freeform_Vat0').value=Math.round(tmpVat0);
	document.getElementById('freeform_Vat6').value=Math.round(tmpVat6);
	document.getElementById('freeform_Vat12').value=Math.round(tmpVat12);
	document.getElementById('freeform_Vat25').value=Math.round(tmpVat25);
	document.getElementById('freeform_SumIncVat').value=Math.round(tmpSum+tmpVat0+tmpVat6+tmpVat12+tmpVat25);
}

function searchArtClear(searchArt){
	if (searchArt=="Minst tre tecken"){
		document.getElementById("txtSearch").value="";
		}
	}


function searchArtDirect(searchArt){
	var checkLength = searchArt.length;
	if(checkLength>2){
		location.href="article.asp?f=searchArt&searchArt=" + searchArt;
		}
	}

function searchArtDirectPriceAdmin(searchArt){
	var checkLength = searchArt.length;
	if(checkLength>2){
		location.href="articlePrice.asp?f=searchArt&searchArt=" + searchArt;
		}
	}

function chArtSub(ArtID,CatID){
	//document.getElementById("SubCatID" + ArtID).innerHTML="Fixa underrubbe med " + CatID;
		tmpTarget = "SubCatID" + ArtID;
		xmlHttp=GetXmlHttpObject() 
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="showSubCat.asp?ArtID=" + ArtID + "&CatID=" + CatID;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}

function chCatForArt(ArtID,CatID,SubCatID){
	tmpTarget = "SubCatID" + ArtID;
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="updateCatForArt.asp?ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID
	//alert(url);	
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}

function showSearchResult(){
	var tmpSearchArt = document.getElementById('searchArt').value;			
	if (tmpSearchArt.length<2) {
		alert("Sökrutan måste innehålla minst två tecken")
		}
	else
		{
		document.getElementById("headlineNav").innerHTML="<a href='javascript:takeMeHome();'><img src='/images/btnHome.gif' alt='Hem' width='16' height='13' align='absmiddle' border='0' />Hem</a> >> Sökresultat";
		tmpTarget = "pageStore";
		xmlHttp=GetXmlHttpObject() 
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="/store/store_search.asp?tmpSearchArt=" + tmpSearchArt;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		}
}

function cleanSearchCust(){
	if (document.getElementById('searchCust').value=="Minst tre tecken"){
	document.getElementById('searchCust').value="";
	}
}

function showSearchResultCust(){
	var searchCust = document.getElementById('searchCust').value;			
	if (searchCust.length>2) {
		url = "invoice_customer.asp?f=SearchFor&searchCust=" + searchCust;
		location.href=url;
		}
}


// ================================================== CHANGE BACKGROUND
		
function resetBg_left (loc) 
{
loc.style.backgroundColor = activetrcolor;
}

function changeBg (loc) 
{
activetrcolor = loc.style.backgroundColor;
loc.style.backgroundColor = '#C5E2E2';
}
function resetBg (loc) 
{
loc.style.backgroundColor = activetrcolor;
}
		
// ================================================== BASKET

function addBasket(){
	document.frmAddBasket.submit();
}


//----------------------------------
// Add to basket
//----------------------------------
function addToBasket(ADID,ArtID,CatID,SubCatID,txtArtHeadline,intArtPrice,intArtVat,intArtWeight){
	// Add to database
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="http://www.protectiongear.se/store/store_addToBasket.asp?ADID=" + ADID + "&ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&txtArtHeadline=" + txtArtHeadline + "&intArtPrice=" + intArtPrice + "&intArtVat=" + intArtVat + "&intArtWeight=" + intArtWeight + "&intArtQuantity=1&ArtStockID=0";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=confirmAddToBasket; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	// clear headline and add product

	if (document.getElementById('selectX').value==0){
		// Remove Headline
		var elSel = document.getElementById('selectX');
		var i;
		for (i = elSel.length - 1; i>=0; i--) {
		if (elSel.options[i].selected) {
		elSel.remove(i);
		}
		}
		
		// Add product
		
		document.getElementById('TotSum').value=parseInt(document.getElementById('TotSum').value) + parseInt(intArtPrice);
		
		var elOptNew = document.createElement('option');
		elOptNew.text = Left(txtArtHeadline,17);
		elOptNew.value = ArtID;
		var elSel = document.getElementById('selectX');
		
		try {
		elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
		}
		catch(ex) {
		elSel.add(elOptNew); // IE only
		}
	}
	else
	{
		
		// Add product
		
		document.getElementById('TotSum').value=parseInt(document.getElementById('TotSum').value) + parseInt(intArtPrice);
	
		var elOptNew = document.createElement('option');
		elOptNew.text = Left(txtArtHeadline,17);
		elOptNew.value = ArtID;
		var elSel = document.getElementById('selectX');
		
		try {
		elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
		}
		catch(ex) {
		elSel.add(elOptNew); // IE only
		}
	}
}

// HELA DENNA ÄR SÅÅÅ VERSION 1.0 ;) KÖR MED FORMULÄR ISTÄLLET I VERSION 2.0

function addToBasketDetail(ADID,ArtID,CatID,SubCatID,intArtPrice,intArtVat,intArtWeight,size,varFlag){
		
	// Add to database

	//Get variation
	if (varFlag=='True'){
		var tmptxtArtVariation = ". " + document.getElementById('tmptxtArtVariation').value;
	}
	else
	{
		var tmptxtArtVariation="";
	}
	
	//Get headline
	var txtArtHeadline = document.getElementById('txtArtHeadline').value;
	
	//Get Number of articles
	var intArtQuantity = document.getElementById('intArtQuantity').value;
	
	//Get size
	if (size=="size"){
	var ArtStockID = document.getElementById('ArtStockID').value;
	}
	else
	{
	var ArtStockID = 0;
	}
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_addToBasket.asp?ADID=" + ADID + "&ArtID=" + ArtID + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&txtArtHeadline=" + txtArtHeadline + tmptxtArtVariation + "&intArtPrice=" + intArtPrice + "&intArtVat=" + intArtVat + "&intArtQuantity=" + intArtQuantity + "&ArtStockID=" + ArtStockID + "&intArtWeight=" + parseFloat(intArtWeight);
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=confirmAddToBasket; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	// clear headline and add product

	if (document.getElementById('selectX').value==0){
		// Remove Headline
		var elSel = document.getElementById('selectX');
		var i;
		for (i = elSel.length - 1; i>=0; i--) {
		if (elSel.options[i].selected) {
		elSel.remove(i);
		}
		}
		
		// Add product
		document.getElementById('TotSum').value=parseInt(document.getElementById('TotSum').value) + parseInt(intArtPrice * intArtQuantity);
		
		var elOptNew = document.createElement('option');
		elOptNew.text = Left(txtArtHeadline,17);
		elOptNew.value = ArtID;
		var elSel = document.getElementById('selectX');
		
		try {
		elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
		}
		catch(ex) {
		elSel.add(elOptNew); // IE only
		}
	}
	else
	{
		
		// Add product
		
		document.getElementById('TotSum').value = parseInt(document.getElementById('TotSum').value) + parseInt(intArtPrice * intArtQuantity);
	
		var elOptNew = document.createElement('option');
		elOptNew.text = Left(txtArtHeadline,17);
		elOptNew.value = ArtID;
		var elSel = document.getElementById('selectX');
		
		try {
		elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
		}
		catch(ex) {
		elSel.add(elOptNew); // IE only
		}
	}
}

//----------------------------------
// Delete from basket
//----------------------------------
function delFromBasket(connArtID,tmpID,connArtCatID,intDelArtPriceSum,txtArtHeadline){
	
	// Make correction in the basket overview
		// Delete article
		var elSel = document.getElementById('selectX');
		var i;
		for (i = elSel.length - 1; i>=0; i--) {
			if (elSel.options[i].value==connArtID) {
				elSel.remove(i);
			}
		}
		// Update totalsum
		document.getElementById('TotSum').value = parseInt(document.getElementById('TotSum').value) - parseInt(intDelArtPriceSum);

	
	document.getElementById("headlineNav").innerHTML="<a href='javascript:takeMeHome();'><img src='/images/btnHome.gif' alt='Hem' width='16' height='13' align='absmiddle' border='0' />Hem</a> >> Kundvagn";
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="store_basket.asp?f=del&connArtID=" + connArtID + "&tmpID=" + tmpID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
	
//----------------------------------
// Update basket
//----------------------------------
function updateBasket(intArtQuantity,rowID,connArtID,intArtPrice,tmpID){
	
	document.getElementById("headlineNav").innerHTML="<a href='javascript:takeMeHome();'><img src='/images/btnHome.gif' alt='Hem' width='16' height='13' align='absmiddle' border='0' />Hem</a> >> Kundvagn";
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_basket.asp?f=update&connArtID=" + connArtID + "&tmpID=" + tmpID + "&intArtQuantity=" + intArtQuantity;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

//----------------------------------
// Show information about article
//----------------------------------
function ShowArtDetail(ArtID){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_artDetail.asp?ArtID=" + ArtID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// ================================================== BASKET SUMMERY

function openTerms(){ 
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="terms.asp?f=null"
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


//----------------------------------
// Show basket content
//----------------------------------
function ShowBasket(VIPflag){
	//document.getElementById("linkPos").innerHTML="<a href='javascript:takeMeHome();'><img src='/images/btnHome.gif' alt='Hem' width='16' height='13' align='absmiddle' border='0' />Hem</a> >> Kundvagn";
	if (VIPflag=="true"){
		//document.getElementById("inloggVIP").innerHTML="<a href='javascript:homeVIP();'>Min sida som avtalskund</a>";
	}
	else
	{
		//document.getElementById("inloggVIP").innerHTML="<a href='javascript:goVIP();'>Inloggning avtalskunden</a>";
	}
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_basket.asp?f=null"
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

//----------------------------------
// Logg in customer
//----------------------------------
function LoggInBasket(typeOfCust){
	if (typeOfCust=="regCust"){
		tmpTarget = "LoggIn";
		xmlHttp=GetXmlHttpObject() 
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="/store/store_inLogg.asp?f=null"
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	if (typeOfCust=="newCust"){
		tmpTarget = "LoggIn";
		xmlHttp=GetXmlHttpObject() 
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="/store/store_newCust_frame.asp?f=null"
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}

}

//----------------------------------
// Check inlogg of customer
//----------------------------------

function loggInMember(pageLocation){  //<------------------------------------ Denna gäller i ver 2.0
	var txtMemberID = document.getElementById("txtMemberID").value
	var txtMemberPW = document.getElementById("txtMemberPW").value
	//tmpTarget = "logginForm";
//	xmlHttp=GetXmlHttpObject() 
//	if (xmlHttp==null)
//	 {
//	 alert ("Browser does not support HTTP Request")
//	 return
//	 }
	var url="StoreLoggCheck.asp?txtMemberID=" + txtMemberID + "&txtMemberPW=" + txtMemberPW + "&pageLocation=" + pageLocation;
	window.location.href = url;
	//url=url+"&sid="+Math.random()
//	xmlHttp.onreadystatechange=updatedTarget;
//	xmlHttp.open("GET",url,true)
//	xmlHttp.send(null)
//	
//	if(pageLocation=='basket'){
//	window.location.href="StoreArtBasket.asp"	
	//}
}


function loggInMemberSpecial(pageLocation){  //<------------------------------------ Denna gäller i ver 2.0
	var txtMemberID = document.getElementById("txtMemberID_INLOGG").value
	var txtMemberPW = document.getElementById("txtMemberPW_INLOGG").value
	var url="StoreLoggCheck.asp?txtMemberID=" + txtMemberID + "&txtMemberPW=" + txtMemberPW + "&pageLocation=" + pageLocation;
	window.location.href = url;
}


function checkInloggBasket(fromFlag){  //<------------------------------------ Tar bort denna i ver 2.0
	var txtMemberID = document.getElementById("txtMemberID").value
	var txtMemberPW = document.getElementById("txtMemberPW").value
	if (fromFlag=="col"){ 
		tmpTarget = "inloggFrm";
	}
	else
	{
		tmpTarget = "LoggIn";
	}
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_inLoggCheck.asp?txtMemberID=" + txtMemberID + "&txtMemberPW=" + txtMemberPW + "&fromFlag=" + fromFlag;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// ================================================== ACTIONS

function NOvalidate(){;
	alert("Markera att ni läst Protection Gears köpvillkor först");
	//document.MyBasket.submit();
}

function NOprod(){
	alert("Det måste finnas en artikel i korgen först.");
	document.getElementById("blnConfirmTerms").checked=false;
}

function noenter() {
  return !(window.event && window.event.keyCode == 13); 
  }
  
function enterKey(dir) {
 if (window.event && window.event.keyCode == 13){
	loggInMember(dir)
 } 
  }


function blnConfirmTerms(){ 
	document.getElementById("btnRegisterContainer").innerHTML = "&nbsp;&nbsp;&nbsp;<input name='btnRegister' type='button' class='textsmall' id='btnRegister' value='BEKR&Auml;FTA ORDER' onClick='javascript:validate();' />"
}

function validate(){
	// Check if there is someone logged in
	//if (document.getElementById("storeBasketINLOGGHeadline").innerHTML=="Dina uppgifter" || document.getElementById("storeBasketINLOGGHeadline").innerHTML=="Dina uppgifter "){
	if (document.getElementById("inloggConfirmed").value==1){
		document.MyBasket.submit();
	}
	else
	{
		alert("Du måste logga in på ett konto innan du bekräftar ordern");			
	}
}


function showMyInfo(CustomerID){ 
	tmpTarget = "LoggIn";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_inLoggCheck.asp?f=showInfo&CustomerID=" + CustomerID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function hideMyInfo(txtCustName,CustomerID){ 
	strContent = "<div id='storeBasketINLOGGHeadline'>Dina uppgifter</div>"
	strContent = strContent + "Inloggad som <strong>" + txtCustName + "</strong>  [<a href='javascript:showMyInfo(" + CustomerID + ")'>Visa mina uppgifter</a>]"
	document.getElementById("LoggIn").innerHTML = strContent;
}


function updateFieldCustomer(CustomerID,FieldID,FieldName,ChangeToValue){ 
	tmpTarget = FieldID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="http://www.protectiongear.se/adm/updateCust.asp?CustomerID=" + CustomerID + "&FieldName=" + FieldName + "&ChangeToValue=" + ChangeToValue;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

//----------------------------------
// Forgot password
//----------------------------------
function forgotPW(){
	tmpTarget = "LoggIn";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_forgotPW.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

//----------------------------------
// Send password
//----------------------------------
function sendPW(){
	var txtCustEmail = document.getElementById("txtCustEmail").value
	tmpTarget = "LoggIn";
	xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_sendPW.asp?txtCustEmail=" + txtCustEmail;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// ================================================== ADMIN

function changeNews(idValue){
	if (idValue==1){
		document.getElementById("blnNews_1").checked = true;
		document.getElementById("blnNews_2").checked = false;
		
		document.getElementById("choosenArticles").innerHTML="&nbsp;";
		
		
		tmpTarget = "newsAction";
		xmlHttp=GetXmlHttpObject() 
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="updateNews.asp?ChangeToValue=1";
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
		}
	if (idValue==2){
		document.getElementById("blnNews_1").checked = false;
		document.getElementById("blnNews_2").checked = true;
		
		document.getElementById("choosenArticles").innerHTML="Utvlada artiklar"
		
		tmpTarget = "newsAction";
		xmlHttp=GetXmlHttpObject() 
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="updateNews.asp?ChangeToValue=2";
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=updatedTarget;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		}
	}

function open_win(url_add,w,h)
   {
   window.open(url_add,'admin','width=' + w + ',height=' + h + ',menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');
   }
   
function CheckInlogg(){
	var goFlag = false;
	var url = "start.asp"
	if (document.getElementById("txtPW").value=="admin123"){
	location.href=url;
	goFlag = true;
	}
	if (document.getElementById("txtPW").value=="ADMIN123"){
	location.href=url;
	goFlag = true;
	}
	if (document.getElementById("txtPW").value=="Admin123"){
	location.href=url;
	goFlag = true;
	}
	if (document.getElementById("txtPW").value=="aDMIN123"){
	location.href=url;
	goFlag = true;
	}
	if (goFlag == false){
		var strContent = "<span class='textRed'>Felaktigt lösen, vänligen försök igen.</span>"
		document.getElementById("errMess").innerHTML = strContent;
		//document.getElementById("txtPW").focus();
	}
	
}


function updateTotStock(fieldID,PaintTarget,FieldName,ChangeToValue){ 
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="updateTotStock.asp?fieldID=" + fieldID + "&FieldName=" + FieldName + "&ChangeToValue=" + ChangeToValue;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function admFilterCat(CatID){
	location.href="article.asp?f=filter&CatID=" + CatID + "&f=noShow";
}

function admFilterCatVIP(CatID,CustomerID){
	location.href="article_small.asp?f=filter&CatID=" + CatID + "&CustomerID=" + CustomerID;
}

function admFilterCatPRICE(CatID,CustomerID){
	location.href="articlePrice.asp?f=noShow&CatID=" + CatID + "&CustomerID=" + CustomerID;
}

function admFilterSubCat(){
	var CatID = document.getElementById("filterCat").value;
	var SubCatID = document.getElementById("filterSubCat").value;
	location.href="article.asp?f=filter&CatID=" + CatID + "&SubCatID=" + SubCatID;
}

function admFilterSubCatVIP(SubCatID,CustomerID){
	var CatID = document.getElementById("filterCat").value;
	location.href="article_small.asp?f=filter&CatID=" + CatID + "&SubCatID=" + SubCatID + "&CustomerID=" + CustomerID;
}

function admFilterSubCatPRICE(SubCatID,CustomerID){
	var CatID = document.getElementById("filterCat").value;
	location.href="articlePrice.asp?f=filter&CatID=" + CatID + "&SubCatID=" + SubCatID + "&CustomerID=" + CustomerID;
}



// =========== Admin Kategorier
function addNewCat(){
	tmpTarget = "catAction";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="NewCat.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function chCat(){
	tmpTarget = "catAction";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="chCat.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function addNewSubCat(){
	tmpTarget = "catAction";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="NewSubCat.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function chSubCat(){
	tmpTarget = "catAction";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="chSubCat.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function updateFieldCategory(pos,fieldID,PaintTarget,FieldName,ChangeToValue){ 
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="updateCategory.asp?pos=" + pos + "&fieldID=" + fieldID + "&FieldName=" + FieldName + "&ChangeToValue=" + ChangeToValue;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function updateFieldSubCategory(pos,fieldID,PaintTarget,FieldName,ChangeToValue){ 
	tmpTarget = PaintTarget;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="updateSubCategory.asp?pos=" + pos + "&fieldID=" + fieldID + "&FieldName=" + FieldName + "&ChangeToValue=" + ChangeToValue;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// =========== Article

function newArticle(CatID){ 
if (CatID>0){
var SubCatID = document.getElementById("filterSubCat").value;
}
else
{
SubCatID=0;	
}
tmpTarget = "NewArticle";
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="newArtFrame.asp?CatID=" + CatID + "&SubCatID=" + SubCatID;
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=updatedTarget 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function delArt(ArtID,pageTarget){ 
	tmpTarget = "delCell" + ArtID;
	document.getElementById(tmpTarget).style.backgroundColor="#F00";
	document.getElementById(tmpTarget).innerHTML ="&Auml;r du s&auml;ker?<br><a href='delArt.asp?ArtID=" + ArtID + "&f=productList&pageTarget=" + pageTarget + "'>JA</a>&nbsp;&nbsp;<a href='article.asp'>NEJ</a>";
}


function filterNow(){
	var txtArt = document.getElementById("filterArtName").value;
	var CatID = document.getElementById("filterCat").value;
	var BrandID = document.getElementById("filterBrand").value;
	var SuppID = document.getElementById("filterSupplier").value;
	
	tmpTarget = "filterSubCat";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="filterSubCat.asp?CatID=" + CatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function filterSub(CatID,rowID,ArtID){
	var checkSubCat = document.getElementById("connSubCatID" + rowID).value;
	//alert(checkSubCat)
	tmpTarget = "ContainerSubCatID" + rowID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="filterSubCat.asp?CatID=" + CatID + "&rowID=" + rowID + "&ArtID=" + ArtID + "&checkSubCat=" + checkSubCat;
	//alert(url);
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function addSubCat(connSubCatID,ArtID){
	url="addSubCat.asp?connSubCatID=" + connSubCatID + "&ArtID=" + ArtID;
	location.href=url;
}

function delArtCat(ArtID,artsubcatID){
	url="delArtCat.asp?ArtID=" + ArtID + "&artsubcatID=" + artsubcatID;
	//alert(url);
	location.href=url;
}



function moveSubFocus(target){
	document.getElementById(target).focus();	
}

function closeNewArt(){
	document.getElementById("filterCat").focus();
	document.getElementById("NewArticle").innerHTML="";
}

function showArtText(ArtID){
	document.getElementById("artTextBtn" + ArtID).innerHTML="<A HREF='javascript:void(0)' onClick='hideArtText(" + ArtID + ")'><img src='../images/dblUp.gif' alt='Visa all text' width='15' height='16' border='0' align='absmiddle'></a>";
	tmpTarget = "art" + ArtID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="artTextFrame.asp?connArtID=" + ArtID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showArtCat(connArtID,txtCat,id,name){
	tmpTarget = "artCat" + connArtID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="artCat.asp?connArtID=" + connArtID + "&txtCat=" + txtCat;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showArtVar(connArtID,f,CatID,SubCatID){
	tmpTarget = "artVar" + connArtID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="artVarFrame.asp?connArtID=" + connArtID + "&f=" + f + "&CatID=" + CatID + "&SubCatID=" + SubCatID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function hideArtVar(connArtID,f,CatID,SubCatID,searchArt){
	url="http://www.protectiongear.se/adm/article.asp?connArtID=" + connArtID + "&f=" + f + "&CatID=" + CatID + "&SubCatID=" + SubCatID + "&searchArt=" + searchArt;
	parent.location.href = url;
}

function delArtVar(connArtID){
	alert(connArtID);
	url="http://www.aftonbladet.se"
	//location.href=url;
}

function createSizeGuide(ArtSizeGrpID,connArtID){
	url="artCreateSizeTable.asp?ArtSizeGrpID=" + ArtSizeGrpID + "&connArtID=" + connArtID;
	location.href = url;
}

function updateStockPerSize(ArtStockID,intArtStock,connArtID){
	tmpTarget = ArtStockID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	// Update value in field
	var url="updateVarStock.asp?ArtStockID=" + ArtStockID + "&intArtStock=" + intArtStock + "&connArtID=" + connArtID;
	xmlHttp.onreadystatechange=infoUpdated; 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showArtExtras(ArtID){
	document.getElementById("artImgExtras" + ArtID).innerHTML="<A HREF='javascript:void(0)' onClick='hideArtExtras(" + ArtID + ")'><img src='../images/minus.gif' width='18' height='18' border='0'></A>";
	tmpTarget = "art" + ArtID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="artExtrasFrame.asp?connArtID=" + ArtID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function hideArtExtras(ArtID){
	document.getElementById("artImgExtras" + ArtID).innerHTML="<A HREF='javascript:void(0)' onClick='showArtExtras(" + ArtID + ")'><img src='../images/plus.gif' width='18' height='18' border='0'></A>";
	document.getElementById("art" + ArtID).innerHTML="";
}


function hideArtText(ArtID){
	document.getElementById("artTextBtn" + ArtID).innerHTML="<A HREF='javascript:void(0)' onClick='showArtText(" + ArtID + ")'><img src='../images/dblDown.gif' alt='Visa all text' width='15' height='16' border='0' align='absmiddle'></a>";
	document.getElementById("art" + ArtID).innerHTML="";
}
	

function showArtImage(ArtID){
	document.getElementById("artImgBtn" + ArtID).innerHTML="<A HREF='javascript:void(0)' onClick='hideArtImage(" + ArtID + ")'><img src='../images/minus.gif' width='18' height='18' border='0'></A>";
	tmpTarget = "art" + ArtID;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="uploadPictFrame.asp?connArtID=" + ArtID;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function hideArtImage(ArtID){
	document.getElementById("artImgBtn" + ArtID).innerHTML="<A HREF='javascript:void(0)' onClick='showArtImage(" + ArtID + ")'><img src='../images/plus.gif' width='18' height='18' border='0'></A>";
	document.getElementById("art" + ArtID).innerHTML="";
}

		
// =========== Navigering från kategorier i affären

menu_status = new Array(); 

function showHide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}


function StorePage(CatID,SubCatID,txtCat,txtSubCat){
	var url="/store/store_page.asp?CatID=" + CatID + "&txtCat=" + txtCat + "&SubCatID=" + SubCatID + "&txtSubCat=" + txtSubCat;
	location.href=url;
}


// =========== Inloggning

function CheckInlogg(txtPW){
	url="goLoggInThen.asp?txtPW=" + txtPW;
	window.document.location.href=url;
}

// =========== Navigation

function pageStoreNews(){
	var url="http://www.protectiongear.se/store/store_news.asp?f=null";
	location.href=url;
}

// Ersätter pageStoreNews ovan i version 2.0

function StoreNews(){
	var url="StoreNews.asp?f=null";
	window.location.href=url;
}

function takeMeHome(){ 
	var url="http://www.protectiongear.se/index.asp";
	location.href=url;
}

function goVIP(){ 
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/index.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function homeVIP(){
	window.location.href = "VIP_area.asp"
}

function goVIP_history(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/myHistory.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goVIP_template(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/myTemplate.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goVIP_saveList(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/myListToSave.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goVIP_fetchList(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/myListFetch.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goVIP_topten(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/myTopTen.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goVIP_myinfo(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/myInfo.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function goVIP_offer(){
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/store_offer.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}		

function goVIP_logOut(){
	document.getElementById("inloggVIP").innerHTML="<a href='javascript:goVIP();'>Inloggning avtalskunden</a>";
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/logOut.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function whantsToBeVIP(){ 
	tmpTarget = "pageStore";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/store/vip/whantToBeVIP.asp?f=null";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function mSale(){ 
	var url="http://www.protectiongear.se/store/store_offer.asp?f=null";
	location.href=url;
}

// ERSÄTTER mSale ovan i version 2!!
function mOffer(){ 
	var url="StoreArtOffer.asp?f=null";
	location.href=url;
}


// =========== Mall

function demo(variabelA,variabelB){ 
	tmpTarget = VadSomSkaUppdateras;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="sida.asp?variabelA=" + variabelA + "&variabelB=" + variabelB + "";
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=updatedTarget 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// =========== Funktioner för uppdatering


function noConfirmation() 
{ 
//	Nothing
}


function updatedConfirm() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	// Update value in field
	//document.getElementById(tmpTarget).style.borderWidth = "2px"
	//document.getElementById(tmpTarget).style.borderStyle = "solid"
	//document.getElementById(tmpTarget).style.borderColor = "#00cc00"
 } 
}

function confirmAddToBasket() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	// Update value in field
	//document.getElementById(tmpTarget).style.borderWidth = "2px"
	//document.getElementById(tmpTarget).style.borderStyle = "solid"
	//document.getElementById(tmpTarget).style.borderColor = "#00cc00"
 } 
}

function infoUpdated() 
{ 
	document.getElementById(tmpTarget).style.borderWidth = "2px"
	document.getElementById(tmpTarget).style.borderStyle = "solid"
	document.getElementById(tmpTarget).style.borderColor = "#00cc00"

}

function redFrame() 
{ 
	document.getElementById(tmpTarget).style.borderWidth = "2px"
	document.getElementById(tmpTarget).style.borderStyle = "solid"
	document.getElementById(tmpTarget).style.borderColor = "#ff0000"

}

function MarkRed(targetID) 
{ 
	document.getElementById(targetID).style.borderWidth = "2px"
	document.getElementById(targetID).style.borderStyle = "solid"
	document.getElementById(targetID).style.borderColor = "#ff0000"

}


function updatedTarget() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById(tmpTarget).innerHTML=xmlHttp.responseText;
}
}

function parentUpdatedTarget() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById(parent.document.tmpTarget).innerHTML=xmlHttp.responseText;
}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


// ================================================== STRING FUNCTIONS

function Left(str, n)
        /***
                IN: str - the string we are LEFTing
                    n - the number of characters we want to return

                RETVAL: n characters from the left side of the string
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                        return "";
                else if (n > String(str).length)   // Invalid bound, return
                        return str;                // entire string
                else // Valid bound, return appropriate substring
                        return String(str).substring(0,n);
        }
		

function Mid(str, start, len)
        /***
                IN: str - the string we are LEFTing
                    start - our string's starting position (0 based!!)
                    len - how many characters from start we want to get

                RETVAL: The substring from start to start+len
        ***/
        {
                // Make sure start and len are within proper bounds
                if (start < 0 || len < 0) return "";

                var iEnd, iLen = String(str).length;
                if (start + len > iLen)
                        iEnd = iLen;
                else
                        iEnd = start + len;

                return String(str).substring(start,iEnd);
        }


// Keep in mind that strings in JavaScript are zero-based, so if you ask
// for Mid("Hello",1,1), you will get "e", not "H".  To get "H", you would
// simply type in Mid("Hello",0,1)

// You can alter the above function so that the string is one-based.  Just
// check to make sure start is not <= 0, alter the iEnd = start + len to
// iEnd = (start - 1) + len, and in your final return statement, just
// return ...substring(start-1,iEnd)


function Right(str, n)
        /***
                IN: str - the string we are RIGHTing
                    n - the number of characters we want to return

                RETVAL: n characters from the right side of the string
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                   return "";
                else if (n > String(str).length)   // Invalid bound, return
                   return str;                     // entire string
                else { // Valid bound, return appropriate substring
                   var iLen = String(str).length;
                   return String(str).substring(iLen, iLen - n);
                }
        }
		
		
// ================================================== FÖR SENARE BEHOV

var count1 = 0;
var count2 = 0;

function insertOptionBefore(num)
{
  var elSel = document.getElementById('selectX');
  if (elSel.selectedIndex >= 0) {
    var elOptNew = document.createElement('option');
    elOptNew.text = 'Insert' + num;
    elOptNew.value = 'insert' + num;
    var elOptOld = elSel.options[elSel.selectedIndex];  
    try {
      elSel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
    }
    catch(ex) {
      elSel.add(elOptNew, elSel.selectedIndex); // IE only
    }
  }
}

function removeOptionSelected()
{
  var elSel = document.getElementById('selectX');
  var i;
  for (i = elSel.length - 1; i>=0; i--) {
    if (elSel.options[i].selected) {
      elSel.remove(i);
    }
  }
}

function appendOptionLast(num)
{
  var elOptNew = document.createElement('option');
  elOptNew.text = 'Append' + num;
  elOptNew.value = 'append' + num;
  var elSel = document.getElementById('selectX');

  try {
    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
  }
  catch(ex) {
    elSel.add(elOptNew); // IE only
  }
}

function removeOptionLast()
{
  var elSel = document.getElementById('selectX');
  if (elSel.length > 0)
  {
    elSel.remove(elSel.length - 1);
  }
}
