var selected_menu=1;

var current_id=1;
var what_s = new Array();
what_s[1]="video";
what_s[2]="photo";


var cur_action="";

function del_select(id){
     if (id==0){return;}
             document.getElementById('tr_'+id+'_').style.backgroundImage="url(images/pixel.gif)";
             document.getElementById('tr_d_'+id+'_').style.backgroundImage="url(images/pixel.gif)";
             document.getElementById('tr_'+id+'_').style.backgroundImage="url(images/pixel.gif)";
             document.getElementById('b_l_'+id+'_').src='images/pixel.gif';
             document.getElementById('b_d_l_'+id+'_').src='images/pixel.gif';
             document.getElementById('b_d_r_'+id+'_').src='images/pixel.gif';
             document.getElementById('b_r_'+id+'_').src='images/pixel.gif';
             document.getElementById('b_d_'+id+'_').src='images/pixel.gif';
     return;
}
function set_select(id){
  //   if (document.findform.query){
   //          document.findform.query.focus();
  //   }
     if (current_id==id){return;}
     if (id==0){return;}
             del_select(current_id);
             document.getElementById('tr_d_'+id+'_').style.backgroundImage="url(images/b_d_bg.gif)";
             document.getElementById('tr_'+id+'_').style.backgroundImage="url(images/b_bg.gif)";
             document.getElementById('b_l_'+id+'_').src='images/b_l.gif';
             document.getElementById('b_r_'+id+'_').src='images/b_r.gif';
             document.getElementById('b_d_'+id+'_').src='images/b_d.gif';
             document.getElementById('b_d_l_'+id+'_').src='images/b_d_l.gif';
             document.getElementById('b_d_r_'+id+'_').src='images/b_d_r.gif';
             current_id=id;
             document.findform.type.value=what_s[id];
     return;
}
function submit_form(){
     if (document.findform.query.value!=''){
           //  document.location.href=document.findform.action.value+document.findform.findtext.value;
     }
}

set_select(selected_menu);


var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}



////
function initfadeIn(id, speed)
{
        var image = document.getElementById(id);
        setOpacity(image, 0);
        //image.style.visibility = "visible";
        fadeIn(id, 0, speed);
}

function initfadeOut(id, speed)
{
        var image = document.getElementById(id);
        setOpacity(image, 100);
        fadeOut(id, 100, speed);
}

function setOpacity(obj, opacity)
{
        obj.style.filter = "alpha(opacity:"+opacity+")";
        obj.style.KHTMLOpacity = opacity/100;
        obj.style.MozOpacity = opacity/100;
        obj.style.opacity = opacity/100;
}

function fadeIn(objId, opacity, speed)
{
        if (document.getElementById)
        {
                obj = document.getElementById(objId);
                if (opacity <= 100)
                {
                        setOpacity(obj, opacity);
                        opacity += 20;
                        window.setTimeout("fadeIn(\""+objId+"\", "+opacity+", "+speed+")", speed);
                }
        }
}

function fadeOut(objId, opacity, speed)
{
        if (document.getElementById)
        {
                obj = document.getElementById(objId);
                if (opacity >= 0)
                {
                        setOpacity(obj, opacity);
                        opacity -= 20;
                        window.setTimeout("fadeOut(\""+objId+"\", "+opacity+", "+speed+")", speed);
                }
        }
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else 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 show_hide(id,other)
{
       var myelid = document.getElementById(id);
       var otherid = document.getElementById(other);

       active_menu = id;
       unactive_menu = other;

       if ( myelid.style.display == 'block' )
       {
       initfadeOut(id, 10);
       myelid.style.display = 'none';
       initfadeIn(other, 10);
       otherid.style.display = 'block';
       }
       else
       {

       initfadeOut(other, 10);
       myelid.style.display = 'block';
       initfadeIn(id, 10);
       otherid.style.display = 'none';

       }

}


function hide(id)
{
       var myelid = document.getElementById(id);
       myelid.style.display = 'none';

}

function show(id)
{
       var myelid = document.getElementById(id);
       myelid.style.display = 'block';


}


function imagepreview(id)
{
         window.open(my_base + 'image.php?action=imagepreview&id='+id, '', 'resizable=1,HEIGHT=50,WIDTH=50, scrollbars=yes');
}


function hide_show_panel(id)
{

       var myimgid = document.getElementById('arr_'+id);
       var myeid = document.getElementById('panel_'+id);


       if ( myeid.style.display == 'block' )
       {

       myeid.style.display = 'none';
       myimgid.src  = 'images/aup.gif';
       }
       else
       {


       myeid.style.display = 'block';
       myimgid.src  = 'images/adown.gif';

       }



}


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




var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 0, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim() //call iframe shim function
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=document.getElementById("iframeshim") //reference iframe object
}
}

}




