﻿<!--
var unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~";
var reserved = "!*'();:@&=+$,/?%#[]";
var allowed = unreserved + reserved;
var hexchars = "0123456789ABCDEFabcdef";

function gethex(decimal) {
  return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);
  }


function URLEncode(url) {
  var decoded = url;
  var encoded = "";

  // ---------------- If ASCII character encoding was chosen: ----------------

     for (var i = 0; i < decoded.length; i++ ) {
      var ch = decoded.charAt(i);
      // Check if character is an unreserved character:
	//alert(encoded);
      if (unreserved.indexOf(ch) != -1) {
        encoded = encoded + ch;
      } else {

        // The position in the Unicode table tells us how many bytes are needed.
        // Note that if we talk about first, second, etc. in the following, we are
        // counting from left to right:
        //
        //   Position in   |  Bytes needed   | Binary representation
        //  Unicode table  |   for UTF-8     |       of UTF-8
        // ----------------------------------------------------------
        //     0 -     127 |    1 byte       | 0XXX.XXXX
        //   128 -    2047 |    2 bytes      | 110X.XXXX 10XX.XXXX
        //  2048 -   65535 |    3 bytes      | 1110.XXXX 10XX.XXXX 10XX.XXXX
        // 65536 - 2097151 |    4 bytes      | 1111.0XXX 10XX.XXXX 10XX.XXXX 10XX.XXXX

        var charcode = decoded.charCodeAt(i);

        // Position 0 - 127 is equal to percent-encoding with an ASCII character encoding:
        if (charcode < 128) {
          encoded = encoded + gethex(charcode);
        }

        // Position 128 - 2047: two bytes for UTF-8 character encoding.
        if (charcode > 127 && charcode < 2048) {
          // First UTF byte: Mask the first five bits of charcode with binary 110X.XXXX:
          encoded = encoded + gethex((charcode >> 6) | 0xC0);
          // Second UTF byte: Get last six bits of charcode and mask them with binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 2048 - 65535: three bytes for UTF-8 character encoding.
        if (charcode > 2047 && charcode < 65536) {
          // First UTF byte: Mask the first four bits of charcode with binary 1110.XXXX:
          encoded = encoded + gethex((charcode >> 12) | 0xE0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 65536 - : four bytes for UTF-8 character encoding.
        if (charcode > 65535) {
          // First UTF byte: Mask the first three bits of charcode with binary 1111.0XXX:
          encoded = encoded + gethex((charcode >> 18) | 0xF0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 12) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Fourth UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

      }

    }  // end of for ...

    // Write result:
return encoded;
}; 


  
function show_hide_info(menu,bild){
	if (menu.style.display =='none') {
	 	menu.style.display='';
	 	bild.src='/trading-advertise-free-advertising/images/mini_icons/minus.jpg';}
	 	else{
	 	 menu.style.display='none';
	 	 bild.src='/trading-advertise-free-advertising/images/mini_icons/plus.jpg';}
}

function visatabortprodukt(page) {
props1=window.open(page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=250, height=80, left = 400, top = 400');
props1.focus();
}

function popup(page,lang) {
if (lang!='') lang='_'+lang;
props2=window.open('/faq/info'+lang+'.htm#'+page, 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=0, width=250, height=300 left = 100, top = 100');
props2.focus();
}

function visabild(bild) {
props3=window.open('/annonsera/skapa_produkt/visabild.asp?bild='+bild, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=500, height=370 left = 100, top = 100');
props3.focus();


}
function visabild2(bild) {
props4=window.open(bild, 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=800, height=600, left = 0, top = 0');
props4.focus();
}
function koptest(produktid,sessionid,sort1id,objid){
location.href="http://www.stenverkstad.com/produkter/produktlista.asp?menu=kop&produktid=" + produktid + "&sessionid=" +sessionid + "&sort1id=" + sort1id +"&antal="+objid.value;
}

function visakop(page) {
props5=window.open('produktlista_en_window.asp?menu=kop&produktid='+page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=210 left = 100, top = 100');
props5.focus();
}

function visa_slideshow(page) {
props6=window.open(page, 'poppage', 'toolbars=0, toolbar=0, scrollbars=0, scrollbar=0, location=0, statusbars=0, menubars=0, menubar=0, resizable=0, fullscreen=1, width=' + document.body.clientWidth +', height=' + document.body.clientHeight + ' left = 0, top = 0');
props6.focus();
}


function visaen(page) {
props7=window.open(page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=650, height=210, left = 100, top = 100');
props7.focus();
}

function visaupload(page) {
props8=window.open(page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=600, height=210, left = 100, top = 100');
props8.focus();
}

function visaradera(page) {
props9=window.open(page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=600, height=210, left = 100, top = 100');
props9.focus();
}

function visaredigera(page) {
props10=window.open(page, 'poppage',' toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=500, height=600, left = 100, top = 100');
props10.focus();
}

function visaskapa(page) {
props11=window.open(page, 'poppage',' toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=0, width=100, height=400, left = 710, top = 250');
props11.focus();
}

function visatabortbild(page) {
props12=window.open(page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=500, height=400, left = 100, top = 100');
props12.focus();
}

function visa_mina_bilder(page) {
props13=window.open(page, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=750, height=500, left = 0, top = 0');
props13.focus();
}

function kop(produktid,sessionid,sort1id,objid,status){

visakop(produktid + '&sessionid=' +sessionid + '&sort1id=' + sort1id +'&antal='+objid.value+'&status='+status);

}


var needToConfirm = true;
  
//window.onbeforeunload = confirmExit;
//window.onbeforeunload = confirmExit;
function confirmExit(){

    if (needToConfirm)
    //alert('hej');
    	document.getElementById('hidepage').style.visibility = 'visible';		
   }

function loadImages2() {
document.getElementById('hidepage').style.visibility = 'visible';
}

function loadImages() {
//if (document.getElementById('hidepage').style.visibility!="hidden"){

	if (document.getElementById) {  // DOM3 = IE5, NS6
	document.getElementById('hidepage').style.visibility = 'hidden';
	}
	else {
	if (document.layers) {  // Netscape 4
	document.hidepage.visibility = 'hidden';
	}
	else {  // IE 4
	document.all.hidepage.style.visibility = 'hidden';
	      }
	   }
	}
//}

function P7_ExpMenu(GetUlId){ 
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 
 var i,k,g,lg,r=/\s*p7hvr/,nn='',c,cs='p7hvr',bv=GetUlId;
 
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);
 if(g){ 
 	lg=g.getElementsByTagName("LI");
 	if(lg){for(k=0;k<lg.length;k++){
 	lg[k].onmouseover=function(){
 		c=this.className;cl=(c)?c+' '+cs:cs;
 		this.className=cl;};lg[k].onmouseout=function()
 		{c=this.className;
 		this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;
 		}
}

//-->


