$(document).ready(function()
{$("#filmglowny object").prepend("<param name='wmode' value='opaque'>");$("#filmglowny object embed").attr("wmode","opaque");});function ant_link(klasa,metoda,parametry,ajax)
{var params="";if(parametry.length!='')
{params=","+parametry;}
if(ajax)
{return"ajax.php?"+klasa+","+metoda+","+Enviroment.current_language+","+Enviroment.current_subservice+params;}
else
{return"index.php?"+klasa+","+metoda+","+Enviroment.current_language+","+Enviroment.current_subservice+params;}}
function GoToPage(link)
{if(link!="")
{window.location=link;}}
function LoadADoc(link)
{$.phpget(link);}
function LadujDokument(ev)
{if(ev.data.link!='')
LoadADoc(ev.data.link);return false;}
function AjaxRequest(link)
{$.phpget(link);}
php={beforeSend:function(){return true;},success:function(response,textStatus){for(var i=0;i<response['q'].length;i++){var selector=jQuery(response['q'][i]['s']);var methods=response['q'][i]['m'];var arguments=response['q'][i]['a'];for(var j=0;j<methods.length;j++){try{var method=methods[j];var argument=arguments[j];if(method&&method!=''&&method!='undefined'){switch(true){case(method=='ready'||method=='map'||method=='queue'):selector=selector[method](window[argument[0]]);break;case((method=='bind'||method=='one')&&argument.length==3):selector=selector[method](argument[0],argument[1],window[argument[2]]);break;case((method=='toggle'||method=='hover')&&argument.length==2):selector=selector[method](window[argument[0]],window[argument[1]]);break;case(method=='filter'&&argument.length==1):if(window[argument[0]]&&window[argument[0]]!=''&&window[argument[0]]!='undefined'){selector=selector[method](window[argument[0]]);}else{selector=selector[method](argument[0]);}
break;case((method=='show'||method=='hide'||method=='slideDown'||method=='slideUp'||method=='slideToggle'||method=='fadeIn'||method=='fadeOut')&&argument.length==2):selector=selector[method](argument[0],window[argument[1]]);break;case((method=='blur'||method=='change'||method=='click'||method=='dblclick'||method=='error'||method=='focus'||method=='keydown'||method=='keypress'||method=='keyup'||method=='load'||method=='unload'||method=='mousedown'||method=='mousemove'||method=='mouseout'||method=='mouseover'||method=='mouseup'||method=='resize'||method=='scroll'||method=='select'||method=='submit')&&argument.length==1):selector=selector[method](window[argument[0]]);break;case(method=='fadeTo'&&argument.length==3):selector=selector[method](argument[0],argument[1],window[argument[2]]);break;case(method=='animate'&&argument.length==4):selector=selector[method](argument[0],argument[1],argument[2],window[argument[3]]);break;case(argument.length==0):selector=selector[method]();break;case(argument.length==1):selector=selector[method](argument[0]);break;case(argument.length==2):selector=selector[method](argument[0],argument[1]);break;case(argument.length==3):selector=selector[method](argument[0],argument[1],argument[2]);break;case(argument.length==4):selector=selector[method](argument[0],argument[1],argument[2],argument[3]);break;default:selector=selector[method](argument);break;}}}catch(error){alert('onAction: jQuery("'+response['q'][i]['s']+'").'+method+'("'+argument+'")\n'
+' in file: '+error.fileName+'\n'
+' on line: '+error.lineNumber+'\n'
+' error:   '+error.message);}}}
jQuery.each(response['a'],function(func,params){for(var i=0;i<params.length;i++){try{php[func](params[i]);}catch(error){alert('onAction: '+func+'('+params[i]+')\n'
+' in file: '+error.fileName+'\n'
+' on line: '+error.lineNumber+'\n'
+' error:   '+error.message);}}});},error:function(xmlEr,typeEr,except){var exObj=except?except:false;jQuery('#php-error').remove();var printCss="<style type='text/css'>"+"#php-error{ width:640px; position:absolute; top:4px; right:4px; border:1px solid #f00; }"+"#php-error .php-title{ width:636px; height:26px; position:relative; line-height:26px; background-color:#f66; color:#fff; font-weight:bold; font-size:12px;padding-left:4px; }"+"#php-error .php-more { width:20px;  height:20px; position:absolute; top:2px; right:24px; line-height:20px; text-align:center; cursor:pointer; border:1px solid #f00; background-color:#fee; color:#333; }"+"#php-error .php-close{ width:20px;  height:20px; position:absolute; top:2px; right:2px;  line-height:20px; text-align:center; cursor:pointer; border:1px solid #f00; background-color:#fee; color:#333; }"+"#php-error .php-desc { width:636px; position:relative; background-color:#fee; border-bottom:1px solid #f00;padding-left:4px;}"+"#php-error .php-content{ display:none;}"+"#php-error textarea{ width:634px;height:400px;overflow:auto;padding:2px;}"+"</style>";var printStr="<div id='php-error'>"+"<div class='php-title'>Error in AJAX request"+"<div class='php-more'>&raquo;</div>"+"<div class='php-close'>X</div>"+"</div>"+"<div class='php-desc'>";printStr+="<b>XMLHttpRequest exchange</b>: ";switch(xmlEr.readyState){case 0:readyStDesc="not initialize";break;case 1:readyStDesc="open";break;case 2:readyStDesc="data transfer";break;case 3:readyStDesc="loading";break;case 4:readyStDesc="finish";break;default:return"uncknown state";}
printStr+=readyStDesc+" ("+xmlEr.readyState+")";printStr+="<br/>\n";if(exObj!=false){printStr+="exception was catch: "+except.toString();printStr+="<br/>\n";}
printStr+="<b>HTTP status</b>: "+xmlEr.status+" - "+xmlEr.statusText;printStr+="<br/>\n";printStr+="<b>Response text</b> (<small><a href='#' class='php-more2'>show more information &raquo;</a></small>):";printStr+="</div>\n";printStr+="<div class='php-content'><textarea>"+xmlEr.responseText+"</textarea></div>";printStr+="</div>";jQuery(document.body).append(printCss);jQuery(document.body).append(printStr);jQuery('#php-error .php-more').hover(function(){jQuery(this).css('background-color','#fff')},function(){jQuery(this).css('background-color','#fee')});jQuery('#php-error .php-more').click(function(){jQuery('#php-error .php-content').slideToggle();});jQuery('#php-error .php-more2').click(function(){jQuery('#php-error .php-content').slideToggle();return false;});jQuery('#php-error .php-close').click(function(){jQuery('#php-error').fadeOut('fast',function(){jQuery('#php-error').remove()})});jQuery('#php-error .php-close').hover(function(){jQuery(this).css('background-color','#fff')},function(){jQuery(this).css('background-color','#fee')});},complete:function(XMLHttpRequest,textStatus){return true;},addMessage:function(data){var message=data.msg||"";var callBackFunc=data.callback||"defaultCallBack";var callBackParams=data.params||{};php.messages[callBackFunc](message,callBackParams);},addError:function(data){var message=data.msg||"";var callBackFunc=data.callback||"defaultCallBack";var callBackParams=data.params||{};php.errors[callBackFunc](message,callBackParams);},evalScript:function(data){var func=data.foo||'';eval(func);},messages:{defaultCallBack:function(msg,params){alert("Server response message: "+msg);}},errors:{defaultCallBack:function(msg,params){alert("Server response error: "+msg);}}};jQuery.extend({php:function(url,params){jQuery.ajax({url:url,type:"POST",data:params,dataType:"json",beforeSend:function(){return php.beforeSend();},success:function(data,textStatus){return php.success(data,textStatus);},error:function(xmlEr,typeEr,except){return php.error(xmlEr,typeEr,except);},complete:function(XMLHttpRequest,textStatus){return php.complete(XMLHttpRequest,textStatus);}})},phpget:function(url,params){jQuery.ajax({url:url,type:"GET",data:params,dataType:"json",beforeSend:function(){return php.beforeSend();},success:function(data,textStatus){return php.success(data,textStatus);},error:function(xmlEr,typeEr,except){return php.error(xmlEr,typeEr,except);},complete:function(XMLHttpRequest,textStatus){return php.complete(XMLHttpRequest,textStatus);}})}});;(function($){$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}
continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0],n=input.name;if(n&&!input.disabled&&input.type=='image'){a.push({name:n,value:$input.val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v)
v=(op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified))?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};})(jQuery);var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+encodeURI(O.location).toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();var SolmetraUploader={instances:new Array(),ready:new Array(),allReady:false,errorHandler:'',eventHandler:'',currentForm:0,attach:function(){if(window.addEventListener){window.addEventListener('load',SolmetraUploader.initialize,false);}
else if(window.attachEvent){window.attachEvent('onload',SolmetraUploader.initialize);}},initialize:function(){var list=document.getElementsByName('solmetraUploaderInstance');cnt=list.length;for(i=0;i<cnt;i++){if(!SolmetraUploader.inArray(list[i].value,SolmetraUploader.ready)){setTimeout('SolmetraUploader.initialize()',1000);return;}}
SolmetraUploader.allReady=true;SolmetraUploader.getForms();},getForms:function(){var list=document.getElementsByName('solmetraUploaderInstance');cnt=list.length;for(i=0;i<cnt;i++){var instance={id:list[i].value,hijack:SolmetraUploader.getObject('solmetraUploaderHijack_'+list[i].value).value=='y'?true:false,required:SolmetraUploader.getObject('solmetraUploaderRequired_'+list[i].value).value=='y'?true:false,form:SolmetraUploader.getForm(list[i])};SolmetraUploader.instances.push(instance);SolmetraUploader.hijackForm(instance.form);}},hijackForm:function(frm){if(frm.solmetraUploaderOriginalOnSubmit||frm.solmetraUploaderOriginalSubmit){return;}
frm.solmetraId=SolmetraUploader.currentForm;SolmetraUploader.currentForm++;frm.solmetraUploaderOriginalOnSubmit=frm.onsubmit;frm.onsubmit=function(){return SolmetraUploader.submit(this)?true:false;}
frm.solmetraUploaderOriginalSubmit=frm.submit;frm.submit=function(){return SolmetraUploader.submit(this)?true:false;}},submit:function(frm){if(!SolmetraUploader.ready){return false;}
var uploadList=new Array();var cnt=SolmetraUploader.instances.length;for(i=0;i<cnt;i++){instance=SolmetraUploader.instances[i];var uploading=false;var id='';if(instance.form.solmetraId==frm.solmetraId){id=instance.id;var uploadStatus=SolmetraUploader.flashGetUploadStatus(instance.id);if(instance.required&&uploadStatus!='selected'&&uploadStatus!='done'&&uploadStatus!='uploading'){SolmetraUploader.broadcastError(instance.error,'Not selected');return false;}
else if(uploadStatus=='selected'){uploadList.push(instance);}
else if(uploadStatus=='uploading'){uploading=true;}
else if(uploadStatus=='error'){return false;}}}
if(uploadList.length==0&&!uploading){if(frm.solmetraUploaderOriginalOnSubmit){frm.solmetraUploaderOriginalOnSubmit();}
frm.solmetraUploaderOriginalSubmit();return false;}
while(instance=uploadList.shift()){SolmetraUploader.flashTriggerUpload(instance.id);}
setTimeout('SolmetraUploader.submit(SolmetraUploader.getInstanceForm(\''+id+'\'));',1000);return false;},flashGetUploadStatus:function(id){var obj=SolmetraUploader.getObject('solmetraUploaderMovie_'+id);return obj.getUploadStatus();},flashTriggerUpload:function(id){var obj=SolmetraUploader.getObject('solmetraUploaderMovie_'+id);return obj.triggerUpload();},flashTriggerCancel:function(id){var obj=SolmetraUploader.getObject('solmetraUploaderMovie_'+id);return obj.triggerCancel();},setErrorHandler:function(funct){SolmetraUploader.errorHandler=funct;},broadcastError:function(id,err){eval(SolmetraUploader.errorHandler+"('"+id+"', '"+err+"')");},setEventHandler:function(funct){SolmetraUploader.eventHandler=funct;},broadcastEvent:function(id,evt,data){eval(SolmetraUploader.eventHandler+"('"+id+"', '"+evt+"', data)");if(evt=='complete'){objx=SolmetraUploader.getObject('solmetraUploaderData_'+id);objx.value+='|'+data.tmp_name+'|'+data.name;}
else if(evt=='ready'){SolmetraUploader.ready.push(id);}},getObject:function(id){if(document.getElementById&&document.getElementById(id)!=null){return document.getElementById(id);}
else if(document.layers&&document.layers[id]!=null){return document.layers[id];}
else if(document.all){return document.all(id);}
else{return true;}},getForm:function(obj){while(obj=obj.parentNode){if(obj.nodeName=='FORM'){return obj;}}
return false;},getInstanceForm:function(instance){obj=SolmetraUploader.getObject('solmetraUploaderMovie_'+instance);while(obj=obj.parentNode){if(obj.nodeName=='FORM'){return obj;}}
return false;},inArray:function(needle,arr){cnt=arr.length
for(fi=0;fi<cnt;fi++){if(needle==arr[fi]){return true;}}
return false;}}
SolmetraUploader.attach();


