﻿

<!--
function BuildFlash(path, w, h, bkg, vars, name, live) {
var str;
if (path!='') str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"  WIDTH="'+ w +'" HEIGHT="'+ h +'" id="'+ name +'" ALIGN="">' +
 '<param name="movie" value="'+ path +'"><param name="quality" value="high"><param name="bgcolor" value="'+ bkg +'"><param name="menu" value="false">' +
 '<param name="flashvars" value="' + vars + '">' +
 '<param name="wmode" value="transparent">' +
 '<EMBED src="'+ path +'" FlashVars="' + vars + '" wmode="transparent" quality="high" bgcolor="'+ bkg +'" WIDTH="'+ w +'" HEIGHT="'+ h +'" NAME="'+ name +'" swLiveConnect='+ live +' ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>' +
 '</object>' ;
//  return str;
 document.write(str);
}



function BuildFlash2(path, w, h, bkg, vars, name, live) {
var str;
e = canResizeFlash();

if (path!='') str = '<div id="' + name + '" style="width:' + w + 'px; height:' + h + 'px;">' + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"  WIDTH="100%" HEIGHT="100%" id="'+ name +'_swf" ALIGN="">' +
 '<param name="movie" value="'+ path +'"><param name="quality" value="high"><param name="bgcolor" value="'+ bkg +'"><param name="menu" value="false">' +
 '<param name="flashvars" value="&allowResize='+e + vars + '">' +
 '<EMBED src="'+ path +'" FlashVars="&allowResize='+e + vars + '" quality="high" bgcolor="'+ bkg +'" WIDTH="100%" HEIGHT="100%" NAME="'+ name +'_swf" swLiveConnect='+ live +' ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>' +
 '</object></div>' ;
 return str;
// document.write(str);
}

function init() {
    var obj = document.getElementById('tabsDiv');
    if ((obj != null) && swfstring)
        obj.innerHTML = swfstring;
}

function escapeURI(str) {
  str = str.replace(/=/g, '%3D'); 
  str = str.replace(/&/g, '%26');
  str = str.replace(/"/g, '%22');
  return str;
}
function test() {
  alert('test');
}
function getQuerryStringByName(name){
  url = new String(window.location);
  var xx=String(document.location.search);
  str_tmp = url.split("?");
  
  if( str_tmp.length < 2 ) return "";
  querry = str_tmp[1];
  
  if (xx.match(/%20\w+=/)) // haszcz
  { 
    element = querry.split(escape("&"));
  }
  else // bez haszcza
  {
    element = querry.split("&");
  }  
  i=0;
  while(i<element.length){
      e = element[i];
      _item =  e.split("=");
      if(_item[0] == name){
        return _item[1];
      }
      i++;
  }
  return "";
}

function okno(nazwa,szer,wys)
{
window.open(nazwa,'','toolbar=no,scrollbars=yes,resizable=no,status=no,location=no,directories=no,width='+eval(szer)+',height='+eval(wys)+',menubar=no')
}

function switch_mode(name) {
   if (document.getElementById(name).style.display == "none") {
       document.getElementById(name).style.display = "block";
       document.getElementById(name + "_img").src = "/_images/sku_strzalka_dol.gif";
   } else {
       document.getElementById(name).style.display = "none";
       document.getElementById(name + "_img").src = "/_images/sku_strzalka_prawo.gif";
   }
}

function setFlashWidth(divid, newW){
 document.getElementById(divid).style.width = newW+"px";
 document.getElementById(divid + "_swf").style.width = newW+"px";
}

function setFlashHeight(divid, newH){
 document.getElementById(divid).style.height = newH+"px";
 document.getElementById(divid + "_swf").style.height = newH+"px";
}

function setFlashSize(divid, newW, newH){
 setFlashWidth(divid, newW);
 setFlashHeight(divid, newH);
}

function canResizeFlash(){
 var ua = navigator.userAgent.toLowerCase();
 var opera = ua.indexOf("opera");
 if( document.getElementById ){
  if(opera == -1) return true;
  else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
 }
 return false;
}

function createOption(str) {
    var re = /<a href=['"](.*)['"]>(.*)<\/a>/;
    var a = re.exec(str);
    return '<option value="'+a[1]+'">'+a[2]+'</option>\n';
}

/* cookie function set */

var today = new Date();
var expiry = new Date(today.getTime() + 31536000000);
function getCookieVal(offset) {
 var endstr = document.cookie.indexOf(";",offset);
 if (endstr == -1) endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset,endstr));
}
function getCookie(name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i,j) == arg) {
      return getCookieVal(j);
  }
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break;
 }
 return null;
}
function delCookie(name,path,domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
function setCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure="+ secure : "");
}