function $(name) {
        if (document.getElementById) {
                return document.getElementById(name);
        } else if (document.all) {
                return document.all[name];
        } else if (document.layers){
                return document[name];
        } else {
                return 0;
        }
}

function get_radio_val(field)
{
if (field.type == "radio")
{
    if (field.checked)
        return field.value;
    else
        return "";
}
if (field[0].type == "radio")
{
    for (i = 0; i < field.length; i++)
    {
        if (field[i].checked)
            return field[i].value;
    }
    return "";
}
return "";
}





var copytoclip=1

function HighlightAll(theField) {
var tempval=eval("document.forms."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status= gettext('linkcopid');
//alert('?? ??? ?????? ?? ??????? ???? ?? ????? ?? ??? ????');
setTimeout("window.status=''",1800)
}
}





var ic=new Array(); for(var i=0;i<=5;i++) { ic[i]=new Image(); ic[i].src='images/rate/rate'+i+'.gif'; };
var cOb=new Array();
var timer;
function rOv(obj,evt) {
        if(!cOb[obj.name]) cOb[obj.name]=obj.src;
        if(document.all && !window.opera) evt=event;
        on=getM(getCCWT(evt).x);
        obj.style.cursor="pointer";
        document[obj.name].src=ic[on].src;
};
function rOf(obj) {        if(cOb[obj.name]) obj.src=cOb[obj.name]; };
function getM(objMX) {
        on=0;
        if(objMX>=0 && objMX<=13) on=1;
        if(objMX>=14 && objMX<=27) on=2;
        if(objMX>=28 && objMX<=41) on=3;
        if(objMX>=42 && objMX<=55) on=4;
        if(objMX>=56 && objMX<=65) on=5;
        return on;
};
function rOc(obj,evt,typ,id) {
      //  var oVoteIFrame = parent.document.getElementById('glosowanie');

        if(document.all && !window.opera) evt=event;

        on=getM(getCCWT(evt).x);


        document[obj.name].src=ic[on].src;

        document.forms.rate.myrate.value = on;
        document.forms.rate.submit()


}


function getCCWT(evt) {
        var coords = { x: 0, y: 0};
        if(document.all && !window.opera) {
                evt = window.event;
                coords.x=evt.offsetX;
                coords.y=evt.offsetY;
        } else {
                var Element=evt.target;
                var cTLeft=0;
                var cTTop=0;
                while (Element.offsetParent) {
                        cTLeft+=Element.offsetLeft;
                        cTTop+=Element.offsetTop;
                        Element = Element.offsetParent ;
                }
                coords.x=evt.pageX-cTLeft;
                coords.y=evt.pageY-cTTop;
        }
        return coords;
}

   function open_smilies(mbase)
   {

        myleft=80;
        mytop=20;
        settings="width=300,height=320,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no";
        win=window.open(mbase+'smilies.php','smilie',settings);
        win.focus();

   }


   function fullpreview(id,url)
   {

        myleft=80;
        mytop=20;
        settings="width=300,height=320,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no";
        win=window.open(url+'image.php?id='+ id,'imgs',settings);
        win.focus();

   }


function submit_form(){
     if (document.findform.query.value ==''){

    alert("?? ???? CII? ???CE C?E?E");
    document.findform.query.focus();
    return false ;
    }
 return true;

}

var defaultBackgroundColor = "blue";
var currentBackgroundColor;

