/* Developed by EverMedia
JSMASTER
Version 1.03
*/


/*DETECTA PLUGIN DO FLASH */
/* START: GLOBAL VARS */
var flashDir = "/webapp/wcs/stores/EUKDLX/flash/";
/* Default Flash version supported,
Flash Write function can override this if passed a different version as the last argument*/
var flash_ver = 7;

function fDetect() {
	/* detect which version of Flash installed, either  */
	fPlug= (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if (fPlug) {
		fPlug = parseInt(fPlug.description.substring(fPlug.description.indexOf(".")-1));
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && navigator.userAgent.indexOf("Windows")>=0 ) {
		document.writeln('<script language="vbscript" type="text/vbscript">');
		document.writeln('on error resume next');
		document.writeln('fPlug = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+flash_ver+'")))');
		document.writeln('</script>');
		if (fPlug>0) {fPlug=flash_ver;}
	}

	if (fPlug<flash_ver) {
		document.location.href = "laralb.iciwce.com/internas/detect_plugin.shtm"
	}
	//else alert("tem plugin");
}
fDetect();

//escreve o header em flash

function escreveFlash(a,b){
document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flash_ver + '" width="100%" height="98" id="header" >');
document.writeln('	<param name="movie" value="/images/master/header.swf?varMenu=' + a + '&varSub=' + b + ' " />');
document.writeln('	<param name="quality" value="high" />');
document.writeln('	<param name="bgcolor" value="#38A7DD" />');
document.writeln('	<embed src="/images/master/header.swf?varMenu=' + a + '&varSub=' + b + '" quality="high" bgcolor="#38A7DD" width="100%" height="98" name="header" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.writeln('</object>');
}

function escreveFlashhammerite(a,b){
document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flash_ver + '" width="100%" height="98" id="header" >');
document.writeln('	<param name="movie" value="/images/master/header_hamm.swf?varMenu=' + a + '&varSub=' + b + '" />');
document.writeln('	<param name="quality" value="high" />');
document.writeln('	<param name="bgcolor" value="#38A7DD" />');
document.writeln('	<embed src="/images/master/header_hamm.swf?varMenu=' + a + '&varSub=' + b + '" quality="high" bgcolor="#38A7DD"  width="100%" height="98" name="header" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer" />');
document.writeln('</object>');
}

function flash_prod_header (base_url, surface_pic, prod_pic_path, prod_desc) {
	var prod_desc = URLencodeUTF8(prod_desc);

	var flash_url = base_url + '?surfacePicture=' + surface_pic + '&thumbPicturePath=' + prod_pic_path + '&description=' + prod_desc;
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flash_ver + '" width="554" height="140">');
	document.writeln('<param name="movie" value="' + flash_url + '"/>');
	document.writeln('<param name="quality" value="high" /> ');
	document.writeln('<embed src="' + flash_url + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="554" height="140"></embed>');
	document.writeln('</object>');
	}

function flash_wh (url, width, height) {
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flash_ver + '" width="' + width + '" height="' + height + '">');
	document.writeln('<param name="movie" value="' + url + '"/>');
	document.writeln('<param name="quality" value="high" /> ');
	document.writeln('<embed src="' + url + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
	document.writeln('</object>');
	}

function flash_whwm (url, width, height, wmode) {
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flash_ver + '" width="' + width + '" height="' + height + '">');
	document.writeln('<param name="movie" value="' + url + '"/>');
	document.writeln('<param name="quality" value="high" /> ');
	document.writeln('<param name="WMODE" value="' + wmode + '"/>');
	document.writeln('<embed src="' + url + '"  width="' + width + '" height="' + height + '" wmode="' + wmode +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
	document.writeln('</object>');
	}

function flash_ (url) {
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flash_ver + '">');
	document.writeln('<param name="movie" value="' + url + '"/>');
	document.writeln('<param name="quality" value="high" /> ');
	document.writeln('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
	document.writeln('</object>');
	}


// Escreve CSS com a cor
varQual = getCookie('cor');
if (varQual != null) {
	document.writeln('<link type="text/css" rel="stylesheet" href="/css/color' + varQual+ '.css" />');
	}
	else{
	document.writeln('<link type="text/css" rel="stylesheet" href="/css/color1.css" />');
	}


// define cookie
function setCookie(name,value)
{
var o_cookie = value + ";";
document.cookie = "cor="+o_cookie;
}

// recupera cookie
function getCookie(name)
	{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}


//script de sincronização do banner da home 27/09/2005


function thisMovie(movieName) {

  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]

  }	else {
    return document[movieName]
  }
}


function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}



function golabel(flash,label) {
  if (movieIsLoaded(thisMovie(flash))) {
   thisMovie(flash).TGotoLabel("_level0/",label);
   thisMovie(flash).Play()
  }
	else{
	return false;
	}
}



// função de abrir popup (15/11/2006)
function abrePopup(largura,altura,url,scrollbar){
	window.open(url,"Popup","scrollbars="+scrollbar+",width="+largura+",height="+altura+"")
}

function URLEncode(to_encode)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = to_encode;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '"
                        + ch
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
}

function utf8(wide) {
  var c, s;
  var enc = "";
  var i = 0;
  while(i<wide.length) {
    c= wide.charCodeAt(i++);
    // handle UTF-16 surrogates
    if (c>=0xDC00 && c<0xE000) continue;
    if (c>=0xD800 && c<0xDC00) {
      if (i>=wide.length) continue;
      s= wide.charCodeAt(i++);
      if (s<0xDC00 || c>=0xDE00) continue;
      c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
    }
    // output value
    if (c<0x80) enc += String.fromCharCode(c);
    else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
    else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
    else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
  }
  return enc;
}


function toHex(n) {

var hexchars = "0123456789ABCDEF";

  return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF);
}

function URLencodeUTF8(s) {

var okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~*'()";

  var s = utf8(s);
  var c;
  var enc = "";
  for (var i= 0; i<s.length; i++) {
    if (okURIchars.indexOf(s.charAt(i))==-1)
      enc += "%"+toHex(s.charCodeAt(i));
    else
      enc += s.charAt(i);
  }
  return enc;
}




















