//Lic//SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
//END.SWFObject

//potwierdzenie
function confirmSubmit(infotext){
  var agree=confirm(infotext);
  if (agree){
    return true ;
  } else {
    return false ;
  }
}

var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
function fixPNG(myImage) 
{
	if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
	{
		var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
		var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
		var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' ";
		var imgStyle = "display:inline-block;" + myImage.style.cssText;
		var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
		myImage.outerHTML = strNewHTML; 
	}

}



function $(id)
{
	return document.getElementById(id);
}
function $$(id)
{
	return document.getElementById(id).value;
}







function submitForm(_formName, _actionName, _actionValue)
{
  	var actionName = document.getElementById(_actionName) ;
//  	alert(_formName);
  	
  	if(actionName == null)
  	{
  		alert("Error: you have to define hidden action variable") ;
  		return ;
	}
  	actionName.value = _actionValue ;
  	document.forms[_formName].submit() ;
}
var flaga=true;
function parserecord(result){
alert(result);
}
function loginremember()
{
var formlog=$('loginremember');
if(flaga)
{
	formlog.innerHTML='';
	flaga = false;
	formlog.innerHTML='<div id="login"><div class="loginHaslo"><div class="prawy" ><div style="float:left; padding-top: 7px" class="email">email: </div><div style="float:right;" class="inputColor"><input class="styl1" id="loginnameremember" name="loginnameremember" type="text" value="" style="width:127px" /></div></div></div></div><div  class="zaloguj" style="text-align:right"><a href="javascript:dorequest(\'POST\',\'changepassword.php\',\'tekst\',\'parserecord\',\'action=passwordremember&email=\'+$$(\'loginnameremember\'))" class="zaloguj">wyślij<div style="clear:both"></div></a></div><a class="przypomnijHaslo2" href="javascript:loginremember()">powrót do logowania</a>';
}
else
{
	formlog.innerHTML='';
	flaga = true;
//	formlog.innerHTML='aaaa'
	formlog.innerHTML='<div id="login"><div class="loginHaslo"><div class="prawy" ><div style="float:left; padding-top: 7px" class="email">email: </div><div style="float:right;" class="inputColor"><input class="styl1" name="loginName" type="text" value="" style="width:127px" /></div><div style="clear : both"></div><div style="float:left; padding-top: 7px" class="email">hasło: </div><div style="float:right;" class="inputColor1"><input class="styl1" name="loginPasswd" type="password" value="" style="width:127px" /></div></div></div></div><div  class="zaloguj" style="text-align:right"><a href="javascript: submitForm(\'loginForm\', \'actionId\', \'login\')" class="zaloguj">zaloguj</a></div><a class="zalozKonto" href="zalozKonto.php">rejestracja</a><a class="przypomnijHaslo" href="javascript:loginremember()">przypomnij hasło</a>';




}

}


// function changes images on product site
function changeImg(imgObj, imgHref, imgToChange,width,height)
{
  	var mediumPath = "images/products/medium/" ;
  	var normalnPath = "images/products/" ;
  	var img = document.getElementById(imgObj) ;
  	img.src = mediumPath + imgToChange ;
  	// link passed in 'alt' field for popup javascript
  	img.alt = imgToChange ;
  	img.onclick=new Function("autoResizeWindow(this,'" + width + "+20','" + height + "+20')");
  	var hrefObj = document.getElementById(imgHref) ;
  	//hrefObj.href = normalnPath + imgToChange ;
}


function autoResizeWindow(imageObj,imgWidth,imgHeight)
{
  	var imagePath = "images/products/" + imageObj.alt ;
//	alert(imageObj.alt);
   	var tempImg = new Image() ;
//	alert(imagePath);
	tempImg.src = imagePath ;
  //	alert(tempImg.src);
  	

  	var openedWindow = window.open(imagePath, "" ,"width="+imgWidth+",height="+imgHeight+", menubar=no, toolbar=no, location=no, scrollbars=no, resizable=yes, status=no'") ;
  	
  	// get image size

 // 	openedWindow.resizeTo(imgWidth, imgHeight) ;
  /*	
  	openedWindow.width = imgWidth ;
 	openedWindow.height = imgHeight ;*/
}

// ***************** Rozwijana lista do pliku... gdzieś do zaplecza po prostu :E - POCZATEK