function setBackgroundColor(color) {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      /*a.disabled = !(a.getAttribute("title") == color);
      if(a.getAttribute("title") == color)
        alert(a.getAttribute("title"));*/

      a.disabled = true;
      if(a.getAttribute("title") == color) a.disabled = false;
    }
  }

  currentBackgroundColor = color;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else 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;
}

/*window.onload = function(e) {
  var cookie = readCookie("backgroundColor");
  var bgColor = cookie ? cookie : defaultBackgroundColor;
  setBackgroundColor(bgColor);
}*/

window.onunload = function(e) {
  createCookie("backgroundColor", currentBackgroundColor, 365);
}

var cookie = readCookie("backgroundColor");
var bgColor = cookie ? cookie : defaultBackgroundColor;
setBackgroundColor(bgColor);




// JScript File

/************************************************************************************************************

************************************************************************************************************/

function slider(innerDivID, outerDivID, colCount, cellCount, leftArrowID, rightArrowID, objectID, pager)
{
    this.slideSpeed = 1;
    this.slideSteps = 15;
    var rest = cellCount - (colCount % cellCount);
    if(rest == cellCount)
        rest = 0;
    this.columnsOfThumbnails = parseInt((parseInt(colCount) + parseInt(rest)));
    this.cellCount = cellCount;

    this.thumbsColIndex = 0;
    this.thumbsLeftPos = false;

    this.DHTMLgoodies_slideWidth = false;
    this.DHTMLgoodies_thumbTotalWidth = false;
    this.DHTMLgoodies_viewableWidth = false;

    this.DHTMLgoodies_thumbDiv = document.getElementById(innerDivID);
    this.leftArrowObj = document.getElementById(leftArrowID);
    this.rightArrowObj = document.getElementById(rightArrowID);

    this.DHTMLgoodies_thumbSlideInProgress = false;

    this.DHTMLgoodies_thumbs_outer_ID = outerDivID;

    this.Pager = pager.split(";");

    this.slideThumbs = slideThumbs;

    this.moveThumbnailsLeft = moveThumbnailsLeft;

    this.moveThumbnailsRight = moveThumbnailsRight;

    this.moveMultiplePages = moveMultiplePages;

    this.ID = objectID;

    if(this.columnsOfThumbnails > 0)
    {
	    this.leftArrowObj.style.cursor = 'pointer';
	    this.rightArrowObj.style.cursor = 'pointer';
	    var slider = this;
	    this.leftArrowObj.onclick = function(e)
	    {
	        moveThumbnailsLeft(slider);
	    }
	    this.rightArrowObj.onclick = function(e)
	    {
	        moveThumbnailsRight(slider);
	    }
	    this.DHTMLgoodies_slideWidth = this.DHTMLgoodies_thumbDiv.getElementsByTagName('DIV')[0].offsetWidth;
	    this.DHTMLgoodies_thumbDiv.style.left = '0px';

	    var subDivs = this.DHTMLgoodies_thumbDiv.getElementsByTagName('DIV');
	    this.DHTMLgoodies_thumbTotalWidth = 0;
	    var tmpLeft = 0;
	    for(var no = 0; no < subDivs.length; no++)
	    {
		    if(subDivs[no].className == 'strip_of_thumbnails')
		    {
			    this.DHTMLgoodies_thumbTotalWidth = this.DHTMLgoodies_thumbTotalWidth + this.DHTMLgoodies_slideWidth;
			    subDivs[no].style.left = tmpLeft + 'px';
			    subDivs[no].style.top = '0px';
			    tmpLeft = tmpLeft + subDivs[no].offsetWidth;
		    }
	    }
	    this.DHTMLgoodies_thumbTotalWidth = this.DHTMLgoodies_slideWidth * this.columnsOfThumbnails;
	    this.DHTMLgoodies_viewableWidth = document.getElementById(this.DHTMLgoodies_thumbs_outer_ID).offsetWidth;
	    this.DHTMLgoodies_slideWidth = this.DHTMLgoodies_slideWidth * cellCount;
	}
	else
	{
	    this.leftArrowObj.style.visibility = 'hidden';
	    this.rightArrowObj.style.visibility = 'hidden';
	}
}