function animateSWF() {
 var c = getCookie('kolo_main');
 if ((c == null) || (c == 1)) {
  setCookie('kolo_main','0','','','','');
  return '1';
 }
 return c;
}

/* /cookie function set */

/* multiple select function set */
function addOption(obj, desc, value) {
 var l = obj.options.length;
 obj.options[l++] = new Option(desc, value);
}
function clearOptions(obj) {
 var l = obj.options.length;
 while (l >= 0) {
  obj.options[l--] = null;
 }
}
function fillAssortSelect() {
 var val = brandObj.options[brandObj.selectedIndex].value;
 var re = /<a href=['"](.*)['"]>(.*)<\/a>/;
 clearOptions(assortObj);
 assortObj.disabled = true;
 if (val != "") {
  assortObj.disabled = false;
  addOption(assortObj, 'Válasszon Termékcsalád', '');
  for (i = 0; i < assocArr[val].length; i++) {
   var a = re.exec(assocArr[val][i]);
   addOption(assortObj,a[2],a[1]);
  }
 }
}
function go2Assort() {
 var val = assortObj.options[assortObj.selectedIndex].value;
 if (val != "") document.location.href = val;
}

function fillBrandSel() {
 idx = assortObj[assortObj.selectedIndex].value;
 if (idx != "") {
  clearOptions(brandObj);
  addOption(brandObj, 'Válasszon márkát', '');
  
  for (i = 0; i < brandArr.length; i++) 
   for (j = 0; j < brandArr[i][2].length; j++) 
    if (brandArr[i][2][j] == idx) 
     addOption(brandObj, brandArr[i][1], brandArr[i][0]);
  
  brandObj.disabled = false;
 } else {
  clearOptions(brandObj);
  brandObj.disabled = true;
 }
}

function go2Brand() {
 var re = /<a href=['"](.*)['"]>(.*)<\/a>/;
 idx1 = brandObj[brandObj.selectedIndex].value;
 idx2 = assortObj[assortObj.selectedIndex].value;
 if ((idx1 != "") && (idx2 != ""))
  for (i = 0; i < brandArr[idx1][2].length; i++)
   if (brandArr[idx1][2][i] == idx2) {
    var a = re.exec(brandArr[idx1][3][i]);
    document.location.href = a[1];
   }
}


/* /multiple select function set */

function go2page(objName) {
    var brandArr = new Array('Kolo','Koralle','Keramag','Panda','Albatros');
    var urlPrefix = '';
    for (i in brandArr) {
        var obj = document.getElementById(brandArr[i]);
        if (obj != undefined) {
            urlPrefix = '/' + brandArr[i].toLowerCase() +'/';
            break;
        }
    }

    var obj = document.getElementById(objName);
    var v = obj.options[obj.selectedIndex].value;
    if (v != "") document.location.href = urlPrefix + v;
}

/*
function go2page(objName) {
    var obj = document.getElementById(objName);
    var v = obj.options[obj.selectedIndex].value;
    if (v != "") document.location.href = v;
}
*/

function add2Favorite() {
    if (document.all) {
        window.external.AddFavorite(location.href, document.title);
    } else
        alert('Funkcja aktywna w jedynie w przeglądarce Microsoft Internet Explorer.');
}

/* forward 2 friend */
function f2f(link) {
    window.open(link,'f2f_sanitec_kolo','width=450,height=415,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no')
}

function valSearch(f){
    if (f.q.value != '') {
        return true;
    } else {
        alert('Wprowadź wyszukiwane słowo.');
        return false;
    }
}

/* pressKit */

var pKitV = false
var pobj = new Array('pressKitLink','sPressKit','pressKit');
function initPressKit() {
    for (i=0; i<2; i++) {
        document.getElementById(pobj[i]).style.display = "block";
    }
}

function showPressKit() {
    if (pKitV == false) {
        document.getElementById(pobj[2]).style.display = "block";
        pKitV = true;
    } else {
        document.getElementById(pobj[2]).style.display = "none";
        pKitV = false;
    }
}

/* /pressKit */
//-->
