function checkCompetitionForm(oForm){
	var oForm = document.forms["competitionForm"]
	if(!oForm.competValue[0].checked&&!oForm.competValue[1].checked&&!oForm.competValue[2].checked){
		alert(competitionError)
		return false
	}
	return checkMail(oForm.competEmail.value, oForm.competEmail)
}

function checkContactForm(oForm){
	var oForm = document.forms["contactForm"]
	return checkMail(oForm.Email.value, oForm.Email)
}

function convertValue(sValue, isEscape){
	var strValue = (isEscape)? escape(sValue):sValue;
	var sRep = /%0D%0A/gi;
	strValue = strValue.replace(sRep,"%20");
	if(strValue.slice(-3)=="%20") strValue = strValue.substring(0,(strValue.length-3))
	strValue = unescape(strValue);
	if(strValue=="<P>&nbsp;</P>") strValue = "";
	return strValue		
}

function checkBloggForm(oForm){
	var oForm = document.forms["bloggForm"];
	oForm.Beskrivning.value = convertValue(oForm.Beskrivning.value,true)	
	return checkMail(oForm.Email.value, oForm.Email)
}
function checkShowForm(){
	var oForm = document.forms["showForm"]
	return checkMail(oForm.Email.value, oForm.Email)
}

function checkNextShowForm(){
	var oForm = document.forms["nextShowForm"]
	return checkMail(oForm.Email.value, oForm.Email)
}

function checkTipsForm(){
	var oForm = document.forms["tipsForm"]
	if(checkMail(oForm.receiverEmail.value, oForm.receiverEmail)){
		return checkMail(oForm.senderEmail.value, oForm.senderEmail)
	}
	else return false
}
function setTipsFn(){
	var oForm = document.forms["productForm"]
	if(oForm.senderName.value==""){
		alert(alertTips1);
		oForm.senderName.focus()
		return false;
	} 
	if(oForm.senderEmail.value==""){
		alert(alertTips2);
		oForm.senderEmail.focus()
		return false;
	} 
	else{
		if(!checkMail(oForm.senderEmail.value, oForm.senderEmail)){
			oForm.senderEmail.focus()
			return false;			
		}
	}
	if(oForm.receiverEmail.value==""){
		alert(alertTips3);
		oForm.receiverEmail.focus()
		return false;
	} 
	else{
		if(!checkMail(oForm.receiverEmail.value, oForm.receiverEmail)){
			oForm.receiverEmail.focus()
			return false;			
		}
	}	
	oForm.sCase.value = "Tips";
	oForm.ProductAmount.value = 0;
	oForm.IfRefresh.value = 0;
	oForm.submit();
}

function showhideRow(iID){
	var cRow = document.getElementById("row"+iID)
	var cSpan = document.getElementById("span"+iID)
	if(cSpan){
		if(cSpan.style.display=="none"){
			cSpan.style.display="block";
			cSpan.style.visibility = "visible";
			cRow.style.paddingBottom = 2;
		}
		else{
			cSpan.style.display="none";
			cSpan.style.visibility = "hidden";
			cRow.style.paddingBottom = 0;
		}
	}
}

function showRow(iID){
	var numargs = arguments.length
	for(i=0;i<numargs;i++){ 
		var cRow = document.getElementById("row"+arguments[i])
		var cSpan = document.getElementById("span"+arguments[i])
		if(cSpan){
			cSpan.style.display="block";
			cSpan.style.visibility = "visible";
			cRow.style.paddingBottom = 2;
		}
	}
}

function checkMaillistForm(sInputValue){
	if(document.forms['maillistForm'].MemberName.value ==""){
		alert(noNameML);
		return false;
	}
	else{
		document.forms['maillistForm'].SubmitMode.value = (document.forms['maillistForm'].Status[0].checked)? "create":"delete"
		var myRe = /[a-z0-9_.=-]+@([a-z0-9-]+\.)+([a-z]{2,3})/i;
		if (!(sInputValue).match(myRe))	{
			alert(emailErrorML)
			return false
		}
		else {
			return true
		}
	}
}		

function checkMail(sInputValue,oFormField){
	var myRe = /[a-z0-9_.=-]+@([a-z0-9-]+\.)+([a-z]{2,3})/i;
	if (!(sInputValue).match(myRe))	{
		alert(emailErrorML)
		oFormField.focus()
		return false
	}
	else {
		return true
	}
}

function addBookmark(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}
function showProductInWindow(iID){
	var sUrl = hostPath+"/web/article.asp?artID="+iID;
	var win = window.open(sUrl,'prodWin','width=740,height=675,resizable=yes,scrollbars=1')
}

function imgAnimation(sCase, iImg, tImg ){
	cDiv = document.getElementById("imgSRC"+sCase);
	if(cDiv!=null){
		if(is.ie) cDiv.filters[0].Apply();  
		for(i=0;i<3;i++) document.getElementById("imgSRC"+sCase+"Index"+i).style.display = "none";                 
		document.getElementById("imgSRC"+sCase+"Index"+iImg).style.display = "block";
		if(is.ie) cDiv.filters[0].Play();
		if (iImg == tImg) oImg = 0;
		else oImg = iImg+1;
		setTimeout('imgAnimation("'+sCase+'", '+oImg+','+tImg+')',10000);			
	}
}

function imgAnimation2(sID, iImg, tImg ){
	cDiv = document.getElementById(sID);
	if(cDiv!=null){
		if(is.ie) cDiv.filters[0].Apply();  
		cDiv.style.backgroundImage = "url(media/site/startImg"+iImg+".jpg)";                 
		if(is.ie) cDiv.filters[0].Play();
		if (iImg == tImg) oImg = 1;
		else oImg = iImg+1;
		setTimeout('imgAnimation2("'+sID+'", '+oImg+','+tImg+')',10000);			
	}
}

function submitCurrencyForm(oCurrencyForm,iValue){
	oCurrencyForm.currencyIndex.value = iValue;
	oCurrencyForm.submit();
}