function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:pointer;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}
window.attachEvent("onload", correctPNG);



function validate_mail() {
  if (document.shoutout.svar.value == document.shoutout.validering.value) { 
    document.shoutout.submit();
  }
} 


function validate_comment(svar) {
  if ((document.comment.svar.value*document.comment.svar.value) == document.comment.val.value) {
  	if (document.comment.kommentarstext.value == "Skriv din kommentar här..")
  		alert('Var vänlig skriv en kommentar.');
  	else
		document.comment.submit();
  }
  else
  	alert('Fel säkerhetskod, försök igen.');
} 
 

function rabattkod(kod_id,koden,kod_url) {
  if (document.getElementById(kod_id).innerHTML != koden)
    {
  	document.getElementById(kod_id).innerHTML = koden;
  	window.open(kod_url, 'rabatterat', 'width=800,height=600,status=1,menubar=1,scrollbars=1,resizable=1,left=300,top=100');
  	}
  else 
    {
    window.open(kod_url);
    }
}


function changeClass(logo_id) {
	document.getElementById(logo_id).setAttribute("class", "shoplogo rounded rotatelogo");
}