function tree(id)
{
  this.id = id;

  this.click = function ()
  {
    for (var i = 0, el_node; i < this.parentNode.childNodes.length; i++)
    {
      el_node = this.parentNode.childNodes.item(i)
      if (el_node.nodeName.toLowerCase() == 'ul')
      {
        el_node.style.display = el_node.style.display == 'none' ? 'block' : 'none';
        this.parentNode.style.backgroundImage = 'url("' + (el_node.style.display == 'none' ? 'closed' : 'opened') + '.gif")';
        return;
      }
    }
  }

  this.start = function (el)
  {
    for (var i = 0, el_node; i < el.childNodes.length; i++)
    {
      el_node = el.childNodes.item(i);
      if (el_node.nodeName.toLowerCase() == 'a')
      {
        el_node.onclick = this.click;
        for (var j = 0; j < el_node.parentNode.childNodes.length; j++)
        {
          if (el_node.parentNode.childNodes.item(j).nodeName.toLowerCase() == 'ul')
          {
            el_node.parentNode.style.backgroundImage = 'url("closed.gif")';
            el_node.className = (el_node.className ? el_node.className + ' ' : '') + 'folder';
            break;
          }
          if (el_node.parentNode.childNodes.item(j).nodeName.toLowerCase() == 'li') break;
        }
        if (el_node.href && unescape(el_node.href) == unescape(window.location.href))
        {
          el_node.className = 'menuTreeNodeActive';
          var el_parentNode = el_node;
          do
          {
            el_parentNode = el_parentNode.parentNode;
            if (el_parentNode.nodeName.toLowerCase() == 'ul')
            {
              el_parentNode.style.display = 'block';
              if (document.getElementById(this.id) != el_parentNode) el_parentNode.parentNode.style.backgroundImage = 'url("opened.gif")';
            }
          }
          while (document.getElementById(this.id) != el_parentNode)
        }
      }
      else if (el_node.nodeName.toLowerCase() == 'ul') el_node.style.display = 'none';
      this.start(el_node);
    }
  }

  if (document.getElementById && document.childNodes)
  {
    if (document.images)
    {
      new Image().src = 'pik.gif';
      new Image().src = 'pik.gif';
    }
    this.start(document.getElementById(this.id));
  }
}

////////////////////////////////////////////////////////////////////////////////

// general submit form function
function submitForm(_formName, _actionName, _actionValue)
{ 	
  	var actionName = document.getElementById(_actionName) ;
  	
  	if(actionName == null)
  	{
  		alert("Error: you have to define hidden action variable") ;
  		return ;
	}
  	actionName.value = _actionValue ;
  	document.forms[_formName].submit();

}

