function openPopUp(){
	fonster=window.open ("smpage.fwx?page=92","","toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,status=no,resizeable=no,width=300,height=220,top=10,left=10");
	fonster.focus()
}

function validateForm() {
	var frm = document.getElementById("orderForm");
	if(!frm){
		return;
	}

	if( !checkField(frm, "namn" ) ||
		!checkField(frm, "gatuadress" ) ||
		!checkField(frm, "postnr" ) ||
		!checkField(frm, "postadress" ) ||
		!checkField(frm, "tel" ) ||
		!checkField(frm, "epost" ) ) {
		return;	
	}
	frm.submit();
}
function checkField(frm, el) {
	if( eval("frm."+el+".value == ''" ) ) {
		eval("frm."+el+".focus();");
		alert("F¤ltet m¥ste fyllas i")
		return 0;
	}
	return 1;
}

function validEmail(cMail){
	var r = new RegExp("^.+\\@.+\\..{2,3}$");
	if (!r.test(cMail)){
		return false;
	}
	
	return true;
}

function print(cContentId){
  var oDiv = document.getElementById(cContentId);
  if(!oDiv){
  	return false;
  }
  
	var cTpl = '';
	cTpl += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
	cTpl += '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">';
	cTpl += '<head>';
	cTpl += '<title>Print</title>';
	cTpl += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
	cTpl += '<link rel="stylesheet" type="text/css" href="at.css" />';
	cTpl += '</head>';
	
	cTpl += '<body style="background-color:#FFFFFF;margin:0;padding:0;">';
	cTpl += '<div style="width:788px;">';
	
	cTpl += '<div style="padding: 0px 10px 0px 10px;">';
	cTpl += '<img src="images/site_related/printHeader.gif" border="0"/>';
	cTpl += '<div style="padding-bottom: 30px;">';
	cTpl += oDiv.innerHTML;
	cTpl += '</div>	';
	cTpl += '</div>';
	cTpl += '</div>';
	cTpl += '<sc' + 'ript>';
//	cTpl += 'var oPrint = document.getElementById("printAndTip");';
//	cTpl += 'if(oPrint){';
//	cTpl += 'oPrint.style.display = "none";';
//	cTpl += '}';
	cTpl += 'window.print();';
	cTpl += '</scr' + 'ipt>';
	cTpl += '</body>';
	cTpl += '</html>';
  
  prt=window.open('','','scrollbars=yes');
  prt.document.open();
  prt.document.writeln(cTpl);
  prt.document.writeln();
  prt.document.close();
  return false;

}

function tipFriend(){
	var cUrl = 'smpage.fwx?page=102&tipsaurl=' + getTipsaUrl();
	window.open(cUrl,'','width=260,height=379, scrollbars=no');
	return false;
}

function getTipsaUrl(){
var myUrl = document.location.href;

myUrl = myUrl.replace(new RegExp(/&/g), "XXX"); 
myUrl = myUrl.replace(new RegExp(/=/g), "YXY"); 
myUrl = myUrl.replace(new RegExp(/#/g), ""); 

return myUrl;
}

var nDefaultIdx = 0;
var cDivId = "mainText";
var cDivId2 = "mainText2";

var arFnClass =new Array();
arFnClass[0] = "fnSize1";
arFnClass[1] = "fnSize2";
arFnClass[2] = "fnSize3";

function fnDescreaseFont()
{
	var oIndex = fngetSelIndex();
	oIndex--;
	if(oIndex>=0 && oIndex<arFnClass.length)
	{
		var oDiv = document.getElementById(cDivId);
		if(oDiv)
		{
			oDiv.className = arFnClass[oIndex];
		}
		var oDiv2 = document.getElementById(cDivId2);
		if(oDiv2)
		{
			oDiv2.className = arFnClass[oIndex];
		}
	}
	return;
}

function fnIncreaseFont()
{
	var oIndex = fngetSelIndex();
	oIndex++;
	if(oIndex>=0 && oIndex<arFnClass.length)
	{
		var oDiv = document.getElementById(cDivId);
		if(oDiv)
		{
			oDiv.className = arFnClass[oIndex];
		}
		var oDiv2 = document.getElementById(cDivId2);
		if(oDiv2)
		{
			oDiv2.className = arFnClass[oIndex];
		}
	}
	return;
}

function fngetSelIndex()
{
	var oDiv = document.getElementById(cDivId);
	var cClassName;
	if(!oDiv)
	{
		return;
	}

	cClassName = oDiv.className;
	if(cClassName=='undefined' || cClassName=='')
	{
		return nDefaultIdx;
	}

	for(var i=0; i<arFnClass.length; i++)
	{
		if(arFnClass[i] == cClassName)
		{
			return i;
		}
	}
	return nDefaultIdx;
}