/*
 * jQuery UI Stars v3.0.1
 * http://plugins.jquery.com/project/Star_Rating_widget
 *
 * Copyright (c) 2010 Marek "Orkan" Zajac (orkans@gmail.com)
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * $Rev: 164 $
 * $Date:: 2010-05-01 #$
 * $Build: 35 (2010-05-01)
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *
 */
(function(A){A.widget("ui.stars",{options:{inputType:"radio",split:0,disabled:false,cancelTitle:"Cancel Rating",cancelValue:0,cancelShow:true,disableValue:true,oneVoteOnly:false,showTitles:false,captionEl:null,callback:null,starWidth:16,cancelClass:"ui-stars-cancel",starClass:"ui-stars-star",starOnClass:"ui-stars-star-on",starHoverClass:"ui-stars-star-hover",starDisabledClass:"ui-stars-star-disabled",cancelHoverClass:"ui-stars-cancel-hover",cancelDisabledClass:"ui-stars-cancel-disabled"},_create:function(){var C=this,F=this.options,B=0;this.element.data("former.stars",this.element.html());F.isSelect=F.inputType=="select";this.$form=A(this.element).closest("form");this.$selec=F.isSelect?A("select",this.element):null;this.$rboxs=F.isSelect?A("option",this.$selec):A(":radio",this.element);this.$stars=this.$rboxs.map(function(I){var J={value:this.value,title:(F.isSelect?this.text:this.title)||this.value,isDefault:(F.isSelect&&this.defaultSelected)||this.defaultChecked};if(I==0){F.split=typeof F.split!="number"?0:F.split;F.val2id=[];F.id2val=[];F.id2title=[];F.name=F.isSelect?C.$selec.get(0).name:this.name;F.disabled=F.disabled||(F.isSelect?A(C.$selec).attr("disabled"):A(this).attr("disabled"))}if(J.value==F.cancelValue){F.cancelTitle=J.title;return null}F.val2id[J.value]=B;F.id2val[B]=J.value;F.id2title[B]=J.title;if(J.isDefault){F.checked=B;F.value=F.defaultValue=J.value;F.title=J.title}var H=A("<div/>").addClass(F.starClass);var K=A("<a/>").attr("title",F.showTitles?J.title:"").text(J.value);if(F.split){var G=(B%F.split);var L=Math.floor(F.starWidth/F.split);H.width(L);K.css("margin-left","-"+(G*L)+"px")}B++;return H.append(K).get(0)});F.items=B;F.isSelect?this.$selec.remove():this.$rboxs.remove();this.$cancel=A("<div/>").addClass(F.cancelClass).append(A("<a/>").attr("title",F.showTitles?F.cancelTitle:"").text(F.cancelValue));F.cancelShow&=!F.disabled&&!F.oneVoteOnly;F.cancelShow&&this.element.append(this.$cancel);this.element.append(this.$stars);if(F.checked===undefined){F.checked=-1;F.value=F.defaultValue=F.cancelValue;F.title=""}this.$value=A("<input type='hidden' name='"+F.name+"' value='"+F.value+"' />");this.element.append(this.$value);this.$stars.bind("click.stars",function(H){if(!F.forceSelect&&F.disabled){return false}var G=C.$stars.index(this);F.checked=G;F.value=F.id2val[G];F.title=F.id2title[G];C.$value.attr({disabled:F.disabled?"disabled":"",value:F.value});D(G,false);C._disableCancel();!F.forceSelect&&C.callback(H,"star")}).bind("mouseover.stars",function(){if(F.disabled){return false}var G=C.$stars.index(this);D(G,true)}).bind("mouseout.stars",function(){if(F.disabled){return false}D(C.options.checked,false)});this.$cancel.bind("click.stars",function(G){if(!F.forceSelect&&(F.disabled||F.value==F.cancelValue)){return false}F.checked=-1;F.value=F.cancelValue;F.title="";C.$value.val(F.value);F.disableValue&&C.$value.attr({disabled:"disabled"});E();C._disableCancel();!F.forceSelect&&C.callback(G,"cancel")}).bind("mouseover.stars",function(){if(C._disableCancel()){return false}C.$cancel.addClass(F.cancelHoverClass);E();C._showCap(F.cancelTitle)}).bind("mouseout.stars",function(){if(C._disableCancel()){return false}C.$cancel.removeClass(F.cancelHoverClass);C.$stars.triggerHandler("mouseout.stars")});this.$form.bind("reset.stars",function(){!F.disabled&&C.select(F.defaultValue)});A(window).unload(function(){C.$cancel.unbind(".stars");C.$stars.unbind(".stars");C.$form.unbind(".stars");C.$selec=C.$rboxs=C.$stars=C.$value=C.$cancel=C.$form=null});function D(G,I){if(G!=-1){var J=I?F.starHoverClass:F.starOnClass;var H=I?F.starOnClass:F.starHoverClass;C.$stars.eq(G).prevAll("."+F.starClass).andSelf().removeClass(H).addClass(J);C.$stars.eq(G).nextAll("."+F.starClass).removeClass(F.starHoverClass+" "+F.starOnClass);C._showCap(F.id2title[G])}else{E()}}function E(){C.$stars.removeClass(F.starOnClass+" "+F.starHoverClass);C._showCap("")}this.select(F.value);F.disabled&&this.disable()},_disableCancel:function(){var C=this.options,B=C.disabled||C.oneVoteOnly||(C.value==C.cancelValue);if(B){this.$cancel.removeClass(C.cancelHoverClass).addClass(C.cancelDisabledClass)}else{this.$cancel.removeClass(C.cancelDisabledClass)}this.$cancel.css("opacity",B?0.5:1);return B},_disableAll:function(){var B=this.options;this._disableCancel();if(B.disabled){this.$stars.filter("div").addClass(B.starDisabledClass)}else{this.$stars.filter("div").removeClass(B.starDisabledClass)}},_showCap:function(B){var C=this.options;if(C.captionEl){C.captionEl.text(B)}},value:function(){return this.options.value},select:function(D){var C=this.options,B=(D==C.cancelValue)?this.$cancel:this.$stars.eq(C.val2id[D]);C.forceSelect=true;B.triggerHandler("click.stars");C.forceSelect=false},selectID:function(D){var C=this.options,B=(D==-1)?this.$cancel:this.$stars.eq(D);C.forceSelect=true;B.triggerHandler("click.stars");C.forceSelect=false},enable:function(){this.options.disabled=false;this._disableAll()},disable:function(){this.options.disabled=true;this._disableAll()},destroy:function(){this.$form.unbind(".stars");this.$cancel.unbind(".stars").remove();this.$stars.unbind(".stars").remove();this.$value.remove();this.element.unbind(".stars").html(this.element.data("former.stars")).removeData("stars");return this},callback:function(C,B){var D=this.options;D.callback&&D.callback(this,B,D.value,C);D.oneVoteOnly&&!D.disabled&&this.disable()}});A.extend(A.ui.stars,{version:"3.0.1"})})(jQuery);

/**
 * http://github.com/valums/file-uploader
 * 
 * Multiple file upload component with progress-bar, drag-and-drop. 
 * © 2010 Andrew Valums ( andrew(at)valums.com ) 
 * 
 * Licensed under GNU GPL 2 or later, see license.txt.
 */    

//
// Helper functions
//

var qq = qq || {};

/**
 * Adds all missing properties from second obj to first obj
 */ 