function moveThumbnailsLeft(slider)
{
	if(slider.DHTMLgoodies_thumbSlideInProgress)
	    return;
	slider.DHTMLgoodies_thumbSlideInProgress = true;

	slider.thumbsColIndex--;
	slider.slideThumbs(slider.slideSteps,0);

	for(var k=0; k < slider.Pager.length; k++)
	{
	    if(k == slider.thumbsColIndex)
	        document.getElementById(slider.Pager[k]).src = "images/imgPagerMiddle.gif";
	    else
	        document.getElementById(slider.Pager[k]).src = "images/imgPager.gif";
	}
}

function moveThumbnailsRight(slider)
{
	if(slider.DHTMLgoodies_thumbSlideInProgress)
	    return;
	slider.DHTMLgoodies_thumbSlideInProgress = true;

	slider.thumbsColIndex++;
	var t = slider.slideThumbs((slider.slideSteps * -1), 0);

	for(var k=0; k< slider.Pager.length; k++)
	{
	    if(k == slider.thumbsColIndex)
	        document.getElementById(slider.Pager[k]).src = "images/imgPagerMiddle.gif";
	    else
	        document.getElementById(slider.Pager[k]).src = "images/imgPager.gif";
	}
}

function moveMultiplePages(pageIndex, slider)
{
    //slide left
    var temp = slider.thumbsColIndex;
    if(temp > pageIndex)
    {
        for(var i = 0; i < (temp - pageIndex); i++)
        {
            slider.moveThumbnailsLeft(slider);
        }
    }
    //slide right
    else if(temp < pageIndex)
    {
        for(var i = 0; i < (pageIndex - temp); i++)
        {
            slider.moveThumbnailsRight(slider);
        }
    }
}





function slideThumbs(speed,currentPos)
{
	var leftPos;
	if(this.thumbsLeftPos)
		leftPos = this.thumbsLeftPos;
	else
	{
		var leftPos = this.DHTMLgoodies_thumbDiv.style.left.replace('px','')/1;
		this.thumbsLeftPos = leftPos;
	}
	currentPos = currentPos + Math.abs(speed);
	var tmpLeftPos = leftPos;
	leftPos = leftPos + speed;
	this.thumbsLeftPos = leftPos;
	this.DHTMLgoodies_thumbDiv.style.left = leftPos + 'px';
	if(currentPos < this.DHTMLgoodies_slideWidth)
	    setTimeout(this.ID + '.slideThumbs(' + speed + ',' + currentPos + ')', this.slideSpeed);
	this.DHTMLgoodies_thumbSlideInProgress = false;
	if(leftPos <= -this.DHTMLgoodies_thumbTotalWidth)
	{
	    this.thumbsLeftPos = this.DHTMLgoodies_slideWidth;
	    currentPos = 0;
	    this.thumbsColIndex = 0;

	    for(var k=0; k < this.Pager.length; k++)
	    {
	        if(k == this.thumbsColIndex)
	            document.getElementById(this.Pager[k]).src = "images/imgPagerMiddle.gif";
	        else
	            document.getElementById(this.Pager[k]).src = "images/imgPager.gif";
	    }

	    if(currentPos < this.DHTMLgoodies_slideWidth)
	        setTimeout(this.ID + '.slideThumbs(' + speed + ',' + currentPos + ')', this.slideSpeed);
	}
	if(leftPos >= this.DHTMLgoodies_slideWidth)
	{
	    this.DHTMLgoodies_thumbDiv.style.left = -this.DHTMLgoodies_thumbTotalWidth + 'px';
	    this.thumbsLeftPos = -this.DHTMLgoodies_thumbTotalWidth;
	    currentPos = 0;
	    this.thumbsColIndex = (this.columnsOfThumbnails / this.cellCount) - 1;

	    for(var k=0; k < this.Pager.length; k++)
	    {
	        if(k == this.thumbsColIndex)
	            document.getElementById(this.Pager[k]).src = "images/imgPagerMiddle.gif";
	        else
	            document.getElementById(this.Pager[k]).src = "images/imgPager.gif";
	    }

	    if(currentPos < this.DHTMLgoodies_slideWidth)
	        setTimeout(this.ID + '.slideThumbs(' + speed + ',' + currentPos + ')', this.slideSpeed);
	}
	return this.thumbsColIndex;
}