// show/hide div coresponding to checkBox
function showHideCheckBox(divId, checkBoxId)
{
  	
  	var hideDiv = document.getElementById(divId) ;
  	var checkBox = document.getElementById(checkBoxId) ;
  	
  	if(checkBox == null)
  		alert('checkBoxId incorrect') ;
	if(hideDiv == null)
  		alert('divId incorrect') ;
  	
  	if(checkBox.checked)
     		hideDiv.style.display = "block" ;
   	else
   		hideDiv.style.display = "none" ;
}
function ClickShowHideMenu(id) {
    this.box1Hover = true;
    this.box2Hover = true;

    this.init = function() {
        if (!document.getElementById(this.id)) {
            alert("Element '"+this.id+"' does not exist in this document. ClickShowHideMenu cannot be initialized");
            return;
        }
        this.parse(document.getElementById(this.id).childNodes, this.tree, this.id);
        this.load();
        if (window.attachEvent) {
            window.attachEvent("onunload", function(e) { self.save(); });
        } else if (window.addEventListener) {
            window.addEventListener("unload", function(e) { self.save(); }, false);
        }
    }

    this.parse = function(nodes, tree, id) {
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].nodeType != 1) {
                continue;
            }
            if (nodes[i].className) {
                if ("box1" == nodes[i].className.substr(0, 4)) {
                    nodes[i].id = id + "-" + tree.length;
                    tree[tree.length] = new Array();
                    eval('nodes[i].onmouseover = function() { self.box1over("'+nodes[i].id+'"); }');
                    eval('nodes[i].onmouseout = function() { self.box1out("'+nodes[i].id+'"); }');
                    eval('nodes[i].onclick = function() { self.box1click("'+nodes[i].id+'"); }');
                }
                if ("section" == nodes[i].className) {
                    id = id + "-" + (tree.length - 1);
                    nodes[i].id = id + "-section";
                    tree = tree[tree.length - 1];
                }
                if ("box2" == nodes[i].className.substr(0, 4)) {
                    nodes[i].id = id + "-" + tree.length;
                    tree[tree.length] = new Array();
                    eval('nodes[i].onmouseover = function() { self.box2over("'+nodes[i].id+'", "'+nodes[i].className+'"); }');
                    eval('nodes[i].onmouseout = function() { self.box2out("'+nodes[i].id+'", "'+nodes[i].className+'"); }');
                }
            }
            if (nodes[i].childNodes) {
                this.parse(nodes[i].childNodes, tree, id);
            }
        }
    }

    this.box1over = function(id) {
        if (!this.box1Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = (this.id_openbox == id ? "box1-open-hover" : "box1-hover");
    }

    this.box1out = function(id) {
        if (!this.box1Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = (this.id_openbox == id ? "box1-open" : "box1");
    }

    this.box1click = function(id) {
        if (!document.getElementById(id)) {
            return;
        }
        var id_openbox = this.id_openbox;
        if (this.id_openbox) {
            if (!document.getElementById(id + "-section")) {
                return;
            }
            this.hide();
            if (id_openbox == id) {
                if (this.box1hover) {
                    document.getElementById(id_openbox).className = "box1-hover";
                } else {
                    document.getElementById(id_openbox).className = "box1";
                }
            } else {
                document.getElementById(id_openbox).className = "box1";
            }
        }
        if (id_openbox != id) {
            this.show(id);
            var className = document.getElementById(id).className;
            if ("box1-hover" == className) {
                document.getElementById(id).className = "box1-open-hover";
            }
            if ("box1" == className) {
                document.getElementById(id).className = "box1-open";
            }
        }
    }

    this.box2over = function(id, className) {
        if (!this.box2Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = className + "-hover";
    }

    this.box2out = function(id, className) {
        if (!this.box2Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = className;
    }

    this.show = function(id) {
        if (document.getElementById(id + "-section")) {
            document.getElementById(id + "-section").style.display = "block";
            this.id_openbox = id;
        }
    }

    this.hide = function() {
        document.getElementById(this.id_openbox + "-section").style.display = "none";
        this.id_openbox = "";
    }

    this.save = function() {
        if (this.id_openbox) {
            this.cookie.set(this.id, this.id_openbox);
        } else {
            this.cookie.del(this.id);
        }
    }

    this.load = function() {
        var id_openbox = this.cookie.get(this.id);
        if (id_openbox) {
            this.show(id_openbox);
            document.getElementById(id_openbox).className = "box1-open";
        }
    }

    function Cookie() {
        this.get = function(name) {
            var cookies = document.cookie.split(";");
            for (var i = 0; i < cookies.length; i++) {
                var a = cookies[i].split("=");
                if (a.length == 2) {
                    a[0] = a[0].trim();
                    a[1] = a[1].trim();
                    if (a[0] == name) {
                        return unescape(a[1]);
                    }
                }
            }
            return "";
        }
        this.set = function(name, value) {
            document.cookie = name + "=" + escape(value);
        }
        this.del = function(name) {
            document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
        }
    }

    var self = this;
    this.id = id;
    this.tree = new Array();
    this.cookie = new Cookie();
    this.id_openbox = "";
    this.init();
}
if (typeof String.prototype.trim == "undefined") {
    String.prototype.trim = function() {
    var s = this.replace(/^\s*/, "");
	    return s.replace(/\s*$/, "");
    }
}

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}
function fixH(one,two) {
if (document.getElementById(one)) {
var lh=$(one).offsetHeight;
var rh=$(two).offsetHeight;
//var nh = Math.max(lh, rh);
var nh = lh;
//$(one).style.height=nh+"px";
$(two).style.height=nh+"px";
}
}

function review() {
if($('rew').style.display=='none')
{

$('rewcontent').innerHTML='';
$('rew').style.display='block';
$('text').style.display='none';
$('textfont').innerHTML='edycja &raquo;';
$('textfont1').style.display='none';
$('rewcontent').innerHTML=tinyMCE.getInstanceById('p_content').getContent();
}
else
{
$('rew').style.display='none';
$('textfont').innerHTML='podgląd odpowiedzi &raquo;';
$('textfont1').style.display='block';
$('text').style.display='block';
}
fixH('forum','forumright');
}

function showlogin(){
$('searchdiv').style.display='none';
$('logindiv').style.display='block';
$('newsletterdiv').style.display='none';
}
function showsearch(){
$('searchdiv').style.display='block';
$('logindiv').style.display='none';
$('newsletterdiv').style.display='none';

}
function shownewsletter(){
$('searchdiv').style.display='none';
$('logindiv').style.display='none';
$('newsletterdiv').style.display='block';

}

function showhide(id) {
if($(id).style.display=='none')
{
$(id).style.display='block';
}
else
$(id).style.display='none';
}



function openpopup(url)
{
		window.open(url,'popUpWindow','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}
function openpopup2(url)
{
	window.open(url,'popUpWindow','height=620,width=800,left=0,top=0,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}



function addtofavorite(adres,opis){
if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(opis, adres,"");
} else if( window.external ) { // IE Favorite
	window.external.AddFavorite( adres, opis); }
else if(window.opera && window.print) { // Opera Hotlist
	return true; }
}


function button(obj){
obj.style.cursor='pointer';
}

function addcategory(where){
if($('cid'))
cat=$$('cid');
else
cat=0;
$(where).innerHTML='';
$(where).innerHTML='<form enctype="multipart/form-data" method="post" name="formadd"><input type="hidden" name="action" value="add"/><input type="hidden" name="MAX_FILE_SIZE" value="2000000" /><input type="hidden" name="categoryid" value="'+cat+'"><table class="form"><tr><td>Nazwa kategorii:*</td><td><input type="text" name="categoryname" maxlength="60"></td></tr><tr><td>Opis na stronie kategorii:</td><td><textarea name="categorydescription" id="categorydescription"></textarea></td></tr><tr><td>I Plik:*</td><td><input type="file" name="plik" maxlength="250"  style="width:245px; color:#3d3d3d"/><br/>(*.gif,*.png,*.jpg) rozmiar (150x100)</td></tr><tr><td>II Plik:</td><td><input type="file" name="plik2" maxlength="250"  style="width:245px; color:#3d3d3d"/><br/>(*.gif,*.png,*.jpg) rozmiar (150x100)</td></tr><tr><td colspan="2" class="right" style="text-align: center;"><div style="width: 60px; margin:auto;" onclick="document.formadd.submit();" onmouseover="button(this)"><div class="button-body">zapisz</div><div class="clear"></div></div></td></tr></table></form><div class="clear"></div>Pola oznaczone (*) są wymagane</form>';
tinyMCE.execCommand('mceAddControl', false, 'categorydescription');
}

function editcategory(where){
if(!$('cid'))
{
	alert('Wybierz kategorie');
	return false;
}
if($$('cid')==0)
{
	alert('Wybierz kategorie');
	return false;
}
cat=$$('cid');
$(where).innerHTML='';
$(where).innerHTML='<form enctype="multipart/form-data" method="post" name="formedit"><input type="hidden" name="action" value="edit"/><input type="hidden" name="categoryid" value="'+cat+'"><input type="hidden" name="MAX_FILE_SIZE" value="2000000" /><table class="form"><tr><td>Nazwa kategorii:</td><td><input type="text" value="'+$($('cid').value).text+'" name="categoryname" maxlength="60"></td></tr><tr><td>Opis na stronie kategorii:</td><td><textarea name="categorydescription" id="categorydescription">'+$($('cid').value+'_description').innerHTML+'</textarea></td></tr><tr><td>I Plik:</td><td><input type="file" name="plik" maxlength="250"  style="width:245px; color:#3d3d3d"/><br/>(*.gif,*.png,*.jpg) rozmiar (230x170)</td></tr><tr><td>II Plik:</td><td><input type="file" name="plik2" maxlength="250"  style="width:245px; color:#3d3d3d"/><br/>(*.gif,*.png,*.jpg) rozmiar (230x170)</td></tr><tr><td colspan="2" class="right" style="text-align: center;"><div style="width: 60px; margin: auto;" onclick="document.formedit.submit();" onmouseover="button(this)"><div class="button-body">zapisz</div><div class="clear"></div></div></td></tr></table></form>';
tinyMCE.execCommand('mceAddControl', false, 'categorydescription');
}
function delcategory(where){
if(!$('cid'))
{
	alert('Wybierz kategorie');
	return false;
}
if($$('cid')==0)
{
	alert('Wybierz kategorie');
	return false;
}
cat=$$('cid');
$(where).innerHTML='';
$(where).innerHTML='<form method="post" name="formdel"><input type="hidden" name="action" value="del"/><input type="hidden" name="categoryid" value="'+cat+'"></form>';
document.formdel.submit();
}



function changebg(id)
{
	if($('categoryid'))
		$('categoryid').value=id;
	if($('cid'))
	{
		if($('cid').value!=0)
		{
			$($('cid').value).style.background='#9DCA40';	
		}
		$('cid').value=id;
	}
	if($(id))
		$(id).style.background='#dedede';
}

function dselect(){
if($('cid'))
if($$('cid')!=0)
{
	$($('cid').value).style.background='#9DCA40';	
	$('cid').value=0;
}
}

function movecategory(where){
if(!$('cid'))
{
	alert('Wybierz kategorie');
	return false;
}
if($$('cid')==0)
{
	alert('Wybierz kategorie');
	return false;
}
cat=$$('cid');
$(cat).style.background='#9DCA40';
$('cid').value=0;
$(where).innerHTML='';
$(where).innerHTML='<form method="post" name="formmove" onsubmit="return move()"><input type="hidden" name="action" value="move"/><table class="form"><tr><td>Kategoria do przeniesienia:</td><td>'+$(cat).text+'</td></tr><tr><td colspan="2" class="right"><input type="hidden" name="categoryto" id="categoryto" value="0"><input type="hidden" id="categorytomove" name="categorytomove" value="'+cat+'"><div class="button-alignright" onclick="move()" onmouseover="button(this)"><div class="button-icon-przenies"></div><div class="button-body">przenieś</div><div class="clear"></div></div></td></tr></table></form>';
}


function move(){
if(!$('cid'))
{
	alert('Wybierz kategorie');
	return false;
}
if($$('categorytomove')==$$('cid'))
{
	alert('Nie możesz przenieś kategorii do tej samej');
	return false;
}
$('categoryto').value=$$('cid');
document.formmove.submit();
}

function showcategory(id){
if($(id).style.display=='none')
$(id).style.display='';
else
$(id).style.display='none';
}

function link(href){
window.location.href=href;
}


function delproduct2(id)
{
	if(!$('productdiv'+id).disabled)
	{
		$('productdiv'+id).disabled=false;
		$('product'+id).style.border='0px';
	}
}


function delproduct(id)
{
        if($('productdiv'+id))
        {
                if($('productdiv'+id).disabled)
                {
                        $('productdiv'+id).disabled=false;
                        $('product'+id).style.border='1px solid red';
                }
                else
                {
                        $('productdiv'+id).disabled=true;
                        $('product'+id).style.border='0px';

                }
        }
}

function delproducts(){
document.forms.productsform.submit();
}



function hidecategory(where){
if(!$('cid'))
{
        alert('Wybierz kategorie');
	        return false;
		}
		if($$('cid')==0)
		{
		        alert('Wybierz kategorie');
			        return false;
				}
				cat=$$('cid');
				$(where).innerHTML='';
				$(where).innerHTML='<form method="post" name="formhide"><input type="hidden" name="action" value="hide"/><input type="hidden" name="categoryid" value="'+cat+'"></form>';
				document.formhide.submit();

}

function changecolor(obj,color){
 obj.style.color=color;	

}

function showonefromall(oneident,allident){
	var ident=oneident;
	var len=jQuery(allident).length;
	var i=0;	
	jQuery(allident).hide();	
	
			jQuery(ident).slideToggle(400);

}

function show(id)
{
	jQuery(id).slideToggle("slow");
}
function changeimage(obj,url)
{
	obj.src=url;
}
function changeline(obj,url){
	obj.style.listStyle="none";
	obj.style.listStyleImage="url("+url+")";
}

function menushow(id, height)
{
	$(id).style.height = height + "px";
}

function changeColor(id)
{
	if($(id).style.color == "rgb(255, 255, 255)")
	{
		$(id).style.color = "rgb(192, 192, 192)";
	}	
	else if($(id).style.color == "rgb(192, 192, 192)")
	{
		$(id).style.color = "rgb(255, 255, 255)";
	}
}