qq.extend = function(first, second){
    for (var prop in second){
        first[prop] = second[prop];
    }
};  

/**
 * Searches for a given element in the array, returns -1 if it is not present.
 * @param {Number} [from] The index at which to begin the search
 */
qq.indexOf = function(arr, elt, from){
    if (arr.indexOf) return arr.indexOf(elt, from);
    
    from = from || 0;
    var len = arr.length;    
    
    if (from < 0) from += len;  

    for (; from < len; from++){  
        if (from in arr && arr[from] === elt){  
            return from;
        }
    }  
    return -1;  
}; 
    
qq.getUniqueId = (function(){
    var id = 0;
    return function(){ return id++; };
})();

//
// Events

qq.attach = function(element, type, fn){
    if (element.addEventListener){
        element.addEventListener(type, fn, false);
    } else if (element.attachEvent){
        element.attachEvent('on' + type, fn);
    }
};
qq.detach = function(element, type, fn){
    if (element.removeEventListener){
        element.removeEventListener(type, fn, false);
    } else if (element.attachEvent){
        element.detachEvent('on' + type, fn);
    }
};

qq.preventDefault = function(e){
    if (e.preventDefault){
        e.preventDefault();
    } else{
        e.returnValue = false;
    }
};

//
// Node manipulations

/**
 * Insert node a before node b.
 */
qq.insertBefore = function(a, b){
    b.parentNode.insertBefore(a, b);
};
qq.remove = function(element){
    element.parentNode.removeChild(element);
};

qq.contains = function(parent, descendant){       
    // compareposition returns false in this case
    if (parent == descendant) return true;
    
    if (parent.contains){
        return parent.contains(descendant);
    } else {
        return !!(descendant.compareDocumentPosition(parent) & 8);
    }
};

/**
 * Creates and returns element from html string
 * Uses innerHTML to create an element
 */
qq.toElement = (function(){
    var div = document.createElement('div');
    return function(html){
        div.innerHTML = html;
        var element = div.firstChild;
        div.removeChild(element);
        return element;
    };
})();

//
// Node properties and attributes

/**
 * Sets styles for an element.
 * Fixes opacity in IE6-8.
 */
qq.css = function(element, styles){
    if (styles.opacity != null){
        if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
            styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
        }
    }
    qq.extend(element.style, styles);
};
qq.hasClass = function(element, name){
    var re = new RegExp('(^| )' + name + '( |$)');
    return re.test(element.className);
};
qq.addClass = function(element, name){
    if (!qq.hasClass(element, name)){
        element.className += ' ' + name;
    }
};
qq.removeClass = function(element, name){
    var re = new RegExp('(^| )' + name + '( |$)');
    element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
};
qq.setText = function(element, text){
    element.innerText = text;
    element.textContent = text;
};

//
// Selecting elements

qq.children = function(element){
    var children = [],
    child = element.firstChild;

    while (child){
        if (child.nodeType == 1){
            children.push(child);
        }
        child = child.nextSibling;
    }

    return children;
};

qq.getByClass = function(element, className){
    if (element.querySelectorAll){
        return element.querySelectorAll('.' + className);
    }

    var result = [];
    var candidates = element.getElementsByTagName("*");
    var len = candidates.length;

    for (var i = 0; i < len; i++){
        if (qq.hasClass(candidates[i], className)){
            result.push(candidates[i]);
        }
    }
    return result;
};

/**
 * obj2url() takes a json-object as argument and generates
 * a querystring. pretty much like jQuery.param()
 * 
 * how to use:
 *
 *    `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
 *
 * will result in:
 *
 *    `http://any.url/upload?otherParam=value&a=b&c=d`
 *
 * @param  Object JSON-Object
 * @param  String current querystring-part
 * @return String encoded querystring
 */
qq.obj2url = function(obj, temp, prefixDone){
    var uristrings = [],
        prefix = '&',
        add = function(nextObj, i){
            var nextTemp = temp 
                ? (/\[\]$/.test(temp)) // prevent double-encoding
                   ? temp
                   : temp+'['+i+']'
                : i;
            if ((nextTemp != 'undefined') && (i != 'undefined')) {  
                uristrings.push(
                    (typeof nextObj === 'object') 
                        ? qq.obj2url(nextObj, nextTemp, true)
                        : (Object.prototype.toString.call(nextObj) === '[object Function]')
                            ? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
                            : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)                                                          
                );
            }
        }; 

    if (!prefixDone && temp) {
      prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
      uristrings.push(temp);
      uristrings.push(qq.obj2url(obj));
    } else if ((Object.prototype.toString.call(obj) === '[object Array]') && (typeof obj != 'undefined') ) {
        // we wont use a for-in-loop on an array (performance)
        for (var i = 0, len = obj.length; i < len; ++i){
            add(obj[i], i);
        }
    } else if ((typeof obj != 'undefined') && (obj !== null) && (typeof obj === "object")){
        // for anything else but a scalar, we will use for-in-loop
        for (var i in obj){
            add(obj[i], i);
        }
    } else {
        uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj));
    }

    return uristrings.join(prefix)
                     .replace(/^&/, '')
                     .replace(/%20/g, '+'); 
};

//
//
// Uploader Classes
//
//

var qq = qq || {};
    
/**
 * Creates upload button, validates upload, but doesn't create file list or dd. 
 */
qq.FileUploaderBasic = function(o){
    this._options = {
        action: '/server/upload',
        params: {},
        button: null,
        multiple: true,
        maxConnections: 3,
        // validation        
        allowedExtensions: [],               
        sizeLimit: 0,   
        minSizeLimit: 0,                             
        // events
        // return false to cancel submit
        onSubmit: function(id, fileName){},
        onProgress: function(id, fileName, loaded, total){},
        onComplete: function(id, fileName, responseJSON){},
        onCancel: function(id, fileName){},
        // messages                
        messages: {
            typeError: "{file} ma nieprawidłowe rozszerzenie. Tylko {extensions} są dozwolone.",
            sizeError: "{file} jest zbyt duzym plikiem, max to {sizeLimit}.",
            minSizeError: "{file} jest zbyt mały, min to {minSizeLimit}.",
            emptyError: "{file} ijest pusty, wyślij inny plik.",
            onLeave: "Pliki są wysyłane, jeśli opuścisz teraz stronę, wysyłanie zostanie przerwane."            
        },
        showMessage: function(message){
            alert(message);
        }               
    };
    qq.extend(this._options, o);
        
    // number of files being uploaded
    this._filesInProgress = 0;
    this._handler = this._createUploadHandler(); 
    
    if (this._options.button){ 
        this._button = this._createUploadButton(this._options.button);
    }
                        
    this._preventLeaveInProgress();         
};
   
qq.FileUploaderBasic.prototype = {
    setParams: function(params){
        this._options.params = params;
    },
    getInProgress: function(){
        return this._filesInProgress;         
    },
    _createUploadButton: function(element){
        var self = this;
        
        return new qq.UploadButton({
            element: element,
            multiple: this._options.multiple && qq.UploadHandlerXhr.isSupported(),
            onChange: function(input){
                self._onInputChange(input);
            }        
        });           
    },    
    _createUploadHandler: function(){
        var self = this,
            handlerClass;        
        
        if(qq.UploadHandlerXhr.isSupported()){           
            handlerClass = 'UploadHandlerXhr';                        
        } else {
            handlerClass = 'UploadHandlerForm';
        }

        var handler = new qq[handlerClass]({
            action: this._options.action,         
            maxConnections: this._options.maxConnections,   
            onProgress: function(id, fileName, loaded, total){                
                self._onProgress(id, fileName, loaded, total);
                self._options.onProgress(id, fileName, loaded, total);                    
            },            
            onComplete: function(id, fileName, result){
                self._onComplete(id, fileName, result);
                self._options.onComplete(id, fileName, result);
            },
            onCancel: function(id, fileName){
                self._onCancel(id, fileName);
                self._options.onCancel(id, fileName);
            }
        });

        return handler;
    },    
    _preventLeaveInProgress: function(){
        var self = this;
        
        qq.attach(window, 'beforeunload', function(e){
            if (!self._filesInProgress){return;}
            
            var e = e || window.event;
            // for ie, ff
            e.returnValue = self._options.messages.onLeave;
            // for webkit
            return self._options.messages.onLeave;             
        });        
    },    
    _onSubmit: function(id, fileName){
        this._filesInProgress++;  
    },
    _onProgress: function(id, fileName, loaded, total){        
    },
    _onComplete: function(id, fileName, result){
        this._filesInProgress--;                 
        if (result.error){
            this._options.showMessage(result.error);
        }             
    },
    _onCancel: function(id, fileName){
        this._filesInProgress--;        
    },
    _onInputChange: function(input){
        if (this._handler instanceof qq.UploadHandlerXhr){                
            this._uploadFileList(input.files);                   
        } else {             
            if (this._validateFile(input)){                
                this._uploadFile(input);                                    
            }                      
        }               
        this._button.reset();   
    },  
    _uploadFileList: function(files){
        for (var i=0; i<files.length; i++){
            if ( !this._validateFile(files[i])){
                return;
            }            
        }
        
        for (var i=0; i<files.length; i++){
            this._uploadFile(files[i]);        
        }        
    },       
    _uploadFile: function(fileContainer){      
        var id = this._handler.add(fileContainer);
        var fileName = this._handler.getName(id);
        
        if (this._options.onSubmit(id, fileName) !== false){
            this._onSubmit(id, fileName);
            this._handler.upload(id, this._options.params);
        }
    },      
    _validateFile: function(file){
        var name, size;
        
        if (file.value){
            // it is a file input            
            // get input value and remove path to normalize
            name = file.value.replace(/.*(\/|\\)/, "");
        } else {
            // fix missing properties in Safari
            name = file.fileName != null ? file.fileName : file.name;
            size = file.fileSize != null ? file.fileSize : file.size;
        }
                    
        if (! this._isAllowedExtension(name)){            
            this._error('typeError', name);
            return false;
            
        } else if (size === 0){            
            this._error('emptyError', name);
            return false;
                                                     
        } else if (size && this._options.sizeLimit && size > this._options.sizeLimit){            
            this._error('sizeError', name);
            return false;
                        
        } else if (size && size < this._options.minSizeLimit){
            this._error('minSizeError', name);
            return false;            
        }
        
        return true;                
    },
    _error: function(code, fileName){
        var message = this._options.messages[code];        
        function r(name, replacement){ message = message.replace(name, replacement); }
        
        r('{file}', this._formatFileName(fileName));        
        r('{extensions}', this._options.allowedExtensions.join(', '));
        r('{sizeLimit}', this._formatSize(this._options.sizeLimit));
        r('{minSizeLimit}', this._formatSize(this._options.minSizeLimit));
        
        this._options.showMessage(message);                
    },
    _formatFileName: function(name){
        if (name.length > 33){
            name = name.slice(0, 19) + '...' + name.slice(-13);    
        }
        return name;
    },
    _isAllowedExtension: function(fileName){
        var ext = (-1 !== fileName.indexOf('.')) ? fileName.replace(/.*[.]/, '').toLowerCase() : '';
        var allowed = this._options.allowedExtensions;
        
        if (!allowed.length){return true;}        
        
        for (var i=0; i<allowed.length; i++){
            if (allowed[i].toLowerCase() == ext){ return true;}    
        }
        
        return false;
    },    
    _formatSize: function(bytes){
        var i = -1;                                    
        do {
            bytes = bytes / 1024;
            i++;  
        } while (bytes > 99);
        
        return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];          
    }
};
    
       
/**
 * Class that creates upload widget with drag-and-drop and file list
 * @inherits qq.FileUploaderBasic
 */
qq.FileUploader = function(o){
    // call parent constructor
    qq.FileUploaderBasic.apply(this, arguments);
    
    // additional options    
    qq.extend(this._options, {
        element: null,
        // if set, will be used instead of qq-upload-list in template
        listElement: null,
                
        template: '<div class="qq-uploader">' + 
                '<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
                '<div class="qq-upload-button">Wyślij plik</div>' +
                '<ul class="qq-upload-list"></ul>' + 
             '</div>',

        // template for one item in file list
        fileTemplate: '<li>' +
                '<span class="qq-upload-file"></span>' +
                '<span class="qq-upload-spinner"></span>' +
                '<span class="qq-upload-size"></span>' +
                '<a class="qq-upload-cancel" href="#">Przerwij</a>' +
                '<span class="qq-upload-failed-text">Nie powiodło się</span>' +
            '</li>',        
        
        classes: {
            // used to get elements from templates
            button: 'qq-upload-button',
            drop: 'qq-upload-drop-area',
            dropActive: 'qq-upload-drop-area-active',
            list: 'qq-upload-list',
                        
            file: 'qq-upload-file',
            spinner: 'qq-upload-spinner',
            size: 'qq-upload-size',
            cancel: 'qq-upload-cancel',

            // added to list item when upload completes
            // used in css to hide progress spinner
            success: 'qq-upload-success',
            fail: 'qq-upload-fail'
        }
    });
    // overwrite options with user supplied    
    qq.extend(this._options, o);       

    this._element = this._options.element;
    this._element.innerHTML = this._options.template;        
    this._listElement = this._options._listElement || this._find(this._element, 'list');
    
    this._classes = this._options.classes;
        
    this._button = this._createUploadButton(this._find(this._element, 'button'));        
    
    this._bindCancelEvent();
    this._setupDragDrop();
};

// inherit from Basic Uploader
qq.extend(qq.FileUploader.prototype, qq.FileUploaderBasic.prototype);

qq.extend(qq.FileUploader.prototype, {
    /**
     * Gets one of the elements listed in this._options.classes
     **/
    _find: function(parent, type){                                
        var element = qq.getByClass(parent, this._options.classes[type])[0];        
        if (!element){
            throw new Error('element not found ' + type);
        }
        
        return element;
    },
    _setupDragDrop: function(){
        var self = this,
            dropArea = this._find(this._element, 'drop');                        

        var dz = new qq.UploadDropZone({
            element: dropArea,
            onEnter: function(e){
                qq.addClass(dropArea, self._classes.dropActive);
                e.stopPropagation();
            },
            onLeave: function(e){
                e.stopPropagation();
            },
            onLeaveNotDescendants: function(e){
                qq.removeClass(dropArea, self._classes.dropActive);  
            },
            onDrop: function(e){
                dropArea.style.display = 'none';
                qq.removeClass(dropArea, self._classes.dropActive);
                self._uploadFileList(e.dataTransfer.files);    
            }
        });
                
        dropArea.style.display = 'none';

        qq.attach(document, 'dragenter', function(e){     
            if (!dz._isValidFileDrag(e)) return; 
            
            dropArea.style.display = 'block';            
        });                 
        qq.attach(document, 'dragleave', function(e){
            if (!dz._isValidFileDrag(e)) return;            
            
            var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
            // only fire when leaving document out
            if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){               
                dropArea.style.display = 'none';                                            
            }
        });                
    },
    _onSubmit: function(id, fileName){
        qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
        this._addToList(id, fileName);  
    },
    _onProgress: function(id, fileName, loaded, total){
        qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);

        var item = this._getItemByFileId(id);
        var size = this._find(item, 'size');
        size.style.display = 'inline';
        
        var text; 
        if (loaded != total){
            text = Math.round(loaded / total * 100) + '% z ' + this._formatSize(total);
        } else {                                   
            text = this._formatSize(total);
        }          
        
        qq.setText(size, text);         
    },
    _onComplete: function(id, fileName, result){
        qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);

        // mark completed
        var item = this._getItemByFileId(id);                
        qq.remove(this._find(item, 'cancel'));
        qq.remove(this._find(item, 'spinner'));
        
        if (result.success){
            qq.addClass(item, this._classes.success);    
        } else {
            qq.addClass(item, this._classes.fail);
        }         
    },
    _addToList: function(id, fileName){
        var item = qq.toElement(this._options.fileTemplate);                
        item.qqFileId = id;

        var fileElement = this._find(item, 'file');        
        qq.setText(fileElement, this._formatFileName(fileName));
        this._find(item, 'size').style.display = 'none';        

        this._listElement.appendChild(item);
    },
    _getItemByFileId: function(id){
        var item = this._listElement.firstChild;        
        
        // there can't be txt nodes in dynamically created list
        // and we can  use nextSibling
        while (item){            
            if (item.qqFileId == id) return item;            
            item = item.nextSibling;
        }          
    },
    /**
     * delegate click event for cancel link 
     **/
    _bindCancelEvent: function(){
        var self = this,
            list = this._listElement;            
        
        qq.attach(list, 'click', function(e){            
            e = e || window.event;
            var target = e.target || e.srcElement;
            
            if (qq.hasClass(target, self._classes.cancel)){                
                qq.preventDefault(e);
               
                var item = target.parentNode;
                self._handler.cancel(item.qqFileId);
                qq.remove(item);
            }
        });
    }    
});
    
qq.UploadDropZone = function(o){
    this._options = {
        element: null,  
        onEnter: function(e){},
        onLeave: function(e){},  
        // is not fired when leaving element by hovering descendants   
        onLeaveNotDescendants: function(e){},   
        onDrop: function(e){}                       
    };
    qq.extend(this._options, o); 
    
    this._element = this._options.element;
    
    this._disableDropOutside();
    this._attachEvents();   
};

qq.UploadDropZone.prototype = {
    _disableDropOutside: function(e){
        // run only once for all instances
        if (!qq.UploadDropZone.dropOutsideDisabled ){

            qq.attach(document, 'dragover', function(e){
                if (e.dataTransfer){
                    e.dataTransfer.dropEffect = 'none';
                    e.preventDefault(); 
                }           
            });
            
            qq.UploadDropZone.dropOutsideDisabled = true; 
        }        
    },
    _attachEvents: function(){
        var self = this;              
                  
        qq.attach(self._element, 'dragover', function(e){
            if (!self._isValidFileDrag(e)) return;
            
            var effect = e.dataTransfer.effectAllowed;
            if (effect == 'move' || effect == 'linkMove'){
                e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)    
            } else {                    
                e.dataTransfer.dropEffect = 'copy'; // for Chrome
            }
                                                     
            e.stopPropagation();
            e.preventDefault();                                                                    
        });
        
        qq.attach(self._element, 'dragenter', function(e){
            if (!self._isValidFileDrag(e)) return;
                        
            self._options.onEnter(e);
        });
        
        qq.attach(self._element, 'dragleave', function(e){
            if (!self._isValidFileDrag(e)) return;
            
            self._options.onLeave(e);
            
            var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);                      
            // do not fire when moving a mouse over a descendant
            if (qq.contains(this, relatedTarget)) return;
                        
            self._options.onLeaveNotDescendants(e); 
        });
                
        qq.attach(self._element, 'drop', function(e){
            if (!self._isValidFileDrag(e)) return;
            
            e.preventDefault();
            self._options.onDrop(e);
        });          
    },
    _isValidFileDrag: function(e){
        var dt = e.dataTransfer,
            // do not check dt.types.contains in webkit, because it crashes safari 4            
            isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;                        

        // dt.effectAllowed is none in Safari 5
        // dt.types.contains check is for firefox            
        return dt && dt.effectAllowed != 'none' && 
            (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
        
    }        
}; 

qq.UploadButton = function(o){
    this._options = {
        element: null,  
        // if set to true adds multiple attribute to file input      
        multiple: false,
        // name attribute of file input
        name: 'file',
        onChange: function(input){},
        hoverClass: 'qq-upload-button-hover',
        focusClass: 'qq-upload-button-focus'                       
    };
    
    qq.extend(this._options, o);
        
    this._element = this._options.element;
    
    // make button suitable container for input
    qq.css(this._element, {
        position: 'relative',
        overflow: 'hidden',
        // Make sure browse button is in the right side
        // in Internet Explorer
        direction: 'ltr'
    });   
    
    this._input = this._createInput();
};

qq.UploadButton.prototype = {
    /* returns file input element */    
    getInput: function(){
        return this._input;
    },
    /* cleans/recreates the file input */
    reset: function(){
        if (this._input.parentNode){
            qq.remove(this._input);    
        }                
        
        qq.removeClass(this._element, this._options.focusClass);
        this._input = this._createInput();
    },    
    _createInput: function(){                
        var input = document.createElement("input");
        
        if (this._options.multiple){
            input.setAttribute("multiple", "multiple");
        }
                
        input.setAttribute("type", "file");
        input.setAttribute("name", this._options.name);
        
        qq.css(input, {
            position: 'absolute',
            // in Opera only 'browse' button
            // is clickable and it is located at
            // the right side of the input
            right: 0,
            top: 0,
            fontFamily: 'Arial',
            // 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
            fontSize: '118px',
            margin: 0,
            padding: 0,
            cursor: 'pointer',
            opacity: 0
        });
        
        this._element.appendChild(input);

        var self = this;
        qq.attach(input, 'change', function(){
            self._options.onChange(input);
        });
                
        qq.attach(input, 'mouseover', function(){
            qq.addClass(self._element, self._options.hoverClass);
        });
        qq.attach(input, 'mouseout', function(){
            qq.removeClass(self._element, self._options.hoverClass);
        });
        qq.attach(input, 'focus', function(){
            qq.addClass(self._element, self._options.focusClass);
        });
        qq.attach(input, 'blur', function(){
            qq.removeClass(self._element, self._options.focusClass);
        });

        // IE and Opera, unfortunately have 2 tab stops on file input
        // which is unacceptable in our case, disable keyboard access
        if (window.attachEvent){
            // it is IE or Opera
            input.setAttribute('tabIndex', "-1");
        }

        return input;            
    }        
};

/**
 * Class for uploading files, uploading itself is handled by child classes
 */
qq.UploadHandlerAbstract = function(o){
    this._options = {
        action: '/upload.php',
        // maximum number of concurrent uploads        
        maxConnections: 999,
        onProgress: function(id, fileName, loaded, total){},
        onComplete: function(id, fileName, response){},
        onCancel: function(id, fileName){}
    };
    qq.extend(this._options, o);    
    
    this._queue = [];
    // params for files in queue
    this._params = [];
};
qq.UploadHandlerAbstract.prototype = {
    /**
     * Adds file or file input to the queue
     * @returns id
     **/    
    add: function(file){},
    /**
     * Sends the file identified by id and additional query params to the server
     */
    upload: function(id, params){
        var len = this._queue.push(id);

        var copy = {};        
        qq.extend(copy, params);
        this._params[id] = copy;        
                
        // if too many active uploads, wait...
        if (len <= this._options.maxConnections){               
            this._upload(id, this._params[id]);
        }
    },
    /**
     * Cancels file upload by id
     */
    cancel: function(id){
        this._cancel(id);
        this._dequeue(id);
    },
    /**
     * Cancells all uploads
     */
    cancelAll: function(){
        for (var i=0; i<this._queue.length; i++){
            this._cancel(this._queue[i]);
        }
        this._queue = [];
    },
    /**
     * Returns name of the file identified by id
     */
    getName: function(id){},
    /**
     * Returns size of the file identified by id
     */          
    getSize: function(id){},
    /**
     * Returns id of files being uploaded or
     * waiting for their turn
     */
    getQueue: function(){
        return this._queue;
    },
    /**
     * Actual upload method
     */
    _upload: function(id){},
    /**
     * Actual cancel method
     */
    _cancel: function(id){},     
    /**
     * Removes element from queue, starts upload of next
     */
    _dequeue: function(id){
        var i = qq.indexOf(this._queue, id);
        this._queue.splice(i, 1);
                
        var max = this._options.maxConnections;
        
        if (this._queue.length >= max){
            var nextId = this._queue[max-1];
            this._upload(nextId, this._params[nextId]);
        }
    }        
};

/**
 * Class for uploading files using form and iframe
 * @inherits qq.UploadHandlerAbstract
 */
qq.UploadHandlerForm = function(o){
    qq.UploadHandlerAbstract.apply(this, arguments);
       
    this._inputs = {};
};
// @inherits qq.UploadHandlerAbstract
qq.extend(qq.UploadHandlerForm.prototype, qq.UploadHandlerAbstract.prototype);

qq.extend(qq.UploadHandlerForm.prototype, {
    add: function(fileInput){
        fileInput.setAttribute('name', 'qqfile');
        var id = 'qq-upload-handler-iframe' + qq.getUniqueId();       
        
        this._inputs[id] = fileInput;
        
        // remove file input from DOM
        if (fileInput.parentNode){
            qq.remove(fileInput);
        }
                
        return id;
    },
    getName: function(id){
        // get input value and remove path to normalize
        return this._inputs[id].value.replace(/.*(\/|\\)/, "");
    },    
    _cancel: function(id){
        this._options.onCancel(id, this.getName(id));
        
        delete this._inputs[id];        

        var iframe = document.getElementById(id);
        if (iframe){
            // to cancel request set src to something else
            // we use src="javascript:false;" because it doesn't
            // trigger ie6 prompt on https
            iframe.setAttribute('src', 'javascript:false;');

            qq.remove(iframe);
        }
    },     
    _upload: function(id, params){                        
        var input = this._inputs[id];
        
        if (!input){
            throw new Error('file with passed id was not added, or already uploaded or cancelled');
        }                

        var fileName = this.getName(id);
                
        var iframe = this._createIframe(id);
        var form = this._createForm(iframe, params);
        form.appendChild(input);

        var self = this;
        this._attachLoadEvent(iframe, function(){                        
            self._options.onComplete(id, fileName, self._getIframeContentJSON(iframe));
            self._dequeue(id);
            
            delete self._inputs[id];
            // timeout added to fix busy state in FF3.6
            setTimeout(function(){
                qq.remove(iframe);
            }, 1);
        });

        form.submit();        
        qq.remove(form);        
        
        return id;
    }, 
    _attachLoadEvent: function(iframe, callback){
        qq.attach(iframe, 'load', function(){
            // when we remove iframe from dom
            // the request stops, but in IE load
            // event fires
            if (!iframe.parentNode){
                return;
            }

            // fixing Opera 10.53
            if (iframe.contentDocument &&
                iframe.contentDocument.body &&
                iframe.contentDocument.body.innerHTML == "false"){
                // In Opera event is fired second time
                // when body.innerHTML changed from false
                // to server response approx. after 1 sec
                // when we upload file with iframe
                return;
            }

            callback();
        });
    },
    /**
     * Returns json object received by iframe from server.
     */
    _getIframeContentJSON: function(iframe){
        // iframe.contentWindow.document - for IE<7
        var doc = iframe.contentDocument ? iframe.contentDocument: iframe.contentWindow.document,
            response;

        try {
            response = eval("(" + doc.body.innerHTML + ")");
        } catch(err){
            response = {};
        }

        return response;
    },
    /**
     * Creates iframe with unique name
     */
    _createIframe: function(id){
        // We can't use following code as the name attribute
        // won't be properly registered in IE6, and new window
        // on form submit will open
        // var iframe = document.createElement('iframe');
        // iframe.setAttribute('name', id);

        var iframe = qq.toElement('<iframe src="javascript:false;" name="' + id + '" />');
        // src="javascript:false;" removes ie6 prompt on https

        iframe.setAttribute('id', id);

        iframe.style.display = 'none';
        document.body.appendChild(iframe);

        return iframe;
    },
    /**
     * Creates form, that will be submitted to iframe
     */
    _createForm: function(iframe, params){
        // We can't use the following code in IE6
        // var form = document.createElement('form');
        // form.setAttribute('method', 'post');
        // form.setAttribute('enctype', 'multipart/form-data');
        // Because in this case file won't be attached to request
        var form = qq.toElement('<form method="post" enctype="multipart/form-data"></form>');

        var queryString = qq.obj2url(params, this._options.action);

        form.setAttribute('action', queryString);
        form.setAttribute('target', iframe.name);
        form.style.display = 'none';
        document.body.appendChild(form);

        return form;
    }
});

/**
 * Class for uploading files using xhr
 * @inherits qq.UploadHandlerAbstract
 */
qq.UploadHandlerXhr = function(o){
    qq.UploadHandlerAbstract.apply(this, arguments);

    this._files = [];
    this._xhrs = [];
    
    // current loaded size in bytes for each file 
    this._loaded = [];
};

// static method
qq.UploadHandlerXhr.isSupported = function(){
    var input = document.createElement('input');
    input.type = 'file';        
    
    return (
        'multiple' in input &&
        typeof File != "undefined" &&
        typeof (new XMLHttpRequest()).upload != "undefined" );       
};

// @inherits qq.UploadHandlerAbstract
qq.extend(qq.UploadHandlerXhr.prototype, qq.UploadHandlerAbstract.prototype)

qq.extend(qq.UploadHandlerXhr.prototype, {
    /**
     * Adds file to the queue
     * Returns id to use with upload, cancel
     **/    
    add: function(file){
        if (!(file instanceof File)){
            throw new Error('Passed obj in not a File (in qq.UploadHandlerXhr)');
        }
                
        return this._files.push(file) - 1;        
    },
    getName: function(id){        
        var file = this._files[id];
        // fix missing name in Safari 4
        return file.fileName != null ? file.fileName : file.name;       
    },
    getSize: function(id){
        var file = this._files[id];
        return file.fileSize != null ? file.fileSize : file.size;
    },    
    /**
     * Returns uploaded bytes for file identified by id 
     */    
    getLoaded: function(id){
        return this._loaded[id] || 0; 
    },
    /**
     * Sends the file identified by id and additional query params to the server
     * @param {Object} params name-value string pairs
     */    
    _upload: function(id, params){
        var file = this._files[id],
            name = this.getName(id),
            size = this.getSize(id);
                
        this._loaded[id] = 0;
                                
        var xhr = this._xhrs[id] = new XMLHttpRequest();
        var self = this;
                                        
        xhr.upload.onprogress = function(e){
            if (e.lengthComputable){
                self._loaded[id] = e.loaded;
                self._options.onProgress(id, name, e.loaded, e.total);
            }
        };

        xhr.onreadystatechange = function(){            
            if (xhr.readyState == 4){
                self._onComplete(id, xhr);                    
            }
        };

        // build query string
        params = params || {};
        params['qqfile'] = name;
        var queryString = qq.obj2url(params, this._options.action);

        xhr.open("POST", queryString, true);
        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
        xhr.send(file);
    },
    _onComplete: function(id, xhr){
        // the request was aborted/cancelled
        if (!this._files[id]) return;
        
        var name = this.getName(id);
        var size = this.getSize(id);
        
        this._options.onProgress(id, name, size, size);
                
        if (xhr.status == 200){
            var response;
                    
            try {
                response = eval("(" + xhr.responseText + ")");
            } catch(err){
                response = {};
            }
            
            this._options.onComplete(id, name, response);
                        
        } else {                   
            this._options.onComplete(id, name, {});
        }
                
        this._files[id] = null;
        this._xhrs[id] = null;    
        this._dequeue(id);                    
    },
    _cancel: function(id){
        this._options.onCancel(id, this.getName(id));
        
        this._files[id] = null;
        
        if (this._xhrs[id]){
            this._xhrs[id].abort();
            this._xhrs[id] = null;                                   
        }
    }
});


function okno(nazwa,szer,wys)
{	 
	if(eval(szer)==0)
		szer = 100;
	if(eval(wys)==0)
		szer = 200;
	AntWindowManager.create("ant_edycja_pola",{fromContainer: false,
						   link:nazwa,
						   width: szer,
						   height: wys+60,
						   iframe:true,
						   zIndex:10000,
						   title: "Edycja pola..."});
}

function closeOkno()
{
	AntWindowManager.close("ant_edycja_pola");
}

function fullscreen(plik,nazwa)
{	 
	//window.open(plik,nazwa,'fullscreen=yes');
}


function UpdateEditableContainer(typ,id,link,panel)
{

	switch(typ)
	{
		case 'DOKI':
		//xajax_OdswiezPoleDokumentu(id);
			link = ant_link('szablon','odswiezpoledokumentu',id,false);
			//$.php(link,{id:id});
			AjaxRequest(link);
		break;
		case '':
			//link = link.replace(/ajax.php/i,"index.php");
			ant_reload_data(link,panel);
		break;
		default:
			window.location = link;
	}
}

function ant_reload_data(link,panel)
{

	if(panel == "")
	{
		//alert("Niezdefiniowany panel");
		//alert(link);
		window.location = link;
	}
	else
	{
		ShowXajaxLoader(true);
		var hideloader = function(){
			ShowXajaxLoader(false);
			SetScrollPanel();
			}
		$('#'+panel).load(link,null,hideloader);
	}
}



function AntWindow (id,opts)
{
		this.WindowElement = id;
		this.LoadOpts(opts);
		this.readyWindow = false;
		var self = this;
		var key = '#'+this.WindowElement;
		var objw = $(key);

		
		if(this.FromContainer )
		{
			this.Content = objw.html();
			objw.remove();
		}
		
		if(this.w)
			this.w.close();

		objw.remove();
		$('body').append('<div id="'+this.WindowElement+'">');
		objw = $(key);
		nowy = false;

		objw.css('width',this.Width+'px');
		objw.css('height',this.Height+'px');
		var zindx = this.ZIndex-5;
		this.w = objw.dialog({autoOpen:false,
								closeOnEscape:false,
								draggable:true,
								height: this.Height,
								width: this.Width,
								modal: true,
								dialogClass: this.ClassName,
								position: ['center','center'],
								resizable: true,
								title: this.Title,
								zIndex: this.ZIndex,
								resize: function(event, ui) 
										{
											//alert($(ui).attr("id"));
											var iframe = $($(this).find(".ant_edycja_pola_remove"));
											if(iframe.length>0)
											{
												var w = $(this).width()-35;
												iframe.css('width',w+'px');
												if(self.Buttons!=null)
												{
													var h = $(this).height()-100;
													iframe.css('height',h+'px');
												}
												else
												{
													var h = $(this).height()-25;
													iframe.css('height',h+'px');
												}
											}
										}
							});


		if(this.Iframe)
		{

			var w = this.Width-85;
			var h = this.Height-30;
			if(self.Buttons==null)
			{
				h = this.Height-60;
			}
			objw.append("<iframe class='ant_edycja_pola_remove' style='width:"+w+"px;height:"+h+"px; border:none;' src='"+this.Link+"'></iframe>");
			
		}
		else
		{
			//if(!this.FromContainer)
			//{
				var wrapHTML = objw.append("<div class='wrap'></div>");
				//var wrap = this.w.getContent().find("div.wrap");
				wrapHTML.css('overflow',"auto");
				wrapHTML.css('padding-right',"10px");
				if(this.Link)
				{
					wrapHTML.html('Wczytywanie...');
					if(this.Callback==null)
					{
						$.get(this.Link,{},function (datahtml)
						{
							wrapHTML.html(datahtml);
						});
					}
					else
					{
						var callaback = this.Callback;
						wrapHTML.load(this.Link,{},
							function()
							{
								callback.call(this);
							});
					}
				}
				if(this.Content)
				{
					wrapHTML.html(this.Content);
				}
				//wrapHTML=null;
		}
		
		if(this.Buttons!=null)
		{
			/*$.each(this.Buttons,function(name, fn)
			{
				
			});*/
			this.w.dialog("option","buttons",this.Buttons);
		}
		
		if(this.AutoOpen)
		{
			this.w.dialog("open");
		}
		//objw = null;
		//title=null
}

AntWindow.prototype.show = function()
{
	this.w.dialog("open");
	//this.w.dialog('open');
	//this.w.dialog('option', 'stack', false);
}

AntWindow.prototype.close = function()
{
	this.w.dialog("close");
}

AntWindow.prototype.LoadOpts = function (opts)
{
	
	this.Buttons = opts.buttons||null;
	this.Link = opts.link;
	this.FromContainer = opts.fromContainer;
	this.Content = opts.content;
	this.Width = opts.width||400;
	this.Height  = opts.height||400;
	this.Title = opts.title;
	this.AutoOpen = (undefined == opts.autoOpen)?true:opts.autoOpen ;
	this.Modal = (undefined == opts.modal)?true:opts.modal ;
	this.Iframe = (undefined == opts.iframe)?false:opts.iframe ;
	this.ZIndex = opts.zIndex || 1000;
	this.Callback = (undefined == opts.callback)?null:opts.callback ;
	this.ClassName = (undefined == opts.className)?'':opts.className; 
}

AntWindow.prototype.Reload = function (opts)
{
	this.LoadOpts(opts);
	var key = '#'+this.WindowElement;
	var objw = $(key);

	objw.css('width',this.Width+'px');
	objw.css('height',this.Height+'px');


	var zindx = this.ZIndex-5;
	
		this.w = objw.dialog({autoOpen:false,
								closeOnEscape:false,
								draggable:true,
								height: this.Height,
								width: this.Width,
								dialogClass: this.ClassName,
								modal: true,
								position: ['center','center'],
								resizable: true,
								title: this.Title,
								zIndex: this.ZIndex								
							});
	this.w.dialog("option",'height',this.Height);
	this.w.dialog("option",'width',this.Width);
	this.w.dialog("option",'title',this.Title);
	this.w.dialog("option",'zIndex',zindx);


	if(this.Iframe)
	{
		var iframe = objw.find("iframe.ant_edycja_pola_remove");
		iframe.remove();
		var w = this.Width-85;
		var h = this.Height-30;
		if(self.Buttons==null)
		{
			h = this.Height-60;
		}
		objw.append("<iframe class='ant_edycja_pola_remove' style='width:"+w+"px;height:"+h+"px; border:none;' src='"+this.Link+"'></iframe>");
		//iframe=null;
	}
	else
	{
		if(!this.FromContainer)
		{
			var wrapHTML = objw.find("div.wrap");
			wrapHTML.css('overflow',"auto");
			wrapHTML.css('padding-right',"10px");

			if(this.Link)
			{
				wrapHTML.html('Wczytywanie...');
				if(this.Callback==null)
				{
					$.get(this.Link,{},function (datahtml)
					{
						wrapHTML.html(datahtml);
					});
				}
				else
				{
					var callaback = this.Callback;
					wrapHTML.load(this.Link,{},
						function()
						{
							callback.call(this);
						});
				}
			}
			if(this.Content)
			{
				wrapHTML.html(this.Content);
			}
			//wrap=null;
		}
	}
	/*var buttons = this.w.getContent().find("div.buttons");
	if(buttons.length>0)
	{
		buttons.find('button').remove();
		buttons.remove();
	}
	buttons = null;
	if(this.Buttons!=null)
	{
		var buttonsPanel = $("<div class='buttons'></div>").appendTo(objw);
		$.each(this.Buttons,function(name, fn)
					{
						$('<button type="button"></button>')
							.addClass('buttons ')
							.text(name)
							.click(function() { fn.apply(self, arguments); })
							.appendTo(buttonsPanel);
					});
	}*/

	if(this.Buttons!=null)
	{
		this.w.dialog("option","buttons",this.Buttons);
	}

	if(this.AutoOpen)
	{
		this.w.dialog("open");
	}

	//objw = null;
	//title=null

}


var AntWindowManager = 
{
	windows: {},
	create: function(id,opts)
	{
		if(typeof(this.windows[id])=="undefined")
		{
			this.windows[id] = new AntWindow(id,opts);
		}
		else
		{
			//this.windows[id].w.load();
			//this.windows[id].Reload(opts);
			this.windows[id].w.dialog('destroy');
			this.windows[id] = new AntWindow(id,opts);
		}
	},

	show: function(id)
	{
		this.windows[id].show();
	},

	close: function(id)
	{
		this.windows[id].close();
	},

	width: function(id)
	{
		return this.windows[id].Width;
	},
	height: function(id)
	{
		return this.windows[id].Height;
	}

}


function createCookie(name,value,seconds) 
{
	if (seconds) 
	{
		var date = new Date();
		date.setTime(date.getTime()+(seconds*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else 
		var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) 
{
	createCookie(name,"",-1);
}


/*
 * jQuery UI Photoviewer @VERSION
 *
 * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Depends:
 *	ui.core.js
 *  effects.core.js
 *  effects.drop.js
 *  jquery.mousewheel.js (optional)
 */
(function($) {
	
	$.widget('ui.photoviewer',{options: {
			loop: true,
			overlay: true,
			nextHtml: "Dalej",
			prevHtml: "Wstecz",
			closeHtml: "Close",
			selector: "a[href]:has(img[src])",
			titleSuffix: "Klikkelj a képre a bezáráshoz",
			rotateIn: function(direction) {
				$(this).effect("drop", {
					direction: direction,
					mode: "show"
				});
			},
			rotateOut: function(direction, finished) {
				$(this).effect("drop", {
					direction: direction
				}, "normal", finished);
			},
			show: function(anchor) {
				var thumb = $(anchor),
					offset = thumb.offset();
				// TODO refactor
				var start = {
					left: offset.left,
					top: offset.top,
					width: thumb.width(),
					height: thumb.height(),
					opacity: 0
				}
				var img = $(this);
				var stop = {
					left: img.css("left"),
					top: img.css("top"),
					width: img.width(),
					height: img.height(),
					opacity: 1
				}
				$(this).css(start).show().animate(stop);
			},
			showOverlay: function() {
				$(this).fadeIn();
			},
			hide: function(anchor, finished) {
				var thumb = $(anchor),
					offset = thumb.offset();
				// TODO refactor (see above)
				var stop = {
					left: offset.left,
					top: offset.top,
					width: thumb.width(),
					height: thumb.height(),
					opacity: 0
				}
				$(this).animate(stop, finished);
			},
			hideOverlay: function(finished) {
				$(this).fadeOut(finished);
			}
		},
		_init: function() {
			var self = this;
			// consider event delegation to make this more dynamic
			this._anchors().click(function(event) {
				event.preventDefault();
				if (self.overlayElement || self.viewerElement)
					return;
				self._display(this);
				return false;
			});
			/*$(document).click(function(event) {
				// ignore right click
				//if (event.button != 2)
				//	self.close();
			})*/
			$(document).keydown(function(event) {
				if (!self.currentAnchor)
					return;
				switch(event.keyCode) {
					case $.ui.keyCode.ESCAPE:
						self.close();
						break;
					case $.ui.keyCode.LEFT:
						self.prev("left");
						event.preventDefault();
						break;
					case $.ui.keyCode.UP:
						self.prev("up");
						event.preventDefault();
						break;
					case $.ui.keyCode.RIGHT:
						self.next("right");
						event.preventDefault();
						break;
					case $.ui.keyCode.DOWN:
						self.next("down");
						event.preventDefault();
						break;
				}
			});
			$(window).resize(function() {
				if (!self.currentAnchor)
					return;
				self._resize(self._viewer().find("img"));
				self._position(self._viewer());
				self._shadow(self._viewer());
			});
			if ($.fn.mousewheel) {
				$(document).mousewheel(function(event, delta) {
					if (!self.currentAnchor)
						return;
					event.preventDefault();
					if (self.viewerElement.is(":animated"))
						return;
					if (delta < 0) {
						self.next("down");
					}
					if (delta > 0) {
						self.prev("up");
					}
				});
			}
		},
		
		_showLoadingIndicator: function() {
			var self = this;
			this.loadingIndicatorTimeout = setTimeout(function() {
				if (!self.loadingIndicator) {
					self.loadingIndicator = self._element("div", "ui-loading-indicator ui-corner-all").appendTo(document.body);
				}
				self._position(self.loadingIndicator);
				self.loadingIndicator.fadeIn("slow");
			}, 250);
		},
		
		_hideLoadingIndicator: function() {
			clearTimeout(this.loadingIndicatorTimeout);
			this.loadingIndicator && this.loadingIndicator.hide();
		},
		
		close: function() {
			if (!this.currentAnchor)
				return;
			var self = this;
			var anchor = this.currentAnchor;
			this.currentAnchor = null;
			
			// client has to invoke callbacks, but scope/args don't matter
			var viewer = this._viewer();
			this.options.hide.call(viewer[0], anchor, function() {
				viewer.remove();
				self.navigateElement.remove();
				self.titleElement.remove();
				self.prevElement.remove();
				self.nextElement.remove();
				self.closeElement.remove();
				self.viewerElement = null;
				self.navigateElement = null;
				self.titleElement = null;
				self.prevElement = null;
				self.nextElement = null;
				self.closeElement = null;
			});
			var overlay = this._overlay();
			this.options.hideOverlay.call(overlay[0], function() {
				overlay.remove();
				self.overlayElement = null;
			});
		},
		
		next: function(direction) {
			this._rotate(":gt(", ":first", direction || "up");
		},
		
		prev: function(direction) {
			this._rotate(":lt(", ":last", direction || "down");
		},
		
		_anchors: function() {
			// if deemed necessary, cache selection here
			return this.element.find(this.options.selector);
		},
		
		_display: function(anchor, direction) {
			if (!anchor)
				return;
				
			var self = this,
				visible = this.viewerElement && this.viewerElement.is(":visible");
				
			this.currentAnchor = anchor;
			
			if (direction) {
				var previous = this._viewer();
				var pNavigateElement = this.navigateElement;
				var pCloseElement = this.closeElement;
				this.options.rotateOut.call(previous[0], direction, function() {
					previous.remove();
					pNavigateElement.remove();
					pCloseElement.remove();
				});
			}
			this._showLoadingIndicator();
			
			this._viewer("new").attr("title", anchor.title + this.options.titleSuffix).children("img").one("load", function() {
				var $this = $(this).parent();
				self._hideLoadingIndicator();
				self._resize($(this));
				self._position($this);
				self._shadow($this);
				self._overlay().attr("title", anchor.title + self.options.titleSuffix)
				self.titleElement.html(anchor.title);
				var anchors = self._anchors();
				index = anchors.index(self.currentAnchor);
				if(index==0)
				{
					self.prevElement.hide();
				}
				else
				{
					self.prevElement.show();
				}
				if(index>=anchors.length-1)
				{
					self.nextElement.hide();
				}
				else
				{
					self.nextElement.show();
				}
				if(anchors.length<=1)
				{
					if(anchor.title=="")
						self.navigateElement.hide();
				}
				else
				{
					self.navigateElement.show();
				}
				if (visible) {
					self.options.rotateIn.call($this[0], {
						up: "down",
						down: "up",
						left: "right",
						right: "left"
					}[direction]);
				} else {
					self._overlay().css({
						left: $(window).scrollLeft(),
						top: $(window).scrollTop()
					}).each(self.options.showOverlay);
					self.options.show.call($this, anchor);
				}
				self._preloadNeighbours();
			}).attr("src", anchor.href);
		},
		
		_preloadNeighbours: function() {
			var anchors = this._anchors(),
				index = anchors.index(this.currentAnchor);
			anchors.filter(this._neighbours(anchors.length, index)).each(function() {
				new Image().src = this.href;
			});
		},
		
		_neighbours: function(index, length) {
			return ":eq(" + (index == 0 ? length - 1 : index - 1) + "), :eq(" + (index == length - 1 ? 0 : index + 1) + ")";
		},
		
		_position: function(img) {
			img.css({
				left: $(window).width() / 2 - img.outerWidth() / 2 + $(window).scrollLeft(),
				top: $(window).height() / 2 - (img.outerHeight() / 2+50) + $(window).scrollTop()
			});
		},
		
		_resize: function(img) {
			// TODO cleanup
			var imgx = img.parent();
			if ($.browser.msie) {
				img.css("width", "auto");
			}
			imgx.css("width", "").css("height", "");
			var outerWidth = imgx.width(),
				outerHeight = imgx.height(),
				ratio = Math.min(Math.min($(window).width() - 36, outerWidth) / outerWidth, Math.min($(window).height() - 180, outerHeight) / outerHeight);
			img.css("width", "");
			//console.log(imgx.outerWidth(), imgx.outerHeight(), imgx.width(), imgx.height())
			//console.log(img, outerWidth, outerHeight, borderWidth, borderHeight, ratio)
			ratio = Math.min(ratio, 1);
				imgx.css({
					width: Math.round(ratio * outerWidth),
					height: Math.round(ratio * outerHeight)
				});
		},
		
		_rotate: function(selectorA, selectorB, direction) {
			if (!this.currentAnchor)
				return;
			var anchors = this._anchors();
			var target = anchors.filter(selectorA + anchors.index(this.currentAnchor) + ")" + selectorB)[0];
			if (!target && this.options.loop && anchors.length > 1) {
				target = anchors.filter(selectorB)[0];
			}
			this._display(target, direction);
		},
		
		_viewer: function(create) {
			if (create || !this.viewerElement) {
				var self = this;
				this.viewerElement = this._element("div", "ui-photoviewer-container").append(this._element("img", "ui-photoviewer ui-corner-all").show()).appendTo(document.body);
				this.navigateElement = this._element("div", "ui-photoviewer-navigate").appendTo(document.body).hide();
				this.titleElement = this._element("div", "ui-photoviewer-title").appendTo(this.navigateElement).show();
				this.prevElement = this._element("div", "ui-photoviewer-button-prev").appendTo(this.navigateElement).hide().html(this.options.prevHtml);
				this.nextElement = this._element("div", "ui-photoviewer-button-next").appendTo(this.navigateElement).hide().html(this.options.nextHtml);
				this.closeElement = this._element("div", "ui-photoviewer-button-close").appendTo(document.body).show().html(this.options.closeHtml);
				this.prevElement.click(function(){
													self.prev("right");
												});
				this.nextElement.click(function(){
													self.next("left");
												});
				this.closeElement.click(function(){
													self.close();
												});

			}
			return this.viewerElement;
		},
		
		_overlay: function() {
			if (!this.options.overlay)
				return $([]);
			if (!this.overlayElement) {
				this.overlayElement = $.ui.dialog.overlay.create(this._viewer());
					//this._element("div", "ui-widget-overlay").appendTo(document.body);
			}
			return this.overlayElement;
		},
		
		_element: function(type, clazz) {
			return $("<" + type + "/>").addClass(clazz).hide();
		},
		
		_shadow: function(viewer) {
			if (!$.support.canvas)
				return;
			
			viewer.children("canvas").remove();
			
			// TODO compute these hardcoded values
			var width = viewer.width() + 45,
				height = viewer.height() + 45,
				cradius = 10; 
			var canvas = $("<canvas/>").addClass("ui-photoviewer-shadow").appendTo(this._viewer())[0];
			canvas.width = width; canvas.height = height;
			var ctx = canvas.getContext("2d");
			
			
			for (var i = 0; i < 15; i++) {
				ctx.fillStyle = "rgba(150, 150, 150, " + (0.2/15*i) + ")";
				ctx.beginPath();
				ctx.moveTo(cradius + i, i);
				ctx.quadraticCurveTo(i, i, i, cradius + i);
				
				// wrong
				ctx.lineTo(i, height - cradius);
				ctx.quadraticCurveTo(i, height, cradius + i, height);
				
				ctx.lineTo(width - cradius, height);
				ctx.quadraticCurveTo(width, height, width, height - cradius);
				
				// wrong
				ctx.lineTo(width, cradius + i);
				ctx.quadraticCurveTo(width, i, width - cradius, i);
				
				ctx.lineTo(cradius, i);
				ctx.fill();
				width--;
				height--;
			}
			// TODO refactor into drawRoundedBox(width, height, cradius)
			i=0;
			ctx.fillStyle = "white";
			ctx.beginPath();
			ctx.moveTo(cradius + i, i);
			ctx.quadraticCurveTo(i, i, i, cradius + i);
			
			// wrong
			ctx.lineTo(i, height - cradius);
			ctx.quadraticCurveTo(i, height, cradius + i, height);
			
			ctx.lineTo(width - cradius, height);
			ctx.quadraticCurveTo(width, height, width, height - cradius);
			
			// wrong
			ctx.lineTo(width, cradius + i);
			ctx.quadraticCurveTo(width, i, width - cradius, i);
			
			ctx.lineTo(cradius, i);
			ctx.fill();
		}
	});
	
	$.support.canvas = !!$("<canvas/>")[0].getContext

	$.extend($.ui.photoviewer, {
		version: "1.8"
	});

})(jQuery);

/**
 * This jQuery plugin creates an animated slider with the child elements as frames.
 
 simpleslider
	create/modify/register required markup
		wrapper - simply wraps all elements, no functionality
		boundary - encloses all children elements, shows only a single frame
		container - holds all frames, distrubutes them in correct order/position
		frames
	create requested controls
		prev/next
		navigation
	execute transition
		slide
			easing
			direction
		fade
		cut
	modify controls when necessary
	set timer for automatic transition
	
	
 *
 * @author Justin Jones (justin(at)jstnjns(dot)com)
 * @version 1.3
 * 
 * New Features from 1.2:
 *  - Cleaned up codebase (check to see if the settings you are implimenting
 *    not deprecated or changed, as well as CSS [revamped a lot])
 *  - Changed buttons to anchor tags for better CSS flexibility
 *  - Added 'fade' and 'cut' transitions
 *
 * New Features from 1.1:
 *  - Easing
 *  - Multiple instances can now run on the same page
 *
 * New Features from 1.0:
 * 	- Vertical scrolling
 * 	- Buttons are optional
 * 	- Speed settings
 *
 */
(function($){
	$.fn.simpleslider = function(settings) {
		
		var defaults = {
			transition		: 'slide', // cut, fade
			easing			: 'swing', // linear
			direction		: 'horizontal', // for 'slide' style transition
			speed			: 500, // for 'slide' and 'fade' style transitions
			auto			: false,
			interval		: 2000, // pause between transitions if 'auto' is set to TRUE
			hoverPause		: true,
			// navigation	: true,
			buttons			: true,
			prevText		: 'Previous',
			nextText		: 'Next',
			loop			: true
		};
		
		settings = $.extend({}, defaults, settings); 
		
		$(this).each(function() {
			// ----------------------------------------------------------------|| Setting Vars ||
			var $this = $(this),
			$frames,
			$wrapper,
			$boundary,
			$container,
			$prev,
			$next,
			$navigation,
			boundaryWidth,
			boundaryHeight,
			frameWidth,
			frameHeight,
			frameCount,
			currentFrame = 1,
			auto,
			
			_init = function() {
				
				// Set up the basic physical structure of the slider
				$wrapper	= $this
								.wrap('<div />')
									.parent()
									.addClass('slider-wrapper');
								
				$boundary	= $this
								.wrap('<div />')
									.parent()
										.addClass('slider-boundary');
								
				$container	= $this
								.addClass('slider-container');
									
				$frames		= $this
								.children()
								.addClass('slider-slide');
								
				if(settings.buttons) {
					$prev	= $('<a />')
								.addClass('slider-control-prev')
								.text(settings.prevText)
								.click(function(e){ 
									e.preventDefault()
									
									if(!$this.hasClass('disabled')) {
										_transition(currentFrame - 1);
									}
								 });
								
					$next	= $('<a />')
								.addClass('slider-control-next')
								.text(settings.nextText)
								.click(function(e){
									e.preventDefault();
									
									if(!$this.hasClass('disabled')) {
										_transition(currentFrame + 1);
									}
								});
								
					$wrapper
						.append($prev)
						.append($next);
				}
				
				// if(settings.navigation) {
				// 	var tab = {};
				// 	
				// 	$navigation		= $('<ol />')
				// 						.addClass('slider-control-navigation');
				// 						
				// 	$frames.each(function(i) {
				// 		tab[i] = i;
				// 	})
				// }
							
				// Get values and dimensions necessary for more advanced structure
				frameCount = $frames.length;
				
				frameWidth = 0;
				frameHeight = 0;
				
				boundaryWidth = 0;
				boundaryHeight = 0;
				
				$frames.each(function() {
					if($(this).width() > frameWidth) frameWidth = $(this).width(); // Get widest frame's width
					if($(this).height() > frameHeight) frameHeight = $(this).height(); // Get tallest frame's height
					
					if($(this).outerWidth(true) > boundaryWidth) boundaryWidth = $(this).outerWidth(true); // Get widest frame's outer width
					if($(this).outerHeight(true) > boundaryHeight) boundaryHeight = $(this).outerHeight(true); // Get tallest frame's outer height
				});
				
				// Set dimensions on elements that need sizing

				$frames.css({
					width	: frameWidth,
					height	: frameHeight,
					float	: 'left'
				});
				
				if(settings.transition == 'slide') {
					if(settings.direction == 'horizontal') {
						$container.css({
							width	: boundaryWidth * frameCount,
							height	: boundaryHeight,
							overflow: 'hidden'
						});
					} else {
						$container.css({
							width	: boundaryWidth,
							height	: boundaryHeight * frameCount,
						overflow: 'hidden'
						});
					}
				} else {
					$container.css({
						position: 'relative',
						width	: boundaryWidth,
						height	: boundaryHeight
					});
					
					$frames
						.css({
							position: 'absolute',
							left	: 0,
							top		: 0
						})
						.hide();
					
					$frames.eq(0)
						.show();
				}
					
				$boundary.css({
					width	: boundaryWidth,
					height	: boundaryHeight,
					overflow: 'hidden'
				});
				
				if(settings.auto) {
					_startTimer(settings.interval);
					
					if(settings.hoverPause) {
						$wrapper.hover(function() {
							_stopTimer();
						}, function() {
							_startTimer();
						});
					}
				}
				
			},

			// Transitions to frame
			_transition = function(toFrame) {
				
				// LOOPING
				// If out of bounds, send to the opposite side
				if(settings.loop) {
					if(toFrame > frameCount) {
						_transition(1);
						return;
					} else if(toFrame <= 0) {
						_transition(frameCount);
						return;
					}
					
				// NON-LOOPING
				// If out of bounds, do nothing
				} else {
					if(toFrame > frameCount || toFrame <= 0) return;
				}
				
				switch(settings.transition) {
					case 'slide':
						var diff = toFrame - currentFrame;
						_slide(diff);
						break;
						
					case 'fade':
						_fade(toFrame);
						break;
						
					default:
						_cut(toFrame);
						break;
				}
				
				currentFrame = toFrame;
				
				/*
					TODO get the button disabling / enabling and looping to work
				*/
				if(!settings.loop) {
					// Sets 'previous' button to disabled if on first frame
					if(currentFrame == 1) {
						$prev.addClass('disabled');
					} else {
						$prev.removeClass('disabled');
					}
						
					// Sets 'next' button to disabled if on last frame
					if(currentFrame == frameCount) {
						$next.addClass('disabled');
					} else {
						$next.removeClass('disabled');;
					}
				}
				
			},
			
			_slide = function(frames) {
				
				if(settings.direction == 'horizontal') {
					$this.stop().animate({
						marginLeft: (-1) * (currentFrame + frames - 1) * boundaryWidth + 'px'
					}, settings.speed, settings.easing);
				} else if(settings.direction == 'vertical') {
					$this.stop().animate({
						marginTop: (-1) * (currentFrame + frames - 1) * boundaryHeight + 'px'
					}, settings.speed, settings.easing);
				}
				
			},
			
			_fade = function(toFrame) {
				
				$frames.eq(toFrame - 1)
					.fadeIn(settings.speed);
					
				$frames.eq(currentFrame - 1)
					.fadeOut(settings.speed);
				
			},
			
			_cut = function(toFrame) {
				
				$frames.eq(toFrame - 1)
					.show();
					
				$frames.eq(currentFrame - 1)
					.hide();
					
			},

			_startTimer = function() {
				auto = setInterval(function() {
					_transition(currentFrame + 1);
				}, settings.interval);
			},
			
			_stopTimer = function() {
				if(settings.auto !== false){
					clearInterval(auto);
				}
			}
			
			_init();
		});
	}
})(jQuery);

function TVPodhaleBanerVideo(kod)
{
	kod='reklama';
	var obj = $("<div></div>");
	obj.addClass('ui-widget-overlay');
	obj.attr('id','baner_video_'+kod);
	obj.attr('rel','kod');
	obj.appendTo(document.body);
	obj.css('width',$(document.body).width()+'px');
	obj.css('height',$(window.document).height()+'px');
	obj.css('z-index',10000);

	var player = $("<div></div>");
	player.attr('id','player_video_'+kod);
	player.css('position','absolute');
	player.css('width','600px');
	player.css('height','500px');
	player.css('left','50%');
	player.css('top','100px');
	player.css('margin-left','-300px');
	player.css('z-index',10001);
	player.appendTo(document.body);
	var playerC = $("<div></div>");
	playerC.attr('id','swf_player_video_'+kod);
	playerC.appendTo(player);

	var mv = 
	{
		video:'http://z-ne.pl/kamery/zne//filmy/18_10_2010.flv', 
		autostart:"true"
	}

	var mp = 
	{
		allowfullscreen:"true"
	}

	var ma = 
	{
		id:"baner_player",  
		name:"baner_player"
	}

	swfobject.embedSWF("http://tvpodhale.info/reklama.swf", 'swf_player_video_'+kod, "600", "500", "9.0.115", false, mv, mp, ma);
}

function CloseVideoBaner()
{
	$('#player_video_reklama').remove(); 
	$('#baner_video_reklama').remove();
}



