

//[attribute^=value]	Matches elements that have the specified attribute and it starts with a certain value.;
//[attribute$=value]	Matches elements that have the specified attribute and it ends with a certain value.;
//[attribute*=value]	Matches elements that have the specified attribute and it contains a certain value.;


// common subroutines, for LayoutManager and vbase;

var useAssets=false;
var timer=new Date();

   // var userloggedin=false;
    var tagsloggedin=false;
    var tagsuserid="";
    var tagsusername="";

    var blogsloggedin=false;
    var blogsuserid="";
    var blogsusername="";

    var linkhlp=[];
    var tinyBrowserWrapperRef=false;
    var adminWrapperRef=false;

    var imageBrowser=false;

    var docIsLoaded=false;
    var guestbookTarget;
    var windowW;
    var windowH;
    var styleScrollbars;
    var bodyHeight;
    var bodyWidth;
    var pageHeight;
    var pageWidth;
    var leftHeight;
    var rightHeight;
    var middleHeight;
    var contentScrollerHeight;
    var contentScrollerWidth;
    var topHeight;
    var bottomHeight;

    var searchTarget="";
    var haveProducts=false;

    var md5Hash="";
    var site_c;
    var start=false;
    var username="";
    var password="";
    var lastClicked="";
    var passwordPassed=false;
    var docLoc="";
    var showWhenHover=false;
    var haveScrollbar=false;
    var lastId;
    var topId;
    var leftId;
    var bottomId;
    var rightId;
    var modalId;
    var state="";
    var editId;
    var editPane;
    var changeState=false;
    var keyIsDown=false;
    
	var shiftkeydown;
	var controlkeydown;
	var returnkeydown;
	var vkeydown;
	var bkeydown;
	var ekeydown;
    
    
    var pageColor="";
    var bodyColor="";

    var doPoll=false;
    var toHandles=[]; // holds setTimeout-handles;

    var forceRemote=false;  // set to true if using local scripts with remote database;

    var toolBoxPosition="";

    document.onkeydown = storeKey;
    document.onkeyup   = clearKey;


    var canceled=false; // to cancel any callback;
    var supended=false;   // flag to indicate to stop all actions because we are updating or so;
    var abort=-1;

    //var outerW;  // the screen should be the same as outer table;
    //var outerH;
    //var contentW;  // content_background;
    //var contentH;
   // var leftW;  // content_background;
    //var rightW;
    //var topH;
    //var bottomH;


    //var autoHeight=false;
    //var roundedCorners;

    //var hasDragDrop=false;

    var availablePanes=""; // panes that may be edited;

    var lastNodeShowed;
    var onVBPageLoad=false;
    var beforeVBPageLoad=false;
    //var idNames=[];

    var piclensTarget="";

    var isExternal=[];
    isExternal.top=false;
    isExternal.bottom=false;
    isExternal.left=false;
    isExternal.right=false;
    isExternal.content=false;
    isExternal.modal=false;
    var mayEdit=false;
    var mayLayout=false;
    var mayPages=false;
    var maySlides=false;
    var mayUsers=false;
    var mayAccess=false;
    var mayFileupload=false;
    var mayImageupload=false;
    var mayProducts=false;


    var disableNavClick=false; // to temporary block the onclick handler for nav;

    var anchor=[];
    anchor.top="";
    anchor.left="";
    anchor.right="";
    anchor.bottom="";
    anchor.content="";
    anchor.modal="";

    var rounding=[];

    var objects="slideshowbackground|slideshowheader|slideshowstart|modal|modal_holder|modal2|modal2_holder|left|right|top|bottom|content_outer|content_scroller|content|body|page|navholdertable|navholder|chapter|link|sublink_container|sublink|chapter_first|link_first|chapter_last|link_last|adminbutton|linktop|linkleft|linkright|linkbottom|linkcontent|linkmodal|linkmodal2|backup|example|";
    objects=objects+"productheader|producttext|productholder|productpicture|productbackground|emailbody|adminbutton|vglider|vbar|";
    objects=objects+"vglider_right_scroller|vbar_right_scroller|";
    objects=objects+"vglider_left_scroller|vbar_left_scroller|";
    objects=objects+"vglider_content_scroller|vbar_content_scroller|";
    objects=objects+"vglider_modal|vbar_modal|";
    objects=objects+"vglider_modal2|vbar_modal2|";
    objects=objects+"vglider_document_body|vbar_document_body|";
    objects=objects+"slideholder|imagecontent|imageright|imageleft|imagetop|imagemodal|imagemodal2|picture_holder|navdragger|navcontenttable|";
    objects=objects+"buynow|checkcart|caption_holder|toolbox|";
    objects=objects+"gbcomment|gbcommentheader|gbtopic|gbtopicheader|gbpage|gbnavigation|gbsubject|gbtopicseperator|hr|vbaselink|searchspan|";
    objects=objects+"aux1|aux2|aux3|aux4|aux5|aux6|aux7|aux8|aux9|aux10|";
    objects=objects+"pageleft_spacer|pageright_spacer|top1_spacer|top2_spacer|bottom1_spacer|bottom2_spacer|left1_spacer|left2_spacer|right1_spacer|right2_spacer|printfriendly|modified|test";

    var vBaseObjects=objects.split("|");

    var navObjects="navholder|chapter|link|sublink_container|sublink|chapter_first|link_first|chapter_last|link_last".split("|");

    rounding.backup="";

    var right100="";
    var left100="";

    var menuOpener="";
    var alwaysOpen;
    var fixedHeight;

    var theRules="";

    var currentStyle;

    var state="";  // either empty, , _hover or _clicked;

    var navPos;
    var navAnchor;

    var animation; // if true then do accordion menu;

    var nChapters;  // total amout of chapters;

    var jumpToAnchor="";

    var lastPage="00";

    var lastLinkId; // id of the the last main link.;

    var contentHeight;

    var firstTime=true; // asp loads the content already;

    var sameDomain=false;


    //=======================================================;
    String.prototype.find=function(what){
        return(this.indexOf(what)>=0 ? true : false);
    };



    //=======================================================;
    function init() {
        readStyles();
        if (((vbasedomain.indexOf("localhost")!==-1) || (vbasedomain.indexOf("vbaseworks")!==-1)) && (!vbasedomain.find("panel.vbaseworks"))){
            sameDomain=true;
        }

        gebi("pusername").value=getCookie("username");
        gebi("ppassword").value=getCookie("password");

        $("#top").bind("dblclick",function(){doubleclicked(this);});
        $("#left").bind("dblclick",function(){doubleclicked(this);});
        $("#right").bind("dblclick",function(){doubleclicked(this);});
        $("#bottom").bind("dblclick",function(){doubleclicked(this);});
        $("#content").bind("dblclick",function(){doubleclicked(this);});
        $("#modal").bind("dblclick",function(){doubleclicked(this);});
        $("#loginspan").bind("click",function(){login();});

        if (startpage) {

            var id="link_"+startpage;
            if (startpage==="00") {id="link_first";}
            if (startpage===lastLinkId) {id="link_last";}
            $(gebi(id)).addClass(id+"_clicked");

        }

        if (product_id!=="") {
            var data=initData();
            var extra="";
            //product_id=819;
            if (forceRemote) {extra=extra + "&forceremote=1";}
            data[4]="productshow.asp?site_c=" + site_c +"&p_id="+product_id + extra+"&startdate="+startdate;
            data[2]="modal";
            showNodeCallBack(data);
        }


        // at last load the navigation;
        navCallBack(navdata);



    }

    //=====================================;
    function initData() {
        var data=[];
        for (var i=0;i<10;i++) {
            data[i]="";
        }
        return data;

    }






    var nfields=6;// amount of fields retrieved by the query;


    // ======================================================================	;
    function getNumParagraphs(chapter,data) {

        var numparagraph=0;
        for (var j=0;j< data.length;j=j+nfields) {
            thispage=data[j+2];
            if ((thispage===chapter) && (j<data.length-2)) {
                for (var k=j+nfields;k< data.length;k=k+nfields) {
                    thispage=data[k+2];
                    if (thispage.indexOf("_")!==-1) {
                        numparagraph++;
                    }
                    else  {
                        return numparagraph;
                    }
                }
            }
         }
         return numparagraph;
    }



    // ======================================================================	;
    function getchapter(pointer,data) {
        //returns index of the array data;
        anindex=0;
        for (var ic=0;ic< data.length;ic=ic+nfields) {

            pageno=data[ic+2];
            if (pageno.indexOf("_")===-1) {
                if (pointer===anindex) {return ic;}
                anindex++;
            }
        }
        alert("chapter not found:"+pointer);
    }
// ======================================================================	
function navCallBack(data) {


    // select content_c,title,page_no,target,pagecount

    nChapters=0;
    // count pages 
    
    // "[subscriber id],[Title],[page_no]"
    
    
    for (var i=0;i< data.length;i=i+nfields) {
        pageno=data[i+2];
        if (pageno.indexOf("_")===-1) {nChapters++;}
    }

    // write out the navigation


    atr=document.createElement("tr");
    atr.id="navcontent";

    
    navhtml="";
    sublinkcounter=0;
    for (var i=0;i< nChapters;i++) {
        
        start=getchapter(i,data);
        pageno=data[start+2];
        atitle=data[start+1];
        content_c=data[start];
        
        //idNames[content_c]=atitle;
        
        if (showNavText===false) {atitle="&nbsp;";}
        //atitle=replace(atitle,"'","\'");
        numparagraphs=getNumParagraphs(pageno,data);
        
        // ------------------------------------------------------------------------------------------------------
        // here for every chapter
        // ------------------------------------------------------------------------------------------------------
        
        chapterextra="";
        linkextra="";
        if (i===0) {
            chapterid="chapter_first";
            linkid="link_first";
            chapterclass="chapter chapter_first";
            linkclass="link link_first "+"link_"+pageno;
        }
        else if (i===nChapters-1) {
            chapterid="chapter_last";
            linkid="link_last";
            chapterclass="chapter chapter_last";
            linkclass="link link_last "+"link_"+pageno;
            lastLinkId=pageno;
        }
        else {
            chapterid="chapter_"+pageno;
            linkid="link_"+pageno;
            chapterclass="chapter";
            linkclass="link "+"link_"+pageno;
        }
        
        atd=document.createElement("td");
        atd.vAlign="top";
        atd.id="row"+i;
        
        navhtml += "<div pageno='"+pageno+"' id="+chapterid+" class='"+chapterclass+"' >";
        //navhtml += "<a style='z-index:4' id="+linkid+"  class='"+linkclass+" acheader' ><span>"+replace(atitle," ","&nbsp;")+"</span></a>";
        navhtml += "<a style='z-index:4' id="+linkid+"  class='"+linkclass+" acheader' ><span>"+atitle+"</span></a>";
        
        if ((numparagraphs!==0) || (fixedHeight)) {
        
        navhtml += "<div><!-- necessary to wrap the below in a div without a specific style -->";

        if ( numparagraphs===0) {disp="style=display:none";} else {disp="";}
        disp="";

        navhtml += "<div id=sublink_container"+i+"  class='sublink_container' "+disp+">";
       
       
        for (j=0;j< numparagraphs;j++) {
            pageno=data[start+nfields+2];
            atitle=data[start+nfields+1];
            content_c=data[start+nfields];
            //idNames[content_c]=atitle;
                        
            //navhtml += "<div  id=link_"+pageno+"  class=sublink  ><span>"+replace(atitle," ","&nbsp;")+"</span></div>";
            navhtml += "<div  id=link_"+pageno+"  class=sublink  ><span>"+atitle+"</span></div>";
            
            start=start+nfields;
            sublinkcounter++;
        }  // end of a paragraph
        
        navhtml += "</div>"; // sublink container
        navhtml += "</div>"; // wrapper
        }
        navhtml += "</div>"; // chapter
        atd.innerHTML=navhtml;
        navhtml="";
        atr.appendChild(atd);
    
    } // end of a chapter
    
    navhtml="";
    for (var i=0;i< nChapters;i++) {

        start=getchapter(i,data);
        pageno=data[start+2];
        atitle=data[start+1];
        var target=data[start+3];
        extern=data[start+5];
        content_c=data[start];
        numparagraphs=getNumParagraphs(pageno,data);
        navhtml += "<input type=hidden id=divhlp4_"+content_c+ "  value=\""+pageno+"\">";
        navhtml += "<input type=hidden id=divhlp2_" +pageno+ " value=\""+content_c+"\">";
        navhtml += "<input type=hidden id=divhlp3_"+pageno+ "  value=\""+target+"\">";

        for (j=0;j< numparagraphs;j++) {
            pageno=data[start+nfields+2];
            atitle=data[start+nfields+1];
            content_c=data[start+nfields];
            target=data[start+nfields+3];
            extern=data[start+nfields+5];
            navhtml += "<input type=hidden id=divhlp4_"+content_c+ "  value=\""+pageno+"\">";
            navhtml += "<input type=hidden id=divhlp2_"+pageno+ "  value=\""+content_c+"\">";
            navhtml += "<input type=hidden id=divhlp3_"+pageno+ "  value=\""+target+"\">";
            start=start+nfields;
        }
    }
    
    if (gebi("hidden_inputs")) {gebi("hidden_inputs").parentNode.removeChild(gebi("hidden_inputs"));}
    adiv=document.createElement("div") ;
    adiv.id="hidden_inputs";
    adiv.style.display="none";
    adiv.innerHTML=navhtml;
    document.body.appendChild(adiv);
    
    
    aparent=gebi("tobereplaced").parentNode;
    aparent.replaceChild(atr,gebi("tobereplaced"));
    atr.id="tobereplaced";
    
    
    $(".link").bind("click",function () {
        removeClickedStates('all',true,'click');
        $(this).addClass('link_clicked');
        $(this).addClass(id+'_clicked');

    });
    
    $("#link_first").bind("click",function () {
        removeClickedStates('all',true,'click');
        $(this).addClass('link_clicked');
        $(this).addClass('link_first_clicked');
        $(this).addClass('link_00_clicked');
    });
    
    
    $("#link_last").bind("click",function () {
        removeClickedStates('all',true,'click');
        $(this).addClass('link_clicked');
        
        $(this).addClass('link_last_clicked');
        $(this).addClass('link_'+lastLinkId+'_clicked');
    });
    
    $(".sublink").bind("click",function () {
        removeClickedStates('all',true,'click');
        $(this).addClass('sublink_clicked');
        
        achapter=$(this.parentNode.parentNode.parentNode)[0].id;
        alink=replace(achapter,"chapter","link");
        if (alink==="link_first") {
            $(gebi(alink)).addClass('link_clicked');
            $(gebi(alink)).addClass('link_first_clicked');
        }
        else if (alink==="link_last") {
            $(gebi(alink)).addClass('link_clicked');
            $(gebi(alink)).addClass('link_last_clicked');
        }
        else {
            $(gebi(alink)).addClass('link_clicked');
        }
    });    
    
    
    
    var i=0;

    $("input[id*=divhlp2_]").each(function() {
    
        id=this.id.substring(8);
        if (id==="00") {id="first";}
        if (id===lastLinkId) {id="last";}
        $("#link_"+id).bind("click",function(){
            if (changeState) {
                if (state!=="") {changeState("");}
            }
            page_no=this.id.substring(5);
            if (page_no==="first") {page_no="00";}
            if (page_no==="last")  {page_no=lastLinkId;}
            
            ananchor="";
            content_c=gebi("divhlp2_"+page_no).value;
            target=gebi("divhlp3_"+page_no).value;
            if (!disableNavClick) {
                showNode(content_c,target,ananchor);
                if (target==="content") {lastPage=page_no;}
            }
        });
        
        i++;
    
    }); 
    
    
    for (var icnt=0;icnt< navObjects.length;icnt++) {
        if (getStyle(navObjects[icnt],"height")!=="") {
            astyle=replace(navObjects[icnt],"_first","");
            astyle=replace(astyle,"_last","");
            $("."+navObjects[icnt]).each(function(){
                this.style.height=noPy(getStyle(navObjects[icnt],"height",true))-heightWaste(astyle);
            });
        }
        if (getStyle(navObjects[icnt],"width")!=="") {
            astyle=replace(navObjects[icnt],"_first","");
            astyle=replace(astyle,"_last","");
        
            $("."+navObjects[icnt]).each(function(){
                this.style.width=noPy(getStyle(navObjects[icnt],"width"),true)-widthWaste(astyle);
            });
        }
        
    }
    
    

    
           
    navpos(navPos);    
    reaccordion("init");
    
    $("#navholder").hover(function () {$(this).addClass('navholder_hover');},function () {$(this).removeClass('navholder_hover');});
    $(".chapter").hover(function () {$(this).addClass('chapter_hover');},function () {$(this).removeClass('chapter_hover');});
    $(".link").hover(function () {$(this).addClass('link_hover');},function () {$(this).removeClass('link_hover');});
    $(".sublink_container").hover(function () {$(this).addClass('sublink_container_hover');},function () {$(this).removeClass('sublink_container_hover');});
    $(".sublink").hover(function () {$(this).addClass('sublink_hover');},function () {$(this).removeClass('sublink_hover');});
    $("#link_first").hover(function () {$(this).addClass('link_first_hover');},function () {$(this).removeClass('link_first_hover');});
    $("#link_last").hover(function ()  {$(this).addClass('link_last_hover');} ,function () {$(this).removeClass('link_last_hover');});
    $("#chapter_first").hover(function () {$(this).addClass('chapter_first_hover');},function () {$(this).removeClass('chapter_first_hover');});
    $("#chapter_last").hover(function () {$(this).addClass('chapter_last_hover');},function () {$(this).removeClass('chapter_last_hover');});
    
    $("[id^=aux][class^=aux]").each(function(){
        $(this).hover(function () {$(this).addClass(this.id+"_hover");},function () {$(this).removeClass(this.id+"_hover");});
        $(this).click(function(){
            $("[id^=aux][class^=aux]").each(function(){
                $(this).removeClass(this.id+"_clicked");
            });
            removeAuxClickedStates("readstyles");
            $(this).addClass(this.id+"_clicked");
        });
    });
    
    
    
    // click states
    
    

    
    sublinkcounter=0;
    
    // for all links inbeteween first and last
    
    for (var i=1;i< nChapters-1;i++) {
        start=getchapter(i,data);
        pageno=data[start+2];
        
        linkid="link_"+pageno;
        
        $("#"+linkid).hover(function () {$(this).addClass(this.id+'_hover');},function () {$(this).removeClass(this.id+'_hover');});
        $("#"+linkid).click(function () {$(this).addClass(this.id+'_clicked');},function () {$(this).removeClass(this.id+'_clicked');});
    }
        
    if (firstTime) { // page is already loaded as part of the HTML, no need to load again

    
        if (lastPage==="00") {
            $(gebi("link_first")).addClass("link_clicked");
            $(gebi("link_first")).addClass("link_first_clicked");
        }
        else if (lastPage===lastLinkId) {
            $(gebi("link_first")).addClass("link_clicked");        
            $(gebi("link_last")).addClass("link_last_clicked");
        }
        else {
            $(gebi("link_"+lastPage)).addClass("link_clicked");
        }
        firstTime=false;
    }
    else {
        round();
        showLastPage();
    
    }
    // ad this is the last call of init(), the whole document shold be there now     
     
     if (!docIsLoaded) {
        docLoaded();
     }
     
}            
    //===================================================================================================;
function removeAuxClickedStates(who) {

    //alert("aux remove " + who);

    $("[id^=aux][class^=aux]").each(function(){
        var alist=this.className.split(" ");
        for (var i=0;i<alist.length;i++){
            if (alist[i].find("_clicked")) {
                $(this).removeClass(alist[i]);
            }
        }
    });
}

    //===================================================================================================;
    function removeClickedStates(what,includeAux,who) {
        if (includeAux) {removeAuxClickedStates("removeClicked");}

        if ((what=="all") || (what==="link")) {
//            $('a.acheader[@class*=_clicked]').each(function(){
            $("a.acheader[class*='_clicked']").each(function(){

                list=this.className.split(" ");
                for (var i=0;i< list.length;i++) {
                    if (list[i].indexOf("_clicked")!==-1) {

                        $(this).removeClass(list[i]);
                        if (this.roundingclicked) {$(this).removeClass(this.roundingclicked);}
                    }
                }
            });
        }

        if ((what=="all") || (what==="sublink")) {
            $(".sublink[class*='_clicked']").each(function(){
                list=this.className.split(" ");
                for (var i=0;i< list.length;i++) {
                    if (list[i].indexOf("_clicked")!==-1) {
                        $(this).removeClass(list[i]);
                        if (this.roundingclicked) {$(this).removeClass(this.roundingclicked);}
                    }
                }
            });
        }
    }

    //===================================================================================================;
     function accordion(who) {
        if (!animation) {return;}

       jQuery(".chapter").unbind("mouseenter").unbind("mouseleave");

        if ((menuOpener==="mouseover") && (!alwaysOpen)) {
            jQuery(".sublink_container").hide();

            jQuery(".chapter").each(function(){
                if (gebi("sublink_container"+this.getAttribute("pageno")*1)) {
                    jQuery(this).bind("mouseenter",function(){
                        jQuery(gebi("sublink_container"+this.getAttribute("pageno")*1)).slideDown(300);
                    });
                    jQuery(this).bind("mouseleave",function(){
                        jQuery(gebi("sublink_container"+this.getAttribute("pageno")*1)).slideUp(0);
                    });
                 }
            });
            return;
        }



        jQuery(".sublink_container").show();

        $(gebi("navholder")).accordion({
            header:"a.acheader",
            
            event: menuOpener,
            alwaysOpen:alwaysOpen,   
            autoHeight: fixedHeight
        });
}

        //=======================================================;
        function getPseudoStyle(name,adefault) {
            name=name.toLowerCase();
            if (pstyles[name]) {
                return pstyles[name];
            }
            return adefault;
        }

        //=======================================================;
        function createStyle(name,property,value) {

            if ((value==="") && (property!=="")) {return;}
            name=getStyleName(name);

            if (document.styleSheets[1].insertRule){ //if Firefox;
                document.styleSheets[1].insertRule(name+" {"+toCSSname(property)+":"+value+";}", theRules.length-1);
            }
            else { //else if IE;
                document.styleSheets[1].addRule(name, toCSSname(property)+":"+value);

            }
            theRules=getRules();
            return "";
        }


        //=======================================================;
        function toCSSname(aname) {

            // from camelCase to dashed names e.g. borderTopWidth --> border-top-width;
            aname=trim(aname.toLowerCase());
            aname=replace(aname,"top","-top");
            aname=replace(aname,"bottom","-bottom");
            aname=replace(aname,"left","-left");
            aname=replace(aname,"right","-right");
            aname=replace(aname,"family","-family");
            aname=replace(aname,"weight","-weight");
            aname=replace(aname,"align","-align");
            aname=replace(aname,"color","-color");
            aname=replace(aname,"size","-size");
            aname=replace(aname,"image","-image");
            aname=replace(aname,"position","-position");
            aname=replace(aname,"repeat","-repeat");
            aname=replace(aname,"width","-width");
            aname=replace(aname,"style","-style");
            if (aname.substring(0,1)==="-") { aname=aname.substring(1);}
            return aname;
        }

        //=======================================================;
        function setScroll(something) {
        document.body.style.overflow="hidden";
        gebi("document_body").scrollTop=0;

            if (something==="content") {

                setStyle("document_body",'overflowY','hidden');

                setStyle("content_scroller",'overflow','auto');
                setStyle("content_scroller",'overflowY','auto');
                setStyle("content_scroller",'overflowX','hidden');
                haveScrollbar=true;
            }
            else {

                setStyle("content_scroller",'overflow','auto');
                setStyle("content_scroller",'overflowY','auto');
                setStyle("content_scroller",'overflowX','hidden');

                setStyle("document_body",'overflow','auto');
                setStyle("document_body",'overflowY','auto');
                setStyle("document_body",'overflowX','hidden');
                haveScrollbar=false;
            }
        }

        //=======================================================;
        function setStyle(aname,property,value,ignoreState,index) {

            if (isNumeric(value)) {value=value+"px";}
            if (taglist.find(";"+aname+";")) {
                styleName=aname;
            }
            else {
                if (ignoreState) {
                    styleName="."+aname;
                }
                else {
                    styleName=getStyleName(aname);
                }
            }
            //if (aname.find("*")) {styleName=replace(aname,"*","");} // to alow for h1, hr etc;

            if (index) {
                //theRules[index].style[property]=value;
                //return;
            }


            found=false;
            for (var i=0;i< theRules.length;i++) {
                if (theRules[i].selectorText.toLowerCase()===styleName) {
                    found=true;
                    var pos=i;
                }
            }

            try {
                if (!found) {
                    createStyle(aname,property,value);
                }
                else {
                    theRules[pos].style[property]=value;
                }
            }
            catch(err) {
                alert("error in setStyle: "+ aname+" "+property+" "+value);
            }
        }


        //=======================================================;
        function getStyle(aname,property,ignoreState,index) {
            if (ignoreState) {
                styleName="."+aname;
            }
            else {
                styleName=getStyleName(aname);
            }

            if (index) {
                thestyle=theRules[index].style[property].toLowerCase();
                if (thestyle.indexOf("rgb")!==-1) {thestyle=rgb2hex(thestyle);}
                //log(aname+ " "+property+" "+thestyle);
                return thestyle;
            }

            found=false;
            for (var i=0;i< theRules.length;i++) {
                if (theRules[i].selectorText.toLowerCase()===styleName) {
                    thestyle=theRules[i].style[property].toLowerCase();
                    found=true;
                    if (thestyle.indexOf("rgb")!==-1) {thestyle=rgb2hex(thestyle);}
                    //return thestyle;
                }
            }

            // finish the loop. ie reports multiple rules for a style;

            if (!found) {
                return "";
            }
            else {
                return thestyle;
            }
        }

        //=======================================================;
        function rgb2hex(value){
            var hex="",v,h,i;
            var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
            var h=regexp.exec(value);
            for(var i=1;i<4;i++){
                v=parseInt(h[i]).toString(16);
                if(v.length==1) {hex+="0"+v;}
                else {hex+=v;}
            }
            return("#"+hex);
        }





        //=======================================================;
        function getStyleName(aname) {
            if (taglist.find(";"+aname+";")) {return aname;}
            return ("."+aname+state).toLowerCase();
        }

        //=======================================================;
        function getRules() {

            var theRules = [];
            if (document.styleSheets[1].cssRules){
                return document.styleSheets[1].cssRules;
            }
            else if (document.styleSheets[1].rules) {
                return document.styleSheets[1].rules;
            }
            alert("rules not supported in this browser");
        }

//=======================================================;
function report(stylename,returnString) {
    if (returnString) {
        sep="<br>";
    }
    else {
        sep="\n";
    }
    s=stylename +sep;
    s=s+"=============== Heights ==================\n";
    s=s+"style: "+gebi(stylename).style.height+sep;
    s=s+"getStyle: "+getStyle(stylename,"height")+sep;
    s=s+"offsetHeight: "+gebi(stylename).offsetHeight+sep;
    s=s+"clientHeight: "+gebi(stylename).clientHeight+sep;
    s=s+"scrollHeight: "+gebi(stylename).scrollHeight+sep;
    s=s+"getStyleNH: "+getStyleNH(stylename,"height")+sep;
    s=s+"textheight: "+textHeight(stylename)+sep;

    s=s+"=============== Width ==================\n";
    s=s+"style: "+gebi(stylename).style.width+sep;
    s=s+"getStyle: "+getStyle(stylename,"width")+sep;
    s=s+"offsetWidth: "+gebi(stylename).offsetWidth+sep;
    s=s+"clientWidth: "+gebi(stylename).clientWidth+sep;
    s=s+"scrollWidth: "+gebi(stylename).scrollWidth+sep;
    s=s+"getStyleNH: "+getStyleNH(stylename,"width")+sep;

    s=s+"=============== other =============\n";
    s=s+"display getStyle: "+getStyle(stylename,"display")+sep;
    s=s+"display style: "+gebi(stylename).style.display+sep;
    s=s+"overflow getStyle: "+getStyle(stylename,"overflow")+sep;
    s=s+"overflow style: "+gebi(stylename).style.overflow+sep;
    s=s+"overflowX getStyle: "+getStyle(stylename,"overflowX")+sep;
    s=s+"overflowX style: "+gebi(stylename).style.overflowX+sep;
    s=s+"overflowY getStyle: "+getStyle(stylename,"overflowY")+sep;
    s=s+"overflowY style: "+gebi(stylename).style.overflowY+sep;

    if (returnString) {return s;}
    alert(s);

}


//=======================================================;
function textHeight(id) {

    // returns the height of a pane, if not set to any height. rounding should be removed;

    a=getStyle(id,"height");
    b=gebi(id).style.height;
    setStyle(id,"height","");
    gebi(id).style.height="";

    c=gebi(id).offsetHeight;

    setStyle(id,"height",a);
    gebi(id).style.height=b;

    return c;


}

//=======================================================;
function getStyleNH(name,prop) {
    // get dimensions if objetc is not hidden;

    var d=eval("gebi('"+name+"').style."+prop);
    if (d==="") {
        var d=noPy(getStyle(name,prop));
    }

    if (gebi(name).style.display==="none") {d=0;}
    if (getStyle(name,"display")==="none") {d=0;}
    return noPy(d);
}


//=======================================================;
function swap(id) {
    if (!isSwapped(id)) {
        // not yet swapped;
        a=gebi(id+"_holder").childNodes[0];
        adiv=document.createElement("div");
        adiv.id="swap"+id+"spacer";
        var ah=parseInt(gebi("top1_spacer").offsetHeight,10);
        if (ah===0) {
            adiv.style.display="none";
        }
        else {
            adiv.style.height=ah;
        }

        gebi("page"+id+"_spacer").appendChild(adiv);
        gebi("page"+id+"_spacer").appendChild(a);

    }
    else {
        // already swapped;
        gebi("page"+id+"_spacer").childNodes[0].parentNode.removeChild(gebi("page"+id+"_spacer").childNodes[0]);
        a=gebi("page"+id+"_spacer").childNodes[0];
        gebi(id+"_holder").appendChild(a);

    }
}


//=======================================================;
function isSwapped(id) {
    if (trim(gebi(id+"_holder").innerHTML)==="") {return true;}
    return false;
}

//=======================================================;
function setContentHeight(target) {

    if (target==="modal") {return;}

    if (!haveScrollbar) {
        setVsize("setContentHeight",true);
    }
    else {
        if (target==='content') {
            gebi("content_scroller").scrollTop=0;
        }
        else {
            gebi(target).scrollTop=0;
        }
        document.body.scrollTop=0;

        getDimensions(false);


        setNewHeight("left",textHeight("left"));
        if (left100==="yes") {
            if (textHeight("left")<leftHeight){setNewHeight("left",leftHeight);}
        }
        else {
            //setNewHeight("left",leftHeight);
        }
        setNewHeight("right",textHeight("right"));
        if (right100==="yes") {
            if (textHeight("right")<rightHeight){setNewHeight("right",rightHeight);}
        }
        else {
            //setNewHeight("right",rightHeight);
        }

        if (target==="content") {
            setNewHeight("content",max(contentHeight,textHeight("content")));
        }
        else if (target==="top") {
            setNewHeight("top",topHeight);
        }
        else if (target==="bottom") {
            setNewHeight("bottom",bottomHeight);
        }
    }

    if (target==="content") {initScroller("content_scroller");}
    if (target==="left") {initScroller("left_scroller");}
    if (target==="right") {initScroller("right_scroller");}
    if (target==="modal") {initScroller("modal");}
    if (target==="modal2") {initScroller("modal2");}
    initScroller("document_body");



}

var currentWindowW=0;
var currentWindowH=0;
var resizeHandle;
//=======================================================;
function windowresize() {

    // IE fires multiple times;
    windowH=noPy(getWindowSize("h"));
    windowW=noPy(getWindowSize("w"));
    if ((windowW!==currentWindowW) || (windowH!==currentWindowH)) {
        clearTimeout(resizeHandle);
        resizeHandle=setTimeout(function() {
            setVsize("windowresize",true);
            if (onVBPageLoad) {onVBPageLoad(-1);}
            currentWindowW=windowW;
            currentWindowH=windowH;

        },500);
    }
    else {
    }
}

//=======================================================;
function hasScrollBar(elem) {
    if (elem.clientHeight < elem.scrollHeight) {
        return true;
    }
    return false;
}

//=======================================================;
function setNewHeight(paneId,newHeight) {

    gebi(paneId).style.height=newHeight-heightWaste(paneId);
}




//===================================================================================================;
function min(a,b) {
	if (a<b) {return a;}	else {return b;}
}

//===================================================================================================;
function max(a,b) {
	if (a>b) {return a;} else {return b;}
}
    // ======================================================================	;
    function getStyleProp(x,prop){
        if(x.currentStyle) {
            return x.currentStyle[prop];}
        if(document.defaultView.getComputedStyle) {
            return document.defaultView.getComputedStyle(x,'')[prop];}
            //return document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);}

        return(null);
    }


    // ======================================================================	;
    function getbackroundImageProp(target,prop) {
        //src="http://localhost/vbase/v156/test.php?file=rounded.php&corners="+r+"&borders=tlrb&borderwidth=1&ds="+ds+"&radius="+asize+"&w="+w+"&h="+h+"&bgc="+bgc+"&fgc="+fgc;
        var val="";
        src=getStyle(target,"backgroundImage",true);
        if (src.indexOf("rounded.php")!=="") {
            alist=src.split("&");
            for (var i=0;i< alist.length;i++) {
                if (alist[i].split("=")[0]===prop) {
                    val=alist[i].split("=")[1];
                    return val.toLowerCase();
                }
            }
        }
        return val;
    }


// ======================================================================	;
    function setcentered(flag) {
        if (flag) {
                c=document.createElement("center");
                c.id="vbcenter";
                c.style.width="100%";
                c.style.height="100%";
                gebi("body").insertBefore(c,gebi("page_holder"));
                c.appendChild(gebi("page_holder"));
                setStyle("document_body","textAlign","center");  // doesn't work, still write it to use it as aflag;
       }
        else {

            if (gebi("vbcenter")) {
                gebi("body").appendChild(gebi("page_holder"));
                gebi("body").removeChild(gebi("vbcenter"));
                setStyle("document_body","textAlign","");
            }

        }

    }


    // ======================================================================	;

    function navpos(pane) {
        if (pane==="top") {
           $("#navcontenttable .chapter").css("display","inline-block");

            for (var i=0;i< nChapters-1;i++) {
                if (i===nChapters-2) {
                    aname="chapter_last";
                }
                else {
                    cid=i+1;
                    if (cid<10) {cid="0"+cid;}
                    aname="chapter_"+cid;
                }
                gebi("row"+(i+1)).appendChild(gebi(aname));
            }
            navPos="top";

        }
        else {
            $("#navcontenttable .chapter").css("display","block");

            for (var i=0;i< nChapters-1;i++) {
                if (i===nChapters-2) {
                    aname="chapter_last";
                }
                else {
                    cid=i+1;
                    if (cid<10) {cid="0"+cid;}

                    aname="chapter_"+cid;
                }
                gebi("row0").appendChild(gebi(aname));
            }
            navPos="left";
        }
        reaccordion();
    }



    //=======================================================;
    function log(text,pane) {
        if (!pane) {pane="content";}
        gebi(pane).innerHTML=gebi(pane).innerHTML+"<br>"+text;
    }


    //=============================================================;
    function fixIEBlur() {

        // when 'content' has no backgroundcolor and ClearType is enabled, then text get blurred in IE after fading in;
        // so call this in the callback event of animate opacity;

        if (getStyle("content","backgroundColor")==="") {
            if (isIE())  {
                $("#content").css("filter","");
            }
         }
   }

    //=============================================================;
    function getPageAsJSON(url,acallback) {
       url=replace(url,"?","&");
        if (acallback) {
            acallback='JFgetdata('+acallback+')';
            src=vbasepath+"getpageasjson.asp?url=" + url + "&callback=" + acallback;
        }
        else {
            src=url+"?1=1";
        }
        request = new JSONscriptRequest(src,"js");
        request.buildScriptTag();
        request.addScriptTag();
    }

    // ======================================================================	;
    function showUpload(feid) {

        if (!feid) {feid='none';}

        if (gebi('yesno')) {gebi('yesno').style.display='none';}
        if ((mayFileupload) && (!mayImageupload)) {
            src=vbasepath + "tinybrowser/upload.php?type=file&"+feid+"=none&site_c="+assets_site+"&id="+md5Hash+"&vbasepath="+vbasepath+"#docloc="+encodeURIComponent(document.location);
            showTiny(src);
        }
        else if ((!mayFileupload) && (mayImageupload)) {
            src=vbasepath + "tinybrowser/upload.php?type=image&"+feid+"=none&site_c="+assets_site+"&id="+md5Hash+"&vbasepath="+vbasepath+"#docloc="+encodeURIComponent(document.location);
            showTiny(src);

        }
        else {
            if (gebi('yesno')) {
                gebi("yesno").style.display="";
                setcenter("yesno","screen");
                gebi("yesno").style.display="none";

                $("#yesno").fadeIn(500);

            }
        }
    }

    var instance=0;
    var tinyZindex=11002;
    // ======================================================================	;

    function showTinyB(src) {

        tinyZindex++;
        var caption="vBase";
        if (src.find("type=image")) {caption="vBase Image Browser";}

        if (tinyBrowserWrapperRef) {
            tinyBrowserWrapperRef.show();
            tinyBrowserWrapperRef.moveTo("middle","middle");

            //gebi("tinyBrowserWrapper").style.zIndex=gebi("tinyBrowserWrapper").style.zIndex+10;
            tinyBrowserWrapperRef.onclose=function(){
                tinyBrowserWrapperRef=false;
                return true;
            };
        }
            
        else {
            instance++;
            tinyBrowserWrapperRef=dhtmlwindow.open(tinyZindex,"tinyBrowserWrapper", "iframe", src, caption, "width=700px,height="+(windowH-50)+"px,resize=1,scrolling=1,center=1");
            //gebi("tinyBrowserWrapper").style.zIndex=zIndex;

            tinyBrowserWrapperRef.onclose=function(){
                tinyBrowserWrapperRef=false;
                return true;
            };                
        }    
    }
    
    

    // ======================================================================	;
    function showTiny(src) {

        try {
            imageBrowser.focus();
        }
        catch(err) {
            imageBrowser=window.open(src,"xyz","fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=yes,width=800,height=500");
        }
    }



    // ======================================================================	;
    function showUpload2(type) {

        gebi('yesno').style.display='none';
        if (type==="f") {
            src=vbasepath + "tinybrowser/upload.php?type=file&feid=none&site_c="+assets_site+"&id="+md5Hash+"&vbasepath="+vbasepath+"#docloc="+encodeURIComponent(document.location);
        }
        else {
            src=vbasepath + "tinybrowser/upload.php?type=image&feid=none&site_c="+assets_site+"&id="+md5Hash+"&vbasepath="+vbasepath+"#docloc="+encodeURIComponent(document.location);
        }
        showTiny(src);
    }

// ======================================================================	;
function showEditStuff() {

    if (passwordPassed) {
        gebi('loginspan').style.display='none';
        gebi('adminspan').style.display='';
        gebi('logoutspan').style.display='';
        gebi('helpspan').style.display="";
    }

    if (mayEdit) {
        gebi("editspan").style.display="";
    }
    if (!passwordPassed) {
        gebi("editspan").style.display="none";
        gebi("adminspan").style.display="none";
        gebi('loginspan').style.display='';
        gebi('logoutspan').style.display='none';
        gebi('helpspan').style.display='none';
    }
    gebi("searchspan").style.display="";
}

var linkId=0;

// ======================================================================	;
function linkstuff(target,overrule) {

    // replace protocol vbase:// by a javascript function jumpto in the whole document;
    // so:     <a href="vbase://vLinks#test2">test2</a>;
    // becomes <span class=vbaselink onclick="xxx('vLinks','test2')">test2</span>;

    // overrule: just to pass on to jumto. needed to jump anyway to the page, even if the page is lastPage (needed for search);

    var alist=gebi(target).getElementsByTagName("a");
    for (var i=0;i< alist.length;i++) {
       var a=alist[i];
        if ((a.href!=="") && (a.href!=="http://vbaseworks.com" )) {

            // href can be:;
            // http://www.google.com/weather.htm;
            // vbase://E0726013-AAA4-4081-8524-A93E28584051#charly;
            // mailto:info@whatever.com;

            var linkInnerIsImage=false;
            var linkTargetIsImage=false;

            if (a.getElementsByTagName("img").length!==0) {linkInnerIsImage=true;}
            if ((a.href.toLowerCase().indexOf("picapic.asp")!==-1)||(a.href.toLowerCase().indexOf(".jpg")!==-1)||(a.href.toLowerCase().indexOf(".jpeg")!==-1)||(a.href.toLowerCase().indexOf(".gif")!==-1)||(a.href.toLowerCase().indexOf(".png")!==-1)) {linkTargetIsImage=true;}

            var ananchor="";
            var linkname=a.childNodes;
            linkId++;
            
            if (!linkInnerIsImage)  {

                var aspan=document.createElement("span");
                aspan.style.display="inline-block";  // without this can't assign a height;
                aspan.style.verticalAlign="middle";

                aspan.innerHTML=a.innerHTML;
                aspan.dropshadow=a.className;
                
                aspan.className="link"+target;
                a.parentNode.insertBefore(aspan,a);
                $(aspan).hover(function(){$(this).addClass("link"+target+"_hover");},function(){$(this).removeClass("link"+target+"_hover");});

            }
            else {
                var aspan=document.createElement("span");
                aspan.innerHTML=a.innerHTML;
                var innerspan=aspan.childNodes[0];


                aspan.style.marginLeft=innerspan.style.marginLeft;
                aspan.style.marginRight=innerspan.style.marginRight;
                aspan.style.marginTop=innerspan.style.marginTop;
                aspan.style.marginBottom=innerspan.style.marginBottom;

                innerspan.style.marginLeft="";
                innerspan.style.marginRight="";
                innerspan.style.marginTop="";
                innerspan.style.marginBottom="";

                if (isIE()) {
                    aspan.style.styleFloat=innerspan.style.styleFloat;innerspan.style.styleFloat="";
                }
                else {
                    aspan.style.cssFloat=innerspan.style.cssFloat;innerspan.style.cssFloat="";
                }
                aspan.style.verticalAlign=innerspan.style.verticalAlign;innerspan.style.verticalAlign="";

                aspan.className="imagelink";
                a.parentNode.insertBefore(aspan,a);

            }

            caption=a.name;

            if (a.href.substring(0,8).toLowerCase()==="vbase://") {

                if (a.href.indexOf("www.")!==-1){a.href=replace(a.href,"vbase:","http:");}
                if (a.href.indexOf(".com")!==-1) {a.href=replace(a.href,"vbase:","http:");}
                if (a.href.indexOf(".net")!==-1) {a.href=replace(a.href,"vbase:","http:");}
                if (a.href.indexOf(".tv")!==-1)  {a.href=replace(a.href,"vbase:","http:");}
            }


            if (a.href.substring(0,8).toLowerCase()==="vbase://") {

                rest=a.href.substring(8);

                var content_c=rest.split("#")[0];
                content_c=replace(content_c,"/",""); // ie reports the href with an ending slash before the hash;
                if (rest.split("#")[1]) {ananchor=rest.split("#")[1];}
                if (rest.split("#")[2]) {
                    linktarget=rest.split("#")[2];
                    aspan.id="linkid"+linkId+"|"+content_c+"|"+ananchor+"|"+linktarget;
                }
                else {
                    aspan.id="linkid"+linkId+"|"+content_c+"|"+ananchor;
                }

                    aspan.onclick=function(){
                        thisId=this.id;

                        // Safari issue;

                        thisId=replace(thisId,"%23","|");

                        ananchor=thisId.split("|")[2];
                        content_c=thisId.split("|")[1].toUpperCase();
                        if (thisId.split("|")[3]) {
                            ltarget=thisId.split("|")[3];
                        }
                        else {
                            ltarget='';
                        }
                        showcart=false;
                        showproduct=false;
                        if (content_c.indexOf("VBASEPRODUCT:")!==-1) {
                            product_id=content_c.split(":")[1];
                            if (product_id==="0") {
                                showcart=true;
                            }
                            else {
                                showproduct=true;
                            }
                        }

                       var data=initData();

                        pageno=getPageNo(content_c);
                        if (pageno!==-1) {  // if -1 then the page is not part of the navigation;
                            setNav(content_c);

                        }
                        if (showcart) {
                        
                            data[2]="modal2";
                            data[4]="http://"+mal_server+".aitsafe.com/cf/review.cfm?userid="+merchant_id+""; // extern;
                            showNodeCallBack(data);
                        }
                        else if (showproduct) {
                            var extra="";
                            //if (forceRemote) {extra=extra + "&forceremote=1";}
                            data[4]="productshow.asp?site_c=" + site_c +"&p_id="+product_id + extra;
                            data[2]="modal2";
                            showNodeCallBack(data);
                        }
                        
                        else {
                            showNode(content_c,ltarget,ananchor);
                        }
                    };
                a.style.display="none";
                a.href="";
            }
            else {
                aspan.id=linkId+"|"+(a.href);
                aspan.id=replace(aspan.id,"%20"," ");
                if (a.href.indexOf("mailto:")!==-1) {
                    aspan.onclick=function(){
                        win=window.open(this.id.split("|")[1]);
                        if (win && win.open &&!win.closed) {win.close();}
                    };
                }
                if (a.href.indexOf("javascript:")!==-1) {
                    aspan.onclick=function(){
                        eval(this.id.split("|")[1]);
                    };
                }
                else if (linkTargetIsImage) {
                    // make sure we open it with showpic();
                    var prevsrc="";
                    var nextsrc="";
                    var imgid="";
                    tagable="";
                    if(a.id.find("vbslide|")) {
                        prevsrc=a.id.split("|")[1];
                        nextsrc=a.id.split("|")[2];
                        imgid=a.id.split("|")[3];
                        tagable=a.id.split("|")[4];  // flag to indicate if image is publicaly tagable;
                        if (prevsrc!=="") {prevsrc=(linkId-1)+"|"+prevsrc;}
                        if (nextsrc!=="") {nextsrc=(linkId+1)+"|"+nextsrc;}
                    }
                    aspan.link=a.href;
                    aspan.prev=prevsrc;
                    aspan.next=nextsrc;
                    aspan.imgid=imgid;
                    aspan.tagable=tagable;
                    aspan.caption=caption;
                    isSlideFromSlideshow=false;
                    if(a.id.find("vbslide|")) {isSlideFromSlideshow=true;}
                    aspan.isSlideFromSlideshow=isSlideFromSlideshow;

                    aspan.onclick=function() {showpic(this.link,this.caption,this.prev,this.next,this.imgid,this.id,this.isSlideFromSlideshow,this.tagable);};

                }
                else {
                    // a normal link. of foreign website, then open in new windo. if switching to other language, open in same window;

                    if  ((a.href.find("?lan=")) || ( a.href.find("&lan=")) ) {
                        aspan.onclick=function() {document.location=this.id.split("|")[1];};
                    }
                    else if  (a.href.find("noaction"))  {
                    }
                    else {
                        aspan.onclick=function(){window.open(this.id.split("|")[1]);};
                    }

                }

                a.style.display="none";
                a.href="";

            }
       }
    }

    alist=gebi(target).getElementsByTagName("a");

    for (var i=0;i< alist.length;i++) {
        var a=alist[i];
        if (a.style.display==="none") {
            a.parentNode.removeChild(a);
            a=null;
            i--;
        }
    }



    if (isIE()) {

        // IE breakes 'inherit' over tables. Great...;

        var alist=gebi(target).getElementsByTagName("td");

        for (var i=0;i< alist.length;i++) {
            alist[i].style.fontFamily=getParentStyle(alist[i],"fontFamily");
            alist[i].style.fontSize=getParentStyle(alist[i],"fontSize");
            alist[i].style.color=getParentStyle(alist[i],"color");
        }
    }

    $("#vbaselink").removeClass("linkbottom");

}





// ======================================================================	;
function getParentStyle(obj,prop) {

    var curtop = 0;
        while(1) {
          if (getStyle(obj.className,prop)!=="")  {return getStyle(obj.id,prop);}

          if(!obj.parentNode) {break;}
          obj = obj.parentNode;
        }
    return "";

}



// ======================================================================	;
function goToAnchor(atarget) {
    // jumpt to an anchor if jumpToAnchor is not empty;

    if (atarget==="") {atarget="content";}

    if (anchor[atarget]!=="") {

        ananchor=anchor[atarget];
        if (atarget==="content") {
            newtarget="content_scroller";
        }
        else {
            newtarget=atarget;
        }

        if (!haveScrollbar) {
            document.location="#"+ananchor;
        }
        else {
            alist=gebi(atarget).getElementsByTagName("a");
            for (var i=0;i< alist.length;i++) {
                if (alist[i].name.toLowerCase()===ananchor.toLowerCase()) {
                    pos=findPosY(alist[i])-findPosY(gebi(newtarget))-10;
                    //gebi("content_scroller").scrollTop=;
                    $("#"+newtarget).animate({scrollTop:pos},500);
                }
            }
        }
        anchor[atarget]='';
    }
}

//=======================================================;
function reaccordion() {
    if ($(gebi("navholder")).accordion()) {jQuery(".sublink_container").show();$(gebi("navholder")).accordion("destroy");   }
    if (animation) {accordion("reaccordion");}
    gebi("navdragger").style.width="";
    gebi("navdragger").style.height="";
}

var saveScrollTop;
var curpic;


var imgArray2=[];
var imgArrayCounter2=0;

//=======================================================;
function showpic(href,caption,prev,next,imgid,spanid,isSlideFromSlideshow,tagable) {
//isSlideFromSlideshow
    // spanid holds the id of the smaller image, imgid just the numeric id of the database;

    var startwidth;
    var startheight;
    var image;
    var asrc;
    var previmage;
    var nextimage;
    var ph=gebi("picture_holder");
    
    removeAllTags();

    gebi("prevbutton").style.display="none";
    gebi("nextbutton").style.display="none";

    //alert("prev: " + prev +"\nnext :" + next);

   if (gebi("caption_holder").style.visibility==="hidden") {

        saveScrollTop=gebi("content_scroller").scrollTop;
        ph.style.width="150px";
        ph.style.height="150px";
        startwidth=150;
        startheight=150;

        unround("picture_holder");
        if (getStyle("picture_holder","backgroundColor")==="") {setStyle("picture_holder","backgroundColor","#ffffff");}

        $("#fader2").unbind("click");

        gebi("piccenter").innerHTML="";

        ph.style.display="inline";
        $("#picture_holder").css("opacity",1);
        setcenter("picture_holder","screen");
        ph.style.display="none";

        $("#picture_holder").stop().fadeIn(500);
        showWait("screen");

        image=document.createElement("img");
        image.src="";
        image.id="currentpic";
        image.onmouseout=function(){kill_tag(false);};
        image.style.cursor="hand";
        image.style.cursor="pointer";
        $(image).css("opacity",0);

        faderIn(2,"#000000");

    }
    else {
        setcenter("picture_holder","screen");

        image=gebi("piccenter").childNodes[0];
        $(image).fadeOut(500);
        gebi("piccenter").removeChild(image);
        startwidth=noPy(gebi("picture_holder").style.width);
        startheight=noPy(gebi("picture_holder").style.height);
        showWait("screen");

    }

    gebi("imageId").value=imgid;



    gebi("caption_holder").innerHTML=caption + "&nbsp;";
    var captionHeight=getCaptionHeight(caption + "&nbsp;" );

    gebi("tagme").style.display="none";
    gebi("editCaption").style.display="none";


    image.onload=function() {

        gebi("closeicon").style.display="";
        $(image).fadeIn(500);

        gebi("picture_holder").style.width=startwidth;


        var cw=max(noPy(image.width)+20,410);
        var ch=noPy(image.height)+40+captionHeight;
        var newleft=noPy(ph.style.left)-cw/2+(startwidth/2);
        var newtop=noPy(ph.style.top)-ch/2+(startheight/2);
        $("#picture_holder").animate({width:cw,left:newleft,height:ch,top:newtop},500,function(){
            if (prev!=="") {previmage=new Image();previmage.src=getImageSource(prev);gebi("prevbutton").style.display="";gebi("prevbutton").onclick=function(){gebi(prev).onclick();};}
            if (next!=="") {nextimage=new Image();nextimage.src=getImageSource(next);gebi("nextbutton").style.display="";gebi("nextbutton").onclick=function(){gebi(next).onclick();};}

            gebi("caption_holder").style.visibility="visible";

            if (isSlideFromSlideshow) {getTags(imgid);}

            gebi("piccenter").appendChild(image);

            $(image).animate({opacity:1},1000);
            hideWait();
            round("picture_holder");
            picLeft=findPosX(gebi("currentpic"));
            picRight=picLeft+getscrollwidth("currentpic");

            picTop=findPosY(gebi("currentpic"));
            picBottom=picTop+getscrollheight("currentpic");
            $("#fader2").bind("click",function(){closepic();});

            if (gebi("dragme")) {

                if (isSlideFromSlideshow) {
                    if ((passwordPassed) || (tagable==="True")) {
                        image.ondblclick=tagit;
                        gebi("tagme").style.display="";
                    }
                }
            }
            if ((passwordPassed) && (isSlideFromSlideshow)) {gebi("editCaption").style.display="";}


        });
    };


    image.spanid=spanid;

    if (href.indexOf("picapic.asp")!==-1) {
        asrc=href+"&height="+(windowH-75)+"&width="+(windowW-75)+"&freeze=true";
    }
    else {
        asrc=vbasepath+"image.php/myimage.jpg?image="+encodeURIComponent(href)+"&height="+(windowH-75-captionHeight)+"&width="+(windowW-75);
    }
    // check if picture is in stock;

    for (var i=0;i< imgArray2.length;i++) {
        if (imgArray2[i].src===asrc) {
            if (imgArray2[i].width) {
                imgArray2[i].onload=image.onload;
                image=imgArray2[i];
                image.onload();

                return;
            }
            else {
                alert("failed");
            }


        }
    }
    image.src=asrc;

}






//=======================================================;
function getCaptionHeight(caption) {
    var newcaption="&nbsp;";
    gebi("caption_holder").style.height="";
    if (caption!=="") {newcaption="&nbsp;";}
    gebi("caphlpdiv").style.display="";
    gebi("caption2_holder").innerHTML=newcaption;
    var captionHeight=gebi("caption2_holder").scrollHeight;
    gebi("caphlpdiv").style.display="none";
    gebi("caption_holder").style.height=max(   captionHeight,25);
    return captionHeight;

}

//=======================================================;
function getImageSource(spanId) {

    // get's the source of a picture taking in acount the screen size;
    var aspan=gebi(spanId);
    var captionHeight=getCaptionHeight(aspan.caption);
    return vbasepath+"image.php/myimage.jpg?image="+encodeURIComponent(aspan.link)+"&height="+(windowH-75-captionHeight)+"&width="+(windowW-75);
}

//=======================================================;
function closepic() {

    removeAllTags();
    if (gebi("currentpic")) {gebi("currentpic").onload="";}
    hideWait(); // just in case the picture didn't load;

    gebi("caption_holder").style.visibility="hidden";
    $("#picture_holder").stop().fadeOut(500,function(){gebi("piccenter").innerHTML="";gebi("caption_holder").innerHTML="";});
    gebi("loginpane").style.display="";
    faderOut(2);
    if (gebi("dragme")) {cancel_tag();}

}

//=======================================================;
function noPy(aval) {
    if (aval==="") {return 0;}
    return parseInt(aval,10);
}


//=======================================================;
function setStyleText(aname,atext,ignoreState) {

    if (ignoreState) {
        styleName="."+aname;
    }
    else {
        styleName=getStyleName(aname);
    }

    for (var i=0;i< theRules.length;i++) {
        if (theRules[i].selectorText.toLowerCase()===styleName) {
            theRules[i].style.cssText=atext;
            return;
        }
    }
    // not found;

    createStyle(aname,"padding","0px");  // whatever, we will overwriteit straight away;

    for (var i=0;i< theRules.length;i++) {
        if (theRules[i].selectorText.toLowerCase()===styleName) {
            theRules[i].style.cssText=atext;
            return;
        }
    }
}

//=======================================================;
function getStyleText(aname,ignoreState) {

    if (ignoreState) {
        styleName="."+aname;
    }
    else {
        styleName=getStyleName(aname);
    }
    for (var i=0;i< theRules.length;i++) {
        if (theRules[i].selectorText.toLowerCase()===styleName) {
            theText=theRules[i].style.cssText;

            return theText;
        }
    }
    return "";
}

//=============================================================;
function isIE() {
    ua = navigator.userAgent.toLowerCase();

    if ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) ) {
        return true;
    }
    return false;
}


//=============================================================;
function widthWaste(styleName) {
    if (isIE()) {return 0;}
    return getWidthStuff(styleName);
}

//=============================================================;
function heightWaste(styleName) {
    if (isIE()) {return 0;}
    return getHeightStuff(styleName);
}


//=============================================================;
function getWidthStuff(styleName) {
    pl=noPy(getStyle(styleName,"paddingLeft"));
    pr=noPy(getStyle(styleName,"paddingRight"));
    bl=noPy(getStyle(styleName,"borderLeftWidth"));
    br=noPy(getStyle(styleName,"borderRightWidth"));
    if (getStyle(styleName,"borderRightStyle")==="none") {br=0;}
    if (getStyle(styleName,"borderRightStyle")==="") {br=0;}
    if (getStyle(styleName,"borderLeftStyle")==="none") {bl=0;}
    if (getStyle(styleName,"borderLeftStyle")==="") {bl=0;}
    ml=noPy(getStyle(styleName,"marginLeft"));
    mr=noPy(getStyle(styleName,"marginRight"));
    ml=0;
    mr=0;
    return pl+pr+bl+br+ml+mr;
}
//=============================================================;
function getLeftWidthStuff(styleName) {
    //pl=noPy(getStyle(styleName,"paddingLeft"));
    bl=noPy(getStyle(styleName,"borderLeftWidth"));
    if (getStyle(styleName,"borderLeftStyle")==="none") {bl=0;}
    if (getStyle(styleName,"borderLeftStyle")==="") {bl=0;}
    ml=noPy(getStyle(styleName,"marginLeft"));
    ml=0;
    pl=0;
    //mr=0;
    return pl+bl+ml;
}
//=============================================================;
function getHeightStuff(styleName) {
    pt=noPy(getStyle(styleName,"paddingTop"));
    pb=noPy(getStyle(styleName,"paddingBottom"));
    bt=noPy(getStyle(styleName,"borderTopWidth"));
    bb=noPy(getStyle(styleName,"borderBottomWidth"));
    if (getStyle(styleName,"borderTopStyle")==="none") {bt=0;}
    if (getStyle(styleName,"borderTopStyle")==="") {bt=0;}
    if (getStyle(styleName,"borderBottomStyle")==="none") {bb=0;}
    if (getStyle(styleName,"borderBottomStyle")==="") {bb=0;}
    mt=noPy(getStyle(styleName,"marginTop"));
    mb=noPy(getStyle(styleName,"marginBottom"));
    mt=0;
    mb=0;
    return (pt+pb+bt+bb+mt+mb);
}//=============================================================;
function getTopHeightStuff(styleName) {
    //pt=noPy(getStyle(styleName,"paddingTop"));
    bt=noPy(getStyle(styleName,"borderTopWidth"));
    if (getStyle(styleName,"borderTopStyle")==="none") {bt=0;}
    if (getStyle(styleName,"borderTopStyle")==="") {bt=0;}
    mt=noPy(getStyle(styleName,"marginTop"));
    mt=0;
    pt=0;
    //mb=0;
    return (pt+bt+mt);
}


var divcounter=0;

// ======================================================================	;
function roundstuff(target) {
    // if the div's don't have an id, set one;
    $("#"+target+" .rounded").each(function(){
        if (this.id==="") {this.id="rdiv_"+divcounter;divcounter++;}
    });
    $("#"+target+" .rounded_small").each(function(){
        if (this.id==="") {this.id="rdiv_"+divcounter;divcounter++;}
    });
    $("#"+target+" .rounded_normal").each(function(){
        if (this.id==="") {this.id="rdiv_"+divcounter;divcounter++;}
    });
    $("#"+target+" .rounded_big").each(function(){
        if (this.id==="") {this.id="rdiv_"+divcounter;divcounter++;}
    });
    if ($("#"+target+" .rounded").length>0)  {round("rounded");}
    if ($("#"+target+" .rounded_small").length>0)  {round("rounded_small");}
    if ($("#"+target+" .rounded_normal").length>0)  {round("rounded_normal");}
    if ($("#"+target+" .rounded_big").length>0)  {round("rounded_big");}

}

var rotorId=0;  // to attach to the id of a rotor image, in case two rotors point to the same show;

var imgID=0;
// ======================================================================	;
function imagestuff(target) {
    // replace source of all images with the image resizer;
    var alist=gebi(target).getElementsByTagName("img");

    for (var i=0;i< alist.length;i++) {

        var img=alist[i];


            var w="";
            var h="";
            var cr="";

            var width="";
            var height="";

            if (isIE())  {
                var atext=img.outerHTML;
                if (findAttribute(atext,"height")) {height=findAttribute(atext,"height");}
                if (findAttribute(atext,"width"))  {width=findAttribute(atext,"width");}
            }
            else {
                if (img.getAttribute("height")) {height=img.getAttribute("height");}
                if (img.getAttribute("width"))  {width=img.getAttribute("width");}
            }

            if (width!=="")  {width=parseInt(width,10);img.setAttribute("width",width);}
            if (height!=="") {height=parseInt(height,10);img.setAttribute("height",height);}
            if (width!=="")  {w="&width="+width;}
            if (height!=="") {h="&height="+height;}


            if ((width!=="") && (height!=="")) {cr="&cropratio="+width+":"+height;}

            if (img.src.indexOf("picapic.asp")===-1) {
                if ((w!=="") || (h!=="")) { // need resizer;

                    if ((img.src.indexOf("noresize")===-1) && (img.className.indexOf("noresize")===-1)) {
                        var newsrc=vbasepath+"image.php/myimage.jpg?image="+encodeURIComponent(img.src)+w+h+cr;

                        img.src=newsrc;
                        img.id="img_"+imgID;
                        imgID++;
                    }
                }
            }
            else {

                img.id=img.src+"&rotorId=" + rotorId;
                rotorId++;
                
            }

            if (img.src.indexOf("print_friendly")===-1) {
            var aspan=document.createElement("span");

            img.parentNode.insertBefore(aspan,img);

            aspan.appendChild(img);

            aspan.style.position="relative";

            aspan.style.marginLeft=img.hspace;
            aspan.style.marginRight=img.hspace;
            aspan.style.marginTop=img.vspace;
            aspan.style.marginBottom=img.vspace;

            img.vspace="";
            img.hspace="";

            aspan.style.display="inline-block";
            aspan.style.position="relative";

            if ((img.align==="left") || (img.align==="right")) {
                if (isIE()) {
                    aspan.style.styleFloat=img.align;
                }
                else {

                    aspan.style.cssFloat=img.align;
                }
            }
            else {

               // aspan.style.verticalAlign=img.align;
            }
            img.align="";

            aspan.className=aspan.className+" "+"image"+target;
            aspan.dropshadow=img.className;
            }

        }

}



// ======================================================================	;
function swapPics(anid,target,icnt) {

   return (function(){
        if (gebi(anid)) {
        
            //getPicSource(anid)
        
            var current=gebi(anid);
            var img=new Image();
            img.src=anid+"&r="+Math.random();
            img.style.position="absolute";
            img.id=current.id;
            $(img).css("opacity",0);
            img.className=current.className;
            img.vspace=current.vspace;
            img.hspace=current.hspace;
            img.style.left=0;
            img.style.top=0;

            current.parentNode.appendChild(img);

            $(current).stop().css("opacity",1);
            img.onload=function(){



                 $(img).animate({opacity:1},1000,function(){
                    if ((current.parentNode) && (rotators[target])) {

                        current.parentNode.removeChild(current);
                        current=null;
                        img.style.position='relative';
                        var time=img.src.split("time=")[1];
                        if (time) {
                            time=time.split("&")[0];
                            if (time!=="") {time=time*1000;} else {time=5000;}
                        }
                        else {
                            time=3000;
                        }
                        var funcref=swapPics(img.id,target,icnt);
                        if (rotators[target]) {
                        if (rotators[target][icnt]) {
                        if (rotators[target][icnt][1] ){
                            rotators[target][icnt][1]=setTimeout(funcref,time);
                        }
                        }
                        }

                    }
                });
            };
        }
        else {
            return false;
        }
   });
}


var rotators=[];  //id's of images that rotate;


// ======================================================================	;
function stopRotators(target) {

    if (rotators[target]){
        for (var i=0;i< rotators[target].length;i++) {
            clearTimeout(rotators[target][i][1]);
            // remove onloadhandlers;
            if (gebi(rotators[target][i][0])) { // if it still exists;
                gebi(rotators[target][i][0]).onload="";
            }

        }
        rotators[target]=[];

    }
}
// ======================================================================	;
function startRotators(target) {
    if (rotators[target]){
        for (var i=0;i< rotators[target].length;i++) {
            clearTimeout(rotators[target][i][1]);
            // remove onloadhandlers;
            if (gebi(rotators[target][i][0])) { // if it still exists;
                gebi(rotators[target][i][0]).onload="";
            }
        }
    }

    rotators[target]=[];

    var alist=gebi(target).getElementsByTagName("img");

    for (var i=0;i< alist.length;i++) {
        var img=alist[i];
        if (img.src.indexOf("picapic.asp")!==-1) {
                var rotcont=[];
                rotcont[0]=img.id;
                rotators[target][rotators[target].length]=rotcont;
        }
    }
    // now don't start all at the same time;
    for (var icnt=0;icnt< rotators[target].length;icnt++) {

        var funcref=swapPics(rotators[target][icnt][0],target,icnt);
        time=gebi(rotators[target][icnt][0]).src.split("time=")[1];
        if (time) {stime=time*1000;} else {stime=5000;}
        rotators[target][icnt][1]=setTimeout(funcref,stime+icnt*2000);
    }

}


//  =============================================================================;
function getJson(type,callback,content_c,target,panchor,assets_site) {
    // type should be 'nav','content' or 'panes';

    callback='JFgetdata('+callback+')';
    extra="";
    if (content_c!=="") {
        extra="&content_c=" + content_c;
    }
    if (target!=="") {
        extra=extra+"&target=" + target;
    }
    if (panchor!=="") {
        extra=extra+"&anchor=" + panchor;
    }
    if (forceRemote) {extra=extra+"&forceremote=1";}
    if ((type==="slideshows") || (type==="products")) {
        src=vbasepath+"getjson.asp?r="+Math.random()+"&site_c="+assets_site+"&type="+type+"&callback="+callback+extra;
    }
    else {
        src=vbasepath+"getjson.asp?r="+Math.random()+"&site_c="+site_c+"&type="+type+"&callback="+callback+extra;
    }
    
    
    request = new JSONscriptRequest(src,"js");
    request.buildScriptTag();
    request.addScriptTag();
}
// ======================================================================	;
function JFgetdata(callback,jsonstuff) {

    var j=0;

    var myarray = [];
    for (var i=0;i< jsonstuff.items.length;i++) {
        var rec = jsonstuff.items[i];
        for(var n in rec) {
            fieldname=n;
            //myarray[j]=eval("rec."+trim(fieldname+" "));
            myarray[j]=rec[fieldname];

            j++;
        }
    }

    callback(myarray);
}
// ======================================================================	;
function JFgetdata(callback,jsonstuff) {

    var j=0;

    var myarray = [];
    for (var i=0;i< jsonstuff.items.length;i++) {
        var rec = jsonstuff.items[i];
        for(var n in rec) {
            fieldname=n;
            //myarray[j]=eval("rec."+trim(fieldname+" "));
            myarray[j]=rec[fieldname];

            j++;
        }
    }

    callback(myarray);
}

// ======================================================================	;
function toArray(jsonstuff) {
    var j=0;

    var myarray = [];
    for (var i=0;i< jsonstuff.items.length;i++) {
        var rec = jsonstuff.items[i];
        for(var n in rec) {
            fieldname=n;
            //myarray[j]=eval("rec."+trim(fieldname+" "));
            myarray[j]=rec[fieldname];

            j++;
        }
    }

    return myarray;


}

//==============================JSON Class=======================;

function JSONscriptRequest(fullUrl,type) {
    this.fullUrl = fullUrl;
    this.type=type;
    this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
    this.headLoc = document.getElementsByTagName("head").item(0);
    this.scriptId = 'YJscriptId' + JSONscriptRequest.scriptCounter++;
}

JSONscriptRequest.scriptCounter = 1;

JSONscriptRequest.prototype.buildScriptTag = function () {

    if (this.type==="js") {
        this.scriptObj = document.createElement("script");
        this.scriptObj.setAttribute("type", "text/javascript");
        this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
        this.scriptObj.setAttribute("id", this.scriptId);

    }
    else {
        this.scriptObj = document.createElement("style");
        this.scriptObj.setAttribute("type", "text/css");
        this.scriptObj.setAttribute("id", this.scriptId);
        this.scriptObj.innerHTML=this.fullUrl;

    }
};

JSONscriptRequest.prototype.removeScriptTag = function () {
    if (this.scriptObj) {
         this.headLoc.removeChild(this.scriptObj);
         this.scriptObj=null;
     }
};

JSONscriptRequest.prototype.addScriptTag = function () {
    this.headLoc.appendChild(this.scriptObj);
};


//  =============================================================================;
function findAttribute(astring,attr) {

    var str=astring;
    str=trim(str.toLowerCase());
    str=replace(str,"  "," ");
    str=replace(str,"  "," ");
    str=replace(str,"  "," ");
    str=replace(str,"'","");
    str=replace(str,"\"","");
    str=replace(str," =","=");
    str=replace(str,"= ","=");
    str=replace(str,">","");
    //log(str);
    var ar=str.split(" "+attr+"=");
    if (ar.length>1) {
        val=ar[1].split(" ")[0];
        val=replace(val,"\"","");
        val=replace(val,"'","");
        val=replace(val,"px","");

        return trim(val);
    }
    return "";
}

var lastTarget;



// ======================================================================	;
function showNode(id,atarget,ananchor,doNotCheckPiggyBack) {
    lastId=id;
    lastTarget=atarget;

    for (var i=1;i<11;i++) {
        if (gebi("aux"+i).shownode===id) {
            removeAuxClickedStates("shownode");
            jQuery("#aux"+i).addClass(gebi("aux"+i).roundingclicked);
        }
    }


    // normaly target is defined for a record in the database. if target is specified, then show it in the specified pane;

    // show node 'id' in pane 'target';
    //store the id, needed for editing;

    //if (gebi("modal_holder").style.display="block");

    //if (atarget!=="modal") {closeModal(false);}

    if ((ananchor!=="") && (atarget==="") && (id===contentId)) {setNav(id);anchor.content=ananchor;goToAnchor("content");return;}
    if ((ananchor!=="") && (atarget==="content") && (id===contentId)) {setNav(id);anchor.content=ananchor;goToAnchor(atarget);return;}
    if ((ananchor!=="") && (atarget==="top") && (id===topId)) {setNav(id);anchor.top=ananchor;goToAnchor(atarget);return;}
    if ((ananchor!=="") && (atarget==="bottom") && (id===bottomId)) {setNav(id);anchor.bottom=ananchor;goToAnchor(atarget);return;}
    if ((ananchor!=="") && (atarget==="left") && (id===leftId)) {setNav(id);anchor.left=ananchor;goToAnchor(atarget);return;}
    if ((ananchor!=="") && (atarget==="right") && (id===rightId)) {setNav(id);anchor.right=ananchor;goToAnchor(atarget);return;}
    if ((ananchor!=="") && (atarget==="modal") && (id===modalId)) {setNav(id);anchor.modal=ananchor;goToAnchor(atarget);return;}


      // id of the last page loaded in main content pane;

    if (!doNotCheckPiggyBack) {
        if ((piggyBack[id]==='')||(piggyBack[id])) {
            if (piggyBack[id]!==''){
                var alist=piggyBack[id].split(",");
                var atargetlist=piggyTarget[id].split(",");
                for (var i=0;i< alist.length-1;i++) {
                    showNode(alist[i],atargetlist[i],"",true); // do not check for piggybacks on piggybacks;
                }
            }
        }
        else {
            
            getJson("piggyback","piggybackCallback",id,"","");

        }
    }
    // check if the page is already loaded, if so, skip;
    var skip=false;
    if ((atarget==="content") && (contentId===id)) {skip=true;}
    if ((atarget==="left") && (leftId===id)) {skip=true;}
    if ((atarget==="right") && (rightId===id)) {skip=true;}
    if ((atarget==="top") && (topId===id)) {skip=true;}
    if ((atarget==="bottom") && (bottomId===id)) {skip=true;}
    if ((atarget==="modal") && (modalId===id)) {skip=true;}


    if (!skip) {

        //gets the content of the page when clicked on a nav div;
        showEditStuff();


        if (atarget==="modal") {
            lastNodeShowed=id;
        }
        else {
            lastNodeShowed=id;
        }

        // if atarget is empty (this happens when a link in a page points to target=default), then jQuery throws an exception;
        if (atarget!=="") {
            if (isIE())  {
                $("#"+atarget+" img").css("visibility","hidden");
            }
            $("#"+atarget).stop().animate({opacity:0},500);
        }

        if (atarget==="") {
            showWait("content");
        }
        else if (atarget==="modal") {
            showWait("screen");
        }
        else {
            showWait(atarget);
        }

        //setTimeout(function(){getJson("content","showNodeCallBack",id,atarget,ananchor);},2000);
        getJson("content","showNodeCallBack",id,atarget,ananchor);
    }


}

var piggyBack=[];  // array of ID's to load with a page;
var piggyTarget=[]; // array of targets;

// ======================================================================	;
function piggybackCallback(pdata) {

    var original_page=pdata[5];
    piggyBack[original_page]='';
    piggyTarget[original_page]='';

    for (var ic=0;ic< pdata.length;ic=ic+7) {
        if (pdata[ic+3]!=='') { // can be empty if no piggybacks;

            var newdata=[];
            //   0        1       2       3;
            // content,page_no,target, content_c,external,original_page;
            newdata[0]=pdata[ic];
            newdata[1]=pdata[ic+1];
            newdata[2]=pdata[ic+2];
            newdata[3]=pdata[ic+3];
            newdata[4]=pdata[ic+4];
            newdata[5]=''; // anchor, not implemented;
            newdata[6]=pdata[ic+6]; // modified
            original_page=pdata[ic+5];
            showNodeCallBack(newdata);
            piggyBack[original_page]=piggyBack[original_page]+newdata[3]+",";
            piggyTarget[original_page]=piggyTarget[original_page]+newdata[2]+",";
        }
    }
}

// ========================================================================;
function showNodeCallBack(data) {


var eh=0; // extra height;
if (beforeVBPageLoad) {beforeVBPageLoad();}

    //data contains: content,page_no,target, content_c , external,anchor;
    var myhtml=data[0];
    var target=data[2];
    var id=data[3];
    var extern=data[4];
    var ananchor=data[5];
    var modified=data[6];
    anchor[target]=ananchor;




    if ((target==="content") && (contentId===id)) {hideWait();return;}
    if ((target==="left") && (leftId===id)) {hideWait();return;}
    if ((target==="right") && (rightId===id)) {hideWait();return;}
    if ((target==="top") && (topId===id)) {hideWait();return;}
    if ((target==="bottom") && (bottomId===id)) {hideWait();return;}
    if ((target==="modal") && (modalId===id)) {hideWait();return;}



    if (target==="content") {contentId=id;}
    if (target==="top") {topId=id;}
    if (target==="left") {leftId=id;}
    if (target==="right") {rightId=id;}
    if (target==="bottom") {bottomId=id;}
    if (target==="modal") {modalId=id;}

    if ((target!=="modal") && (target!=="modal2")) {
        if (gebi("modal_holder").style.display==="block") {closeModal(true);}

    }

    gebi("left_holder").style.display="";
    gebi("right_holder").style.display="";
    gebi("navdragger").style.display="";
    gebi("top_holder").style.display="";

    if (target==='content') {
        if ((getStyle("document_body","overflow")==="hidden") || (getStyle("document_body","overflowY")==="hidden")) {
            setScroll('content');
            haveScrollbar=true;
        }
        else {
            setScroll('window');
            haveScrollbar=false;
        }
    }

    var doit=false;
    if (extern!=="") {
       isExternal[target]=extern;
       if (extern.indexOf("calendar.asp")!==-1) {
       
            extern=vbasepath+extern+"&noheader=1";
            if (forceRemote) {extern=extern+"&forceremote=1";}
            if (md5Hash!=="") {extern=extern+ "&id="+md5Hash;}
       
       
       }
       if ((extern.indexOf("guestbook.asp")!==-1) || (extern.indexOf("slideshow.asp")!==-1) || (extern.indexOf("productshow.asp")!==-1)|| (extern.indexOf("emailform.asp")!==-1)|| (extern.indexOf("emaillist.asp")!==-1) || (extern.indexOf("ss_piclens")!==-1) || (extern.indexOf("ps.asp")!==-1)|| (extern.indexOf("email.asp")!==-1)|| (extern.indexOf("emaillist.asp")!==-1) ) {
            if (extern.find("guestbook.asp")) {guestbookTarget=target;}
            // extern:  slideshow.asp?site_c=123&ss_id=abc;

            extern=replace(extern,"slideshow.asp?",vbaseroot+"?relay=slideshow.asp&usermd5="+gbmd5_tags+"&");
            extern=replace(extern,"guestbook.asp?",vbaseroot+"?relay=guestbook.asp&");
            extern=replace(extern,"productshow.asp?",vbaseroot+"?relay=productshow.asp&");
            extern=replace(extern,"emailform.asp?",vbaseroot+"?relay=emailform.asp&");
            extern=replace(extern,"emaillist.asp?",vbaseroot+"?relay=emaillist.asp&");
            extern=replace(extern,"calendar.asp?",vbaseroot+"?relay=calendar.asp&");
            //extern=vbasedomain + "?relay=slideshow.asp";
            extern=extern+"&page_c="+id;
            if (extern.indexOf("http://")==-1) {extern=vbasepath+extern;}
            if (forceRemote) {extern=extern+"&forceremote=1";}
            extern=extern+version;
            if (md5Hash!=="") {extern=extern+ "&id="+md5Hash;}
            extern=extern + "&rnd=" + Math.random();
            if (extern.find("productshow.asp")) {extern=extern+"&mal_server="+mal_server+"&merchant_id="+merchant_id;}
            if ((extern.indexOf("slideshow.asp")!==-1) && (!tagsloggedin)) {extern=extern+"&taglogout=1";}

            // external page, however we need to inject the HTML in the main body, as opposed to using a iframe.;
            // the iframe cannot commucicate with vBase when used cross-domain, like embropatch.com;
            if ((target==="modal") && (gebi("modal_holder").style.display!=="block")) {showModal(false);}

            piclensTarget=target;
            if ((piclensTarget==="modal") && (gebi("modal_holder").style.display!=="block")) {showModal(false);}
            if ((piclensTarget==="modal2") && (gebi("modal2_holder").style.display!=="block")) {showModal2(false,true);}
            
            //jQuery.getJSON(extern+"&callback=?", function(data){JFgetdata(picLensCallback,data);});
            
            if (sameDomain){
                //http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316451;
                $.get(extern,function(data){picLensCallback(data);});
            }
            else {
                //$.get(extern,function(data){picLensCallback(data);});
            
                getPageAsJSON(extern,"picLensCallback");

            }
        }
        else {
             if (forceRemote) {
                if (extern.find("?")) {
                    //extern=extern+"&forceremote=1";
                }
                else {
                    //extern=extern+"?forceremote=1";
                }
             }
            gebi(target).innerHTML=myhtml;
            eh=textHeight(target);
            //alert(eh);
            myhtml=myhtml+"<iframe  name=extif  id=extif scrolling='auto'  frameborder='0' src='"+extern+"' style='border-width: 0px; margin: 0px; padding: 0px;'>";
            doit=true;
        }
    }
    else {
        isExternal[target]=false;
        doit=true;
    }

    if (doit) {
        $("#"+target).stop();
        if ((target==="modal") && (gebi("modal_holder").style.display!=="block"))   {showModal(false);}
        if ((target==="modal2") && (gebi("modal2_holder").style.display!=="block")) {showModal2(false,true);}
        if (myhtml) {
            if (!isIE()) {

                myhtml=replace(myhtml,"<img ","<img style=visibility:hidden onload=\"$(this).css('opacity',0).css('visibility','visible').animate({opacity:1},500)\" ");
            }
        }
        
        if (getStyleText("printfriendly")!=="") {
            if (modified.indexOf("(")>0) {
                modified=modified.substr(0,modified.indexOf("(")-1);
            }
            if (target==="content") {
                myhtml=myhtml+"<br><p   align=right onclick=\"printNode('"+contentId+"')\"><span class=printfriendly style='cursor:pointer;cursor:hand'>print-friendly&nbsp;<img class=noresize align=absmiddle src="+vbasepath+"images/print_friendly.png></span><br>";
                myhtml=myhtml+"<span class=modified >this page was last modified on "+modified+"</span></p>";
            }
        }
        gebi(target).innerHTML=myhtml;

//      all links invisible;
        var alist=gebi(target).getElementsByTagName("a");
        for (var i=0;i< alist.length;i++) {
            if (alist[i].name==="") {
                alist[i].style.visibility="hidden";
           }
        }

        roundstuff(target);
        imagestuff(target);
        $("#"+target).css("opacity",0);
        stopRotators(target);
        startRotators(target);

        var saveheight=gebi(target).style.height;
        //if ((target!=="modal") && (target!=="modal2")) {gebi(target).style.height=""}

        if (target==="content") {initScroller("content_scroller");}
        if (target==="left") {initScroller("left_scroller");}
        if (target==="right") {initScroller("right_scroller");}
        if (target==="modal") {initScroller("modal");}
        if (target==="modal2") {initScroller("modal2");}
        initScroller("document_body");

        $("#"+target).stop().animate({opacity:1},300,function(){
            fixIEBlur();
        });

        linkstuff(target);
        setContentHeight(target);
        if (!target.find("modal")) { // modal will round itself after animation;
            round("link"+target);
        }
        round("image"+target);
        if (onVBPageLoad) {onVBPageLoad(id);}
        goToAnchor(target);

        setIframeSize(target,eh);
        hideWait();
        
    }

}
// ======================================================================	;
   function setIframeSize(target,eh) {
        if (gebi(target).getElementsByTagName("iframe").length!==0) {
            theframe=gebi(target).getElementsByTagName("iframe")[0];
            var src=theframe.src+" ";

            var ifh=false;
            ipos=src.indexOf("ifh=");
            if (ipos!==-1) {
                src=src.substr(ipos+4);
                ifh=src.split("&")[0];
            }

            if ((theframe.id!=="gbhif") && (theframe.id!=="shif")) {
                if (target==="content") {
                    theframe.style.display="none";

                    theframe.style.height=contentHeight-getHeightStuff("content")-eh-20;
                    if (ifh) { theframe.style.height=ifh;}

                    theframe.style.width=getscrollwidth("content_outer")-getWidthStuff("content_outer")-getWidthStuff("content_scroller")-getWidthStuff("content");
                    theframe.style.display="";
                }
                else if ((target==="modal") || (target==="modal2")) {


                    theframe.width=getModalWidth()-getWidthStuff("modal_holder")-getWidthStuff("modal");
                    theframe.height=getModalHeight()-getHeightStuff("modal_holder")-getHeightStuff("modal")-22;
                    if (ifh) { theframe.style.height=ifh;}

                    gebi("modal").style.overflow="hidden";
                }
                else {
                    theframe.width=getscrollwidth(target)-getWidthStuff(target);
                    theframe.height=middleHeight-getHeightStuff(target);
                    if (ifh) { theframe.style.height=ifh;}

                }
            }
        }
  }

// ======================================================================	;
function setNav(content_c) {


    if (!alwaysOpen) {return;}

    disableNavClick=true;

    if (gebi("divhlp4_"+content_c)) {
        pageno=gebi("divhlp4_"+content_c).value;

        mainid=pageno.split("_")[0];

        $(gebi("navholder")).accordion("activate",parseInt(mainid,10));
        if (mainid==="00")       {mainid="first";}
        if (mainid===lastLinkId) {mainid="last";}

        if ((pageno.split("_")[1]) ) {
            // open a sublink;
            subid=pageno;
            $("#link_"+mainid).trigger("click");
            $("#link_"+subid).trigger("click");
        }
        else {
            // open a main link;
            alink=mainid;
            if (mainid==="00") {alink="first";}
            if (mainid===lastLinkId) {alink="last";}
            $("#link_"+alink).trigger("click"); // show the page;
        }

        if (navPos=="top") {
            $(gebi("navholder")).accordion("activate", mainid); // close the menu;
        }

    }

    disableNavClick=false;
}


// ======================================================================	;
function getPageNo(content_c) {
    pageno="";
    if (gebi("divhlp4_"+content_c)) {
        return gebi("divhlp4_"+content_c).value;
    }
    return -1;
}



// ======================================================================	;
function showLastPage() {

    if (lastPage==="00") {
        $(gebi("link_first")).trigger("click");
    }
    else if (lastPage===lastLinkId) {
        $(gebi("link_last")).trigger("click");
    }
    else {
        $(gebi("link_"+lastPage)).trigger("click");
    }

}

    taglist = ";hr;li,h1;h2;h3;h4;select;table;";

// ======================================================================	;
// ======================================================================	;
function floatStyles(objectname) {
    if (objectname==="navdragger") {
        gebi(objectname).anchorX=parseInt(getPseudoStyle("navX",0),10);
        gebi(objectname).anchorY=parseInt(getPseudoStyle("navY",0),10);
        gebi(objectname).anchor=getPseudoStyle("navAnchor","left");
    }
    else if (objectname.find("aux")) {
        var aval=getPseudoStyle(objectname+"Anchor","left|0|0|");
        gebi(objectname).anchor=aval.split("|")[0];

        gebi(objectname).anchorX=parseInt(aval.split("|")[1],10);
        gebi(objectname).anchorY=parseInt(aval.split("|")[2],10);
        gebi(objectname).shownode=aval.split("|")[3];
    }
    else {
        gebi(objectname).anchorX=parseInt(getPseudoStyle(objectname+"X",0),10);
        gebi(objectname).anchorY=parseInt(getPseudoStyle(objectname+"Y",0),10);
        gebi(objectname).anchor=getPseudoStyle(objectname+"Anchor","left");
    }

    gebi(objectname).saveX=gebi(objectname).anchorX;
    gebi(objectname).saveY=gebi(objectname).anchorY;


}
// ======================================================================	;
function readStyles() {
    theRules=getRules();

    pageColor=getStyle("page","backgroundColor");
    bodyColor=getStyle("body","backgroundColor");

    setStyle("left_scroller","width",noPy(getStyle("left","width")));
    setStyle("right_scroller","width",noPy(getStyle("right","width")));
    th=noPy(getStyle("top","height"));
    bh=noPy(getStyle("bottom","height"));
    gebi("top").style.height=th-heightWaste("top");
    setStyle("top_holder","height",th);

    gebi("bottom").style.height=bh-heightWaste("bottom");
    setStyle("bottom_holder","height",bh);
    if (getStyle("top1_spacer","display")==="none") {gebi("top1_spacertr").style.display="none";}
    if (getStyle("top_holder","display")==="none") {gebi("top_holdertr").style.display="none";}
    if (getStyle("top2_spacer","display")==="none") {gebi("top2_spacertr").style.display="none";}
    if (getStyle("bottom1_spacer","display")==="none") {gebi("bottom1_spacertr").style.display="none";}
    if (getStyle("bottom_holder","display")==="none") {gebi("bottom_holdertr").style.display="none";}
    if (getStyle("bottom2_spacer","display")==="none") {gebi("bottom2_spacertr").style.display="none";}


    for (var icnt=0;icnt< vBaseObjects.length;icnt++) {
        rounding[vBaseObjects[icnt]]=getPseudoStyle("rounding_"+vBaseObjects[icnt],"");
    }

    gebi("left").style.overflow="hidden";
    gebi("right").style.overflow="hidden";


    rounding.rounded="normal tl tr bl br";
    rounding.rounded_normal="normal tl tr bl br";
    rounding.rounded_small="small tl tr bl br";
    rounding.rounded_big="big tl tr bl br";

    left100=getPseudoStyle("leftfull","");
    right100=getPseudoStyle("rightfull","");

    styleScrollbars=false;
    styleScrollbars=getBoolPseudoStyle("styleScrollbars",false);

    // get the position for the navigation, and set it;

    floatStyles("navdragger");
    navPos=getPseudoStyle("navpos","");
    gebi("navdragger").isFloat=true;
    // get the position for the toolbox, and set it;

    floatStyles("toolbox");
    gebi("toolbox").isFloat=getBoolPseudoStyle("toolboxFloat",false);  // indicates if detached from bottom pane;

    floatStyles("vbaselink");
    gebi("vbaselink").isFloat=getBoolPseudoStyle("vbaselinkFloat",false); // indicates if detached from toolbox;

    floatStyles("searchspan");
    gebi("searchspan").isFloat=getBoolPseudoStyle("searchspanFloat",false); // indicates if detached from toolbox;

    for (var i=1;i<11;i++) {
        floatStyles("aux"+i);
        gebi("aux"+i).isFloat=true;
        obj=gebi("aux"+i);
        $(obj).hover(function () {$(this).addClass('aux_hover');},function () {$(this).removeClass('aux_hover');});

        if (obj.shownode!=="") {
            $(obj).bind("click",function(){
                removeAuxClickedStates("round");
                removeClickedStates('all',false,'rounding');
                setNav(this.shownode);
                showNode(this.shownode,"","");


            });
            $(obj).addClass("auxlink");
        }



    }

    //save coordinates for resetPosition;

    menuOpener=getPseudoStyle("menuOpener","click");

    alwaysOpen=getBoolPseudoStyle("alwaysOpen",true);

    fixedHeight=getBoolPseudoStyle("fixedHeight",true);

    animation=getBoolPseudoStyle("animation",true);

    showNavText=getBoolPseudoStyle("shownavtext",true);

    useAssets=getBoolPseudoStyle("useAssets",false);
    if (hasDragDrop) {useAssets=false;}

   //return;
    $(".adminbutton").hover(function () {$(this).addClass('adminbutton_hover');},function () {$(this).removeClass('adminbutton_hover');});
    //alert(getStyle("document_body","overflow"))
    if ((getStyle("document_body","overflow")==="hidden") || (getStyle("document_body","overflowY")==="hidden")) {
        setScroll('content');
        haveScrollbar=true;

    }
    else {
        setScroll('window');
        haveScrollbar=false;
    }

    $("#sitemap").css("display","none");
    if (gebi("sitemap")) {
        gebi("sitemap").parentNode.removeChild(gebi("sitemap"));
    }


        var ah=parseInt(gebi("top1_spacer").offsetHeight,10);
        if (gebi("swapleftspacer")) {
            if (ah===0) {
                gebi("swapleftspacer").style.display="none";
            }
            else {
                gebi("swapleftspacer").style.height=ah;
            }
        }
        if (gebi("swaprightspacer")) {
            if (ah===0) {
                gebi("swaprightspacer").style.display="none";
            }
            else {
                gebi("swaprightspacer").style.height=ah;
            }
        }


    $("#top .linktop").hover(function () {$(this).addClass('linktop_hover');},function () {$(this).removeClass('linktop_hover');});
    $("#left .linkleft").hover(function () {$(this).addClass('linkleft_hover');},function () {$(this).removeClass('linkleft_hover');});
    $("#right .linkright").hover(function () {$(this).addClass('linkright_hover');},function () {$(this).removeClass('linkright_hover');});
    $("#content .linkcontent").hover(function () {$(this).addClass('linkcontent_hover');},function () {$(this).removeClass('linkcontent_hover');});
    $("#bottom .linkbottom").hover(function () {$(this).addClass('linkbottom_hover');},function () {$(this).removeClass('linkbottom_hover');});
    $(".linkmodal").hover(function () {$(this).addClass('linkmodal_hover');},function () {$(this).removeClass('linkmodal_hover');});

    $(".button").hover(function () {$(this).addClass('button_hover');},function () {$(this).removeClass('button_hover');});


    ar=taglist.split(";");
    for (var i=0;i<ar.length;i++) {
        rounding[ar[i]]="";
    }


    setStyleText("modal2",getStyleText("modal"));
    setStyleText("modal2_holder",getStyleText("modal_holder"));
    rounding["modal2"]=rounding["modal"];
    rounding["modal2_holder"]=rounding["modal_holder"];

    setStyleText("linkmodal2",getStyleText("linkmodal"));
    rounding["linkmodal2"]=rounding["modal2"];

    deletePseudoStyles();
    
    windowH=noPy(getWindowSize("h"));
    windowW=noPy(getWindowSize("w"));
    

}

// ======================================================================	;
function getBoolPseudoStyle(aname,defaultIfEmpty) {
    val=getPseudoStyle(aname,defaultIfEmpty);
    if (val==="") {val=defaultIfEmpty;}
    if (val==="true") {val=true;}
    if (val==="false") {val=false;}
    return val;
}



// ======================================================================	;
function docLoaded() {
    imagestuff("left");
    imagestuff("right");
    imagestuff("top");
    imagestuff("bottom");
    imagestuff("modal");
    imagestuff("content");

    // float them before doing linksstuff, else 
    floatBox('vbaselink',gebi("vbaselink").isFloat);


    linkstuff("left");
    linkstuff("right");
    linkstuff("top");
    linkstuff("bottom");
    linkstuff("content");
    linkstuff("modal");

    startRotators("content");
    startRotators("left");
    startRotators("right");
    startRotators("top");
    startRotators("bottom");
    startRotators("modal");

    setVsize("docLoaded",true);
    round();
    setVsize();
    docIsLoaded=true;
    gebi("caption_holder").style.visibility="hidden";
    $(".popper").hover(function () {showPop(this.getAttribute('helptext'));},function () {killPop();});
    document.body.onmousedown=selectmouse;
    document.body.onmouseup=function() {"isdrag=false";dragobject="";};
    document.body.onmousemove=movemouse;
    
//a=gebi("navholder")
//alert(a.className)    
//alert(a.newstylename)    

    //roundstuff();
 }

// ======================================================================	;
function setcenter(idToCenter,idToCalculate,addScroll) {
    windowH=noPy(getWindowSize("h"));
    windowW=noPy(getWindowSize("w"));

    // center something in the middle of a screen;
    oldvis=gebi(idToCenter).style.display;
    gebi(idToCenter).style.display="block";
    if ((!haveScrollbar) && (idToCalculate==="content")) {idToCalculate="window";}
    if (idToCalculate==="content") {idToCalculate="content_scroller";}
    gebi(idToCenter).style.position="absolute";
    if ((idToCalculate==="window") ||(idToCalculate==="screen")) {
        x=windowW/2+getScrollXY()[0]-getscrollwidth(idToCenter)/2;
        y=windowH/2+getScrollXY()[1]-getscrollheight(idToCenter)/2;
    }
    else {
        if(isIE()) {
            x=findPosX(gebi(idToCalculate))+getscrollwidth(idToCalculate)/2-getscrollwidth(idToCenter)/2;
            y=findPosY(gebi(idToCalculate))+getscrollheight(idToCalculate)/2-getscrollheight(idToCenter)/2;
        }
        else {
            x=findPosX(gebi(idToCalculate))+getscrollwidth(idToCalculate)/2-getscrollwidth(idToCenter)/2;
            y=findPosY(gebi(idToCalculate))+getscrollheight(idToCalculate)/2-getscrollheight(idToCenter)/2;
       }

    }

    if (addScroll) {
        document.getElementById(idToCenter).style.left=x+gebi("document_body").scrollLeft+'px';
        document.getElementById(idToCenter).style.top=y+gebi("document_body").scrollTop+'px';
    }
    else {
        document.getElementById(idToCenter).style.left=x+'px';
        document.getElementById(idToCenter).style.top=y+'px';

    }
    gebi(idToCenter).style.display=oldvis;

}

// ======================================================================	;
function showWait(where) {
    if (gebi("wait")) {
        setcenter("wait",where);
        $("#wait").stop().css("opacity",0).css("display","").animate({opacity:1},500);
    }
}

// ======================================================================	;
function hideWait() {
    if (gebi("wait")) {
        $("#wait").stop().animate({opacity:0},500,function() {$("#wait").css("display","none");});
    }
}

    // ======================================================================	;
    function showsearch(target,searchbuttons) {
        if (hasDragDrop) { // layout manager;
            if (dd.elements.searchSpan) {
                if (!gebi("locksearch").checked) {return;}
            }
        }

        searchResultPane=target;

        // searchbuttons is the id of a search inputs and buttons, which is normally hidden;

        if (target==="modal") {showModal(false);}

        if ((gebi(searchbuttons).style.display!=="none") && (searchTarget!=="")) {
            hidesearch();
        }

        $("#"+target).css("opacity",1);
        fixIEBlur();
        document.body.scrollTop=0;
        gebi("content_scroller").scrollTop=0;

        searchTargetHTML=gebi(target).innerHTML; // safe the comtent of the pane;

        if (gebi("searchresult").innerHTML!=="") {
            gebi(target).innerHTML=gebi("searchresult").innerHTML;
            linkstuff(target,true);

        }
        var aclone=gebi(searchbuttons).cloneNode(true);
        aclone.getElementsByTagName("input")[0].id="searchinput";

        if (gebi(target).childNodes[0]) {
            gebi(target).insertBefore(aclone,gebi(target).childNodes[0]);
        }
        else {
            gebi(target).appendChild(aclone);
        }
        $(".button").hover(function () {$(this).addClass('button_hover');},function () {$(this).removeClass('button_hover');});

        $(aclone).show(500,function(){        gebi("searchinput").focus();});
        searchTarget=target;
        setContentHeight(target);
        hideWait();
    }


    // ======================================================================	;
    function hidesearch() {

        if (searchTarget==="modal") {
            closeModal();
        }
        else {
            thisId=resetId(searchTarget);
            showNode(thisId,searchTarget,"");
        }
    }

    // ======================================================================	;
    function search(astring) {
        //ss=gebi("searchstring").value;
        extra="&site_c="+site_c;
        if (astring!=="") {
            showWait(searchTarget);
            if (forceRemote) {extra=extra+"&forceremote=1";}
            
            if (sameDomain) {

                //http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316451;
                // Do Not Send ServerXMLHTTP or WinHTTP Requests to the Same Server (as is done in getpageAsJSON);

                src=vbasedomain+"?relay=search.asp&search="+encodeURIComponent(astring)+extra;

                $.get(src,function(data){searchCallBack(data);});
            }
            else {
                src=vbasepath+"search.asp?search="+encodeURIComponent(astring)+extra;
                //$.get(src,function(data){searchCallBack(data);});
                getPageAsJSON(src,"searchCallBack");
            }

        }
    }

    // ======================================================================	;
    function searchCallBack(data) {
        hideWait();
        gebi("searchresult").innerHTML=data; // to save;
        sb=gebi(searchTarget).childNodes[0].cloneNode(true);

        gebi(searchTarget).innerHTML="";
        gebi(searchTarget).appendChild(sb);
        txt=document.createElement("text");
        txt.innerHTML=data;
        gebi(searchTarget).appendChild(txt);

        linkstuff(searchTarget,true);
        setContentHeight(searchTarget);
    }



//=====================================
function storeKey(evt){ 
	if (evt) {thekey=evt.keyCode;} else { thekey=event.keyCode;}
	if (thekey===16) {shiftkeydown=true;}	
	if (thekey===17) {controlkeydown=true;}
	if (thekey===13) {returnkeydown=true;}
	if (thekey===86) {vkeydown=true;}
	if (thekey===66) {bkeydown=true;}
	if (thekey===69) {ekeydown=true;}
	keyIsDown=true;
	if ((vkeydown) && (bkeydown) && (ekeydown)) {errorReport();}
	
}

//=====================================
function clearKey(evt){ 
	if (evt) {thekey=evt.keyCode;} else { thekey=event.keyCode;}
	if (thekey===16) {shiftkeydown=false;}
	if (thekey===17) {controlkeydown=false;}
	if (thekey===13) {returnkeydown=false;}
	if (thekey===86) {vkeydown=false;}
	if (thekey===66) {bkeydown=false;}
	if (thekey===69) {ekeydown=false;}
    keyIsDown=false;

}    


    // ======================================================================	;
    function edit(anaction) {  // target = left right top bottom or content;

        if ((anaction==="content") && (availablePanes.indexOf("C")===-1)) {
            alert("vBase is not configured for the current user to edit the main pane\nNavigate to an editable pane, and double-click this to edit");
            return;
        }
        if (!passwordPassed) {showneedloginmes();login();return;}

        showEditor('edit', anaction, site_c);
    }

    // ======================================================================	;
    function logincancelled() {
        doPoll=false;
        gebi("loginpane").style.display="none";
        faderOut(1);
    }

    // ======================================================================	;
    function login() {
        if (hasDragDrop) { // layout manager;
            if (dd.elements.toolbox) {
                if (!gebi("lock2").checked) {return;}
            }
        }

        faderIn(1,"#000000");
        $("#loginpane").show(0);
        setcenter("loginpane","screen");
        $("#loginpane").hide(0);
        $("#loginpane").fadeIn(400,function(){        gebi("username").focus();});
        gebi("username").value=gebi("pusername").value;
        gebi("password").value=gebi("ppassword").value;
    }

    // ======================================================================	;
    function checkpassword() {

        if (gebi("pusername").value==="") {alert("Please check your username");return;}
        if (gebi("ppassword").value==="") {alert("Please check your password");return;}
        setCookie("username",gebi("pusername").value,1);
        setCookie("password",gebi("ppassword").value,1);
        extra="";
        if (forceRemote) {extra=extra + "&forceremote=1";}
        docLoc=trim(document.location+" ").split("#")[0];
        extra=extra + "&loc=" + encodeURIComponent(docLoc);
        gebi("hidden_iframe").src=vbasepath+"login.asp?r="+Math.random()+"&site_c="+assets_site+"&username="+gebi("pusername").value+"&password="+gebi("ppassword").value+extra;
        if (!doPoll) {
            doPoll=true;
            poll("");
        }

    }

   // ======================================================================	;
    function logout() {
        gebi("pusername").value="";
        gebi("ppassword").value="";
        gebi("username").value="";
        gebi("password").value="";
        passwordPassed=false;
        setCookie("username","",-1);
        setCookie("password","",1);
        mayLayout=false;
        mayPages=false;
        maySlides=false;
        mayUsers=false;
        mayAccess=false;
        mayFileupload=false;
        mayImageupload=false;
        mayProducts=false;
        md5Hash="";
        showEditStuff();
        if (lastTarget) {
            resetId(lastTarget);
            if (lastId) {
                showNode(lastId,lastTarget,'');
            }
        }
        showLastPage();

        tagsloggedin=false;
        reDHTML("toolbox");    // size has changed;
        round("adminbutton");
        positionOnAnchor("toolbox");

    }


    // ======================================================================	;
    function showAdmin() {

        faderIn(1,"#ffffff");
        extra="";

        if (forceRemote) {extra="&forceremote=1";}
        extra=extra+"&vbasepath="+encodeURIComponent(vbasepath);

        adminSrc=vbasepath+"admin.asp?site_c="+site_c+"&assets_site="+assets_site+"&id="+md5Hash+extra+"&parentloc="+encodeURIComponent(document.location);  // make sure that parentloc is a the end of the querystring as we will cut it of;

        adminWrapperRef=dhtmlwindow.open(1005,"adminwrapper", "iframe", adminSrc, "vBase Admin", "width=150px,height=150px,resize=1,scrolling=1,center=1");
        adminWrapperRef.onclose=function(){
            faderOut(1);
            doPoll=false;
            return true;
        };

        if (!doPoll) {
            doPoll=true;
            poll("");
        }

    }

        // ======================================================================	;
        function showEditor(action,atarget,site_c,page_c,cstring) {

        document.body.scrollTop=0;
        extra="";
        contentStyle="";
        editId="";
        editPane="";
        if ((atarget) && (atarget!=='editemail')) {
            if ((isExternal[atarget]) && (atarget!=="new") && (atarget!=="slides")) {
                mes="";
                mes="This is an external link. \n";
                if (mayPages) {

                    if (isExternal[atarget]!=="") {
                    //if ((isExternal[atarget].find('guestbook.asp')) || (isExternal[atarget].find('slideshow.asp')) || (isExternal[atarget].find('productshow.asp'))) {
                        if (!confirm("This is a link to an external page.\nThe content of what you edit here will be included as the header of the external page.\nclick OK to proceed editing.")) {return;}
                    }
                    //else {
                    //    mes=mes+"You can change this in 'Admin > Manage pages'.";
                    //    alert(mes);
                    //    return;
                    //}
                }
                else {
                    mes=mes+"This cannot be edited.";
                    alert(mes);
                    return;
                }
            }

            if (atarget==="top") {editId=topId;editPane="top";}
            else if (atarget==="bottom") {editId=bottomId;editPane="bottom";}
            else if (atarget==="left") {editId=leftId;editPane="left";}
            else if (atarget==="right") {editId=rightId;editPane="right";}
            else if (atarget==="modal") {editId=modalId;editPane="modal";}
            else {editId=contentId;editPane="content";}

            if (atarget==="producttext") {
                editId=page_c;
                editPane="producttext";
                extra=extra + "&content=" + encodeURIComponent(cstring);
            }
            if (atarget==="guestbook") {
                editId=page_c;
                if (cstring) {
                    extra=extra + "&content=" + encodeURIComponent(cstring);
                }
                extra=extra + "&gbId=" + page_c;
            }

            if ("top,bottom,left,right,content,modal".find(atarget)) {
                if (getStyleProp(gebi(atarget),"backgroundColor")==="transparent") {
                    acolor=getParentBk(gebi(atarget));
                }
                else {
                    acolor=getStyleProp(gebi(atarget),"backgroundColor");
                }

                contentStyle=contentStyle+"."+atarget+"{background-color:"+acolor+";}";
                contentStyle=contentStyle+"."+atarget+"{color:"+getStyleProp(gebi(atarget),"color")+";}";
                contentStyle=contentStyle+"."+atarget+"{font-family:"+getStyleProp(gebi(atarget),"fontFamily")+";}";
                contentStyle=contentStyle+"."+atarget+"{font-size:"+getStyleProp(gebi(atarget),"fontSize")+";}";
                contentStyle=contentStyle+"."+atarget+"{font-weight:"+getStyleProp(gebi(atarget),"fontWeight")+";}";
                contentStyle=contentStyle+"."+atarget+"{width:"+(gebi(atarget).scrollWidth-widthWaste(atarget))+"px;}";
                contentStyle=contentStyle+"."+atarget+"{border:1px solid #aaaaaa;border-right:2px solid #888888;border-bottom:2px solid #888888;}";
            }
        }

        if (forceRemote) {extra=extra + "&forceremote=1";}
        extra=extra+"&target="+atarget;
        var src=vbasepath+"edit.asp?r="+Math.random()+"&site_c="+site_c+"&assets_site="+assets_site+"&id="+md5Hash+"&content_c="+editId+extra;
        if (atarget==='editemail') {
            astyle=getStyleText('emailbody');
            if (astyle==="") {astyle=getStyleText('content');}
            contentStyle=astyle;
            src=vbasepath+"emaillist_composer.asp?r="+Math.random()+"&site_c="+site_c+"&assets_site="+assets_site+"&id="+md5Hash+"&content_c="+editId+extra;
        }

        src=src+"&style=" + encodeURIComponent(contentStyle);
        docLoc=trim(document.location+" ").split("#")[0];

        src=src+"&vbasepath=" + encodeURIComponent(vbasepath);
        src=src+"&loc=" + encodeURIComponent(docLoc)+"#";
        showModal2(true,false);

        var aframe=document.createElement("iframe");
        aframe.id="editorIframe";
        aframe.name="editorIframe";

        gebi("modal2").appendChild(aframe);
        aframe.style.width="100%";
        aframe.style.height="95%";
        aframe.src=src;
        aframe.frameBorder=0;
        //aframe.style.border="1px solid #ff0000";
        aframe.style.border=0;
        aframe.style.overflow="hidden";

        spantext="<input type=button class=button onclick=update('cancel') value=cancel> <input type=button class=button onclick=update('update') value=update>";
        var aspan=document.createElement("span");
        aspan.innerHTML=spantext;
        gebi("modal2").appendChild(aspan);


        $(".button").hover(function () {$(this).addClass('button_hover');},function () {$(this).removeClass('button_hover');});

        hideWait();
        if (!doPoll) {
            doPoll=true;
            poll("");
        }


    }

    // ======================================================================	;
        function showneedloginmes() {
            gebi("updatediv").innerHTML="Please login first..";
            gebi("updatediv").style.display="inline";
            setcenter("updatediv","screen");
            gebi("updatediv").style.backgroundColor="#FFA28C";
            setTimeout(function(){gebi("updatediv").style.display="none";},2000);
        }
    // ======================================================================	;
        function showloginmes() {

            gebi("updatediv").innerHTML="Login successful!";
            gebi("updatediv").style.display="inline";
            setcenter("updatediv","screen");
            if (lastTarget) {resetId(lastTarget);showNode(lastId,lastTarget,'');}

            gebi("updatediv").style.backgroundColor="#ffffff";
            setTimeout(function(){gebi("updatediv").style.display="none";},1000);
        }

    // ======================================================================	;
        function showupdate() {

            gebi("updatediv").innerHTML="updating...<br><br><img src='"+vbasepath+"images/wait.gif' />";
            gebi("updatediv").style.display="inline";
            setcenter("updatediv","screen");
            gebi("updatediv").style.backgroundColor="#c0d1a5";

        }

    // ======================================================================	;
        function hideupdate() {

            gebi("updatediv").innerHTML="Done...";
            gebi("updatediv").style.backgroundColor="#c0d1a5";
            setTimeout(function(){gebi("updatediv").style.display="none";},400);
        }

    // ======================================================================	;
        function update(anaction) {
            gebi("editorIframe").src=gebi("editorIframe").src.split("#")[0]+"#"+anaction;
        }


var psSrc;  // source of productshowmanager;
    // ======================================================================	;
    function poll() {
        // polls to see if a login was successfull by interogating the hash fragment of the iframe source;
        // also polls to see if the update or cancel button was pressed;

        if (doPoll) {

            ahash=document.location.hash;
            ahash=replace(ahash,"##","#");

            if ((ahash.indexOf("#passwordpassed")!==-1) ) {

                document.location.hash="#";
                tagsloggedin=true; // for tagging;
                doPoll=false;

                apos=ahash.indexOf("&md5=");
                md5Hash=ahash.substring(apos+5).split("_")[0];
                permissions=ahash.substring(apos+5).split("_")[1];

                if (permissions.indexOf("L")!==-1) {mayLayout=true;}
                if (permissions.indexOf("P")!==-1) {mayPages=true;}
                if (permissions.indexOf("S")!==-1) {maySlides=true;}
                if (permissions.indexOf("U")!==-1) {mayUsers=true;}
                if (permissions.indexOf("A")!==-1) {mayAccess=true;}
                if (permissions.indexOf("F")!==-1) {mayFileupload=true;}
                if (permissions.indexOf("I")!==-1) {mayImageupload=true;}
                if (permissions.indexOf("G")!==-1) {mayProducts=true;}

                availablePanes=ahash.substring(apos+5).split("_")[2];
                if (availablePanes.length!==0) {  mayEdit=true;}
                passwordPassed=true;
                showLastPage();
                gebi("loginpane").style.display="none";
                faderOut(1);
                showEditStuff();
                showloginmes();
                gebi("hidden_iframe").src="";
                reDHTML("toolbox"); // size has changed, now more items;
                round("adminbutton");
                positionOnAnchor("toolbox");


            }
            else if (ahash.indexOf("#loginfailure")!==-1) {
                document.location.hash="#";
                doPoll=false;
                gebi("hidden_iframe").src="";
            }
            else if (ahash==="#updatecanceled") {
                document.location.hash="#";
                if (editPane!=="producttext") {
                    doPoll=false;
                }
                else {
                    adminWrapperRef.moveTo("middle","middle");
                }
                closeModal2();
            }
            else if (ahash.find("custom=")) {
                document.location.hash="#";

                eval(ahash.split("=")[1]);
            }
            else if (ahash.find("#updatecompleted")) {
                document.location.hash="#";
                // a page or pane was updated;
                if (editPane==="producttext") {
                    adminWrapperRef.moveTo("middle","middle");

                    var aval=ahash.split("{vbaseseperator}")[1];
                    aval=decodeURIComponent(aval);
                    var newloc=psSrc+"#updatecompleted{vbaseseperator}"+encodeURIComponent(aval);
                    window.frames["_iframe-adminwrapper"].location=newloc;
                    // here we keep polling;
                }
                else {
                    resetId(editPane);
                    showNode(editId,"","","");
                    doPoll=false;

                }
                closeModal2();

                hideupdate();

            }
            else if (ahash.find("#gbupdatecompleted")) {
                document.location.hash="#";
                var aval=ahash.split("{vbaseseperator}")[1];
                var gbId=ahash.split("{vbaseseperator}")[2];
                var action=ahash.split("{vbaseseperator}")[3];
                if (action==="insert") {
                    gbinsert(gbId,aval);
                }
                else {
                    gebi("action").value="update";
                    gebi("gbid").value=gbId;
                    gebi("text").value=aval;
                    gebi("content_"+gbId).innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' />   "+aval;
                    //faderOut(2);
                    document.gbform.submit();
                }


                doPoll=false;
                closeModal2();
                hideupdate();
            }

            else if (ahash==="#navchanged") {
                document.location.hash="#";
                getJson('nav','navCallBack',"","");
            }
            else if (ahash==="#updatestarted") {
                document.location.hash="#";
                showupdate();
            }
            else if (ahash.indexOf("#showeditor")!==-1) {  // productshow asks for editor;
                document.location.hash="#";
                rowno=ahash.split("{vbaseseperator}")[1];
                html=ahash.split("{vbaseseperator}")[2];
                html=decodeURIComponent(html);
                psSrc=ahash.split("{vbaseseperator}")[3];

                if (!psSrc.find("http://")) {psSrc=decodeURIComponent(psSrc); }  //;


                adminWrapperRef.moveTo("-5000","-5000"); // move out of the way, hiding doen't work;

                showEditor("edit","producttext",assets_site,rowno,html);
            }
            else if (ahash.indexOf("#setframesize")!==-1) {
                document.location.hash="#";
                atitle=ahash.split("_")[1];
                aw=ahash.split("_")[2];
                ah=ahash.split("_")[3];
                setAdminSize(atitle,aw,ah,ahash.split("_")[3]);
            }

            // poll again;

            if (doPoll) {setTimeout(function(){poll();},500);}
        }
    }


    // ======================================================================	;
    function setAdminSize(title,aw,ah,nodelay) {

        if (atitle!=="nochange") {
            adminWrapperRef.handle.firstChild.nodeValue=atitle;
        }
        $("#adminwrapper").stop();
        if (aw==="max") {
            aw=getModalWidth(true)+35;
            ah=getModalHeight(true);
        }
        else {
            aw=min(aw*1,getModalWidth(true))+35;
            ah=min(ah*1,getModalHeight(true));
        }
        cw=getscrollwidth("adminwrapper");
        ch=getscrollheight("adminwrapper");
        ch=$(".drag-contentarea")[0].offsetHeight;
        dw=(cw-aw)/2;
        dh=(ch-ah)/2;
        setcenter("adminwrapper","screen");

        if (nodelay) { // no delay;
            adminWrapperRef.setSize(aw, ah);
            setcenter("adminwrapper","screen");
        }
        else {
            $("#adminwrapper").stop().animate({left: "+="+dw , top: "+="+dh ,width:aw  },500);
            $(".drag-contentarea").stop().animate({height: ah},500);
        }


    }

    // ======================================================================	;
    function doubleclicked(obj) {
        if (keyIsDown){
            if (mayEdit) {
                if (availablePanes.indexOf(obj.id.substring(0,1).toUpperCase())===-1) {alert('Sorry, this pane cannot be edited');return;}
                edit(obj.id);
            }
        }

    }

    // ======================================================================	;
    function setCookie(c_name,value,expiredays) {
        var exdate=new Date();
        exdate.setDate(exdate.getDate()+expiredays);
        document.cookie=c_name+ "=" +escape(value)+        ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
    }

    // ======================================================================	;
    function getCookie(c_name)
    {

    if (document.cookie.length>0)
      {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
        {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) {c_end=document.cookie.length;}
        return unescape(document.cookie.substring(c_start,c_end));
        }
      }
    return "";
    }

    // ======================================================================	;
    function help() {
      newwin=window.open("http://www.vbaseworks.com?help");
    }

    // ======================================================================	;
    function manageUsers() {
        alert("not yet implemented");
    }

    // ======================================================================	;
    function resetId(atarget) {

    // resets an id of on of the panes to empty, to make sure the page will load the next time;
    // returns (if you need to use it), the original id of atarget;

        var oldid="";
        if (atarget==="top") {oldid=topId;topId=-1;}
        if (atarget==="left") {oldid=leftId;leftId=-1;}
        if (atarget==="right") {oldid=rightId;rightId=-1;}
        if (atarget==="bottom") {oldid=bottomId;bottomId=-1;}
        if (atarget==="content") {oldid=contentId;contentId=-1;}
        if (atarget==="modal") {oldid=contentId;modalId=-1;}
        return oldid;

    }

// ======================================================================	;
function showCart(callerForm,atarget,somerowno) {

    // the cart will always be shown in Modal;

    if ((atarget==="modal2") && (gebi("modal2_holder").style.display!=="block")) {showModal2(false,true);}

    resetId(atarget);


    if (merchant_id==="") {

            val="Order for product: ";
                val=val+gebi("vbproduct_"+somerowno).value+" $ "+gebi("vbprice_"+somerowno).value;

            if (gebi("vbqty_"+somerowno)) {
                val=val+" ("+gebi("vbqtycaption_"+somerowno).value+": "+gebi("vbqty_"+somerowno).value+")";
            }
            val=encodeURIComponent(val+"\n\nPlease add additional information here:\n\n");

            var data=initData();
            extra="";

            if (forceRemote) {extra=extra + "&forceremote=1";}
            data[4]="emailform.asp?site_c=" + site_c +"&body="+val+"&subject=order by email&r="+Math.random();
            data[2]="modal2";
            showNodeCallBack(data);
    }
    else {

        form=callerForm.cloneNode(true);
        gebi(atarget).innerHTML="";
        adiv=document.createElement("div");
        adiv.innerHTML="<iframe name=target_iframe  id=target_iframe onload=hideWait() frameborder=0 style='margin:0px;padding:0px;border-width:0px'></iframe>";

        form.style.display="none";

        gebi(atarget).appendChild(form);
        gebi(atarget).appendChild(adiv);

        // copy selected values from old to the new form;

        selects=callerForm.getElementsByTagName("select");
        newselects=form.getElementsByTagName("select");
        for (var i=0;i< selects.length;i++) {
            newselects[i].value=selects[i].value;
        }

        form.setAttribute("target","target_iframe");

        setIframeSize(atarget,0);
        form.submit();
    }
}


// ======================================================================;
function test_email(emailStr) {
    if (emailStr==="") {return false;}
	emailStr=trim(emailStr);
	var emailPat = /^[a-zA-Z][\w\.\-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.\-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	var matchArray = emailStr.match(emailPat);
	if (matchArray === null) {return false;}
	return true;
}

// ======================================================================;
function email_submit() {

    if (trim(gebi('name').value)==="") {alert('Please enter your name');return;}
    if (!test_email(gebi('email').value)) {alert('Please provide a valid email address');return;}
    if (trim(gebi('name').value)==="") {alert('Please enter a subject');return;}

    if (trim(gebi('message').value)==="") {alert('Please enter your message');return;}
    extra="";
    if (gebi("docc").checked) {extra="&docc=yes";}
    var mes=gebi("message").value;
    //mes=replace(mes,'\n','<br>');
    url="emailform.asp?site_c="+site_c+"&name="+encodeURIComponent(gebi("name").value)+"&email="+gebi("email").value+"&message="+encodeURIComponent(mes)+"&subject="+encodeURIComponent(gebi("subject").value)+extra;
    var data=initData();
    data[2]=piclensTarget;
    data[4]=url; // extern;
    showNodeCallBack(data);
}


// ======================================================================;
function subscribe() {

    xfirstname=trim(gebi('firstname').value);
    xothername=trim(gebi('othername').value);

    xemail=trim(gebi('email').value);
    xemail2=trim(gebi('email2').value);

    if (xfirstname==="") {alert('Please enter your name');return;}
    if (!test_email(xemail)) {alert('Please provide a valid email address');return;}
    if (xemail!==xemail2)  {alert('Please check you email address');return;}


    var extra="";
    if (forceRemote) {extra=extra + "&forceremote=1";}

    url="emaillist.asp?site_c="+site_c+"&firstname="+xfirstname+"&email="+xemail+"&othername="+extra;
    var data=initData();
    data[2]=piclensTarget;
    data[4]=url; // extern;
    showNodeCallBack(data);
}



// ======================================================================;
function faderIn(no,color) {
    if (gebi("fader"+no)) {
        $("#fader"+no).stop().css("opacity","0");
        gebi("fader"+no).style.width="100%";

        gebi("fader"+no).style.height=getscrollheight("document_body");
        gebi("fader"+no).style.display="";
        gebi("fader"+no).style.display="block";

        $("#fader"+no).animate({opacity:0.6},500);
    }
}

// ======================================================================;
function faderOut(no) {

    $("#fader"+no).stop().animate({opacity:0},500,function() {
        gebi("fader"+no).style.display="none";
    });

}


//=======================================================;
function customSearch(obj) {
    if (obj.value!=="") {
        showsearch('modal','searchbuttons');
        gebi('searchinput').value=obj.value;
        setTimeout(function() {gebi('searchsubmit').onclick();},500);
        obj.value="";
    }

}
//=======================================================;
function showModal(maxsize) {
    restoreNode=lastNodeShowed;
    saveScrollTop=gebi("content_scroller").scrollTop;

    $("#modal_holder").stop();
    $("#modal").stop();
    gebi("modal_holder").style.zIndex=1000;

    gebi("modal_holder").style.width=noPy(getStyle("modal_holder","width"))-widthWaste("modal_holder");
    gebi("modal_holder").style.height=getModalHeight()-heightWaste("modal_holder");

    $("#fader1").unbind("click");
    gebi("modal").innerHTML="";
    gebi("modal_holder").style.width=150;
    gebi("modal_holder").style.height=150;

    gebi("closebuttonholder").style.width="100%";
    setcenter("modal_holder","screen");
    gebi("modal").style.display="";

    // backward compatibility in case modal is not styled;

    if ((getStyle("modal_holder","backgroundColor")==="") && (getStyle("modal_holder","backgroundImage")==="")){
        setStyle( "modal_holder","backgroundColor","#ffffff");
        setStyle( "modal_holder","padding","5");
        setStyle( "modal","backgroundColor","#ffffff");
        setStyle( "modal","padding","5");
        setStyle( "modal","textAlign","left");
    }

    showWait("screen");
    faderIn(1,"#000000");
    $("#modal").stop().animate({opacity:1},1);

    cw=getModalWidth(maxsize);
    ch=getModalHeight(maxsize);

    cw=cw-widthWaste("modal_holder");
    ch=ch-heightWaste("modal_holder");

    gebi("modal").style.height=getModalHeight(maxsize)-getHeightStuff("modal_holder")-heightWaste("modal")-22;

    gebi("modal").style.width=getModalWidth(maxsize)-getWidthStuff("modal_holder")-widthWaste("modal");

    gebi("modal_holder").style.width=getModalWidth(maxsize)-widthWaste("modal_holder");
    gebi("modal_holder").style.height=getModalHeight(maxsize)-widthWaste("modal_holder");
    gebi("modal_holder").style.width=150;
    gebi("modal_holder").style.height=150;

    gebi("modal").style.display="none";
    unround("modal");
    unround("modal_holder");

    var newleft=noPy(gebi("modal_holder").style.left)-parseInt(cw/2,10)+75;
    var newtop=noPy(gebi("modal_holder").style.top)-parseInt(ch/2,10)+75;
    $("#modal_holder").animate({width:cw,left:newleft,height:ch,top:newtop},500,function(){

        $("#modal").fadeIn(500,function(){
            $("#modal").css("opacity","");  // otherwise IE will not render selectboxes when scrolling;
            $("#modal").css("filter","");
            initScroller("modal");
            round("modal_holder");
            round("modal");
        hideWait();


        });
    });

}

//=======================================================;
function getModalHeight(maxsize) {

    // return outer height of modal_holder;

    var sh=getStyle("modal_holder","height");
    if (maxsize) {sh="100%";}
    if (sh==="") {sh="400";}
    var ch="";
    if (sh.indexOf("%")!==-1) {ch=parseInt(sh,10)/100*(windowH-50);} else {ch=min(parseInt(sh,10),windowH-50);}
    return ch;

}



//=======================================================;
function getModalWidth(maxsize) {

    // return outer width of modal_holder;

    var sw=getStyle("modal_holder","width");
    if (maxsize) {sw="100%";}
    if (sw==="") {sw="400";}
    var cw="";
    if (sw.indexOf("%")!==-1) {cw=parseInt(sw,10)/100*(windowW-50);} else {cw=min(parseInt(sw,10),windowW-50);}
    return cw;
}

//=======================================================;
function closeModal(fast) {
     gebi("modal").innerHTML="";

    initScroller("modal");

    setStyle("modal","overflow","auto");      // kiko on ie needs hidden;
    gebi("modal").style.overflow="auto";
    if (fast) {
        $("#modal_holder").stop().fadeOut(0);
        gebi("loginpane").style.display="";
        gebi("modal").innerHTML="";
        gebi("modal").style.display="none";

        $("#fader1").stop().css("opacity",0).css("display","none");
    }
    else {
        $("#modal_holder").stop().fadeOut(500);
        gebi("loginpane").style.display="";
        faderOut(1);
        gebi("modal").innerHTML="";
        gebi("modal").style.display="none";

        setNav(restoreNode);
        modalId="";
    }

}



//=======================================================;
function showModal2(maxsize,showCloseButton) {
    if (showCloseButton) {
        gebi("closebuttonholder2").style.display="";
    }
    else {
        gebi("closebuttonholder2").style.display="none";
    }


    restoreNode=lastNodeShowed;
    saveScrollTop=gebi("content_scroller").scrollTop;

    $("#modal2_holder").stop();
    $("#modal2").stop();
    gebi("modal2_holder").style.zIndex=1010;

    gebi("modal2_holder").style.width=noPy(getStyle("modal2_holder","width"))-widthWaste("modal2_holder");
    gebi("modal2_holder").style.height=getModalHeight()-heightWaste("modal2_holder");

    gebi("modal2").innerHTML="";
    gebi("modal2_holder").style.width=150;
    gebi("modal2_holder").style.height=150;

    gebi("closebuttonholder2").style.width="100%";
    setcenter("modal2_holder","screen");
        gebi("modal2").style.display="";

    // backward compatibility in case modal is not styled;

    if ((getStyle("modal2_holder","backgroundColor")==="") && (getStyle("modal2_holder","backgroundImage")==="")){
        setStyle( "modal2_holder","backgroundColor","#ffffff");
        setStyle( "modal2_holder","padding","5");
        setStyle( "modal2","backgroundColor","#ffffff");
        setStyle( "modal2","padding","5");
        setStyle( "modal2","textAlign","left");
    }

    showWait("screen");
    faderIn(2,"#000000");
    $("#modal2").stop().animate({opacity:1},1);

    cw=getModalWidth(maxsize);
    ch=getModalHeight(maxsize);

    cw=cw-widthWaste("modal2_holder");
    ch=ch-heightWaste("modal2_holder");

    gebi("modal2").style.height=getModalHeight(maxsize)-getHeightStuff("modal2_holder")-heightWaste("modal2")-22;

    gebi("modal2").style.width=getModalWidth(maxsize)-getWidthStuff("modal2_holder")-widthWaste("modal2");

    gebi("modal2_holder").style.width=getModalWidth(maxsize)-widthWaste("modal2_holder");
    gebi("modal2_holder").style.height=getModalHeight(maxsize)-widthWaste("modal2_holder");
    //round("modal2_holder");
    gebi("modal2_holder").style.width=150;
    gebi("modal2_holder").style.height=150;

    unround("modal2");
    unround("modal2_holder");

    gebi("modal2").style.display="none";
    var newleft=noPy(gebi("modal2_holder").style.left)-parseInt(cw/2,10)+75;
    var newtop=noPy(gebi("modal2_holder").style.top)-parseInt(ch/2,10)+75;
    $("#modal2_holder").animate({width:cw,left:newleft,height:ch,top:newtop},500,function(){
        $("#modal2").fadeIn(500,function(){
            $("#modal2").css("opacity","");  // otherwise IE will not render selectboxes when scrolling;
            $("#modal2").css("filter","");
            initScroller("modal2");
            round("modal2_holder");
            round("modal2");
        hideWait();


        });
    });

}



//=======================================================;
function closeModal2(fast) {


     gebi("modal2").innerHTML="";

    initScroller("modal2");
    if (gebi("modal2|vbar"))    {gebi("modal2|vbar").style.display="none";}


    setStyle("modal2","overflow","auto");      // kiko on ie needs hidden;
    gebi("modal2").style.overflow="auto";
    gebi("modal2").innerHTML="";
    if (fast) {
        $("#modal2_holder").stop().fadeOut(0);
        gebi("modal2").innerHTML="";
        gebi("modal2").style.display="none";

        $("#fader2").stop().css("opacity",0).css("display","none");

    }
    else {
        $("#modal2_holder").stop().fadeOut(500);
        faderOut(2);
        gebi("modal2").innerHTML="";
        gebi("modal2").style.display="none";
        setNav(restoreNode);
    }

}


//=======================================================;
function checkReturn(evt){
	(evt) ? thekey=evt.keyCode : thekey=event.keyCode;
    return (thekey == 13) ? true : false;
}


//=======================================================;
function setVsize(who,doround) {

    windowH=noPy(getWindowSize("h"));
    windowW=noPy(getWindowSize("w"));

   var oldstate=state;
   state="";


   gebi("document_body").style.height=windowH;
   gebi("document_body").style.width=windowW;

    getDimensions();

    setStyle("right","overflow","");
    setStyle("right","overflowX","");
    setStyle("right","overflowY","");
    setStyle("right","width","");
    setStyle("left","overflow","");
    setStyle("left","overflowX","");
    setStyle("left","overflowY","");
    setStyle("left","width","");


    gebi("body").style.width=bodyWidth-widthWaste("body");
    gebi("body").style.height=bodyHeight-heightWaste("body");

    gebi("page").style.width=pageWidth-widthWaste("page");
    gebi("page").style.height=pageHeight-heightWaste("page");


    setNewHeight("left",textHeight("left"));
    if (left100==="yes") {
        if (textHeight("left")<leftHeight){setNewHeight("left",leftHeight);}
    }
    else {
        //setNewHeight("left",leftHeight);
    }

    setNewHeight("right",textHeight("right"));
    if (right100==="yes") {
        if (textHeight("right")<rightHeight){setNewHeight("right",rightHeight);}
    }
    else {
        //setNewHeight("right",rightHeight);
    }

    setNewHeight("left_scroller",leftHeight);
    setNewHeight("right_scroller",rightHeight);

    if (getStyle("right_scroller","overflowY")==="") {setStyle("right_scroller","overflowY","auto");}
    if (getStyle("left_scroller","overflowY")==="")  {setStyle("left_scroller","overflowY","auto");}

    setNewHeight("content",max(contentHeight,textHeight("content")));
    setNewHeight("content_scroller",contentScrollerHeight);
    setNewHeight("content_outer",middleHeight);

    setNewHeight("top",topHeight);
    setNewHeight("bottom",bottomHeight);
    gebi("content_scroller").style.width=contentScrollerWidth-widthWaste("content_scroller");
    //gebi("content").style.width=contentScrollerWidth-getWidthStuff("content_scroller")-widthWaste("content");

    gebi("top").style.width=topWidth-widthWaste("top");

    gebi("bottom").style.width=topWidth-widthWaste("bottom");

    for (var i=1;i<11;i++) {
        if (getStyle("aux"+i,"width")!=="")  {gebi("aux"+i).style.width=noPy(getStyle("aux"+i,"width"))-widthWaste("aux"+i);}
        if (getStyle("aux"+i,"height")!=="") {gebi("aux"+i).style.height=noPy(getStyle("aux"+i,"height"))-heightWaste("aux"+i);}

    }
    

    for (var i=1;i<11;i++) {
        if (getStyle("aux"+i,"width")!=="") {
            gebi("aux"+i).style.width=noPy(getStyle("aux"+i,"width"))-widthWaste("aux"+i);
        }                    
        if (getStyle("aux"+i,"height")!=="") {
            gebi("aux"+i).style.height=noPy(getStyle("aux"+i,"height"))-heightWaste("aux"+i);
        }                    
    }
    $(".adminbutton").each(function() {
        if (getStyle("adminbutton","width")!=="") {
            this.style.width=noPy(getStyle("adminbutton","width"))-widthWaste("adminbutton");
        }                    
        if (getStyle("adminbutton","height")!=="") {
            this.style.height=noPy(getStyle("adminbutton","height"))-heightWaste("adminbutton");
        }                    
    
        
    });
    
    


    window.onresize=windowresize;

    if (doround) {
    
        floatBox('navdragger',true);
        floatBox('vbaselink',gebi("vbaselink").isFloat);
        floatBox('searchspan',gebi("searchspan").isFloat);
        floatBox('toolbox',gebi("toolbox").isFloat);

        for (var i=1;i<11;i++) {
            floatBox('aux'+i,true);
            gebi('aux'+i).style.display="";

        }
    
        round("top");
        round("left");
        round("right");
        round("content_outer");
        round("content_scroller");
        round("content");
        round("body");
        round("page");

    }

    initScrollers();

    state=oldstate;
}

//=======================================================;
function positionOnAnchor(objId) {
    var obj=gebi(objId);
    if (!obj.isFloat) {return;}
    var anchor=obj.anchor;
    
    if (hasDragDrop) {    
        dd.elements[objId].moveTo(0,0);
    }
    else {
        obj.style.left=0;
        obj.style.top=0;
    }
    if (!anchor) {anchor="left";}
    var anchorX=obj.anchorX;
    var anchorY=obj.anchorY;
    if (anchor==="left") {
        var newX=anchorX+findPosX(gebi("page"));
        var newY=anchorY+findPosY(gebi("page"));
    }
    if (anchor==="right") {
        var newX=findPosX(gebi("page"))+getscrollwidth("page")-anchorX-getscrollwidth(objId);
        var newY=anchorY+findPosY(gebi("page"));
    }
    if (anchor==="leftbottom") {
        var newX=anchorX+findPosX(gebi("page"));
        var newY=findPosY(gebi("page"))+getscrollheight("page")-anchorY-getscrollheight(objId);
    }
    if (anchor==="rightbottom") {
        var newX=findPosX(gebi("page"))+getscrollwidth("page")-anchorX-getscrollwidth(objId);
        var newY=findPosY(gebi("page"))+getscrollheight("page")-anchorY-getscrollheight(objId);
    }

    if (hasDragDrop) {    
        dd.elements[objId].moveTo(newX,newY);
    }
    else {
        obj.style.left=newX;
        obj.style.top=newY;
    }

}

//=======================================================;
function getDimensions(limit) {


    /* returns the outer width and heights of the following. (add Width an Height to get variable names);
        body;
        page;
        content;
        contentScroller;
        contentOuter;
        top;
        bottom;
        left;
        right;
        leftScroller;
        rightScroller;
        leftText;
        rightText;
    */

    topHeight=noPy(getStyle("top_holder","height"));
    bottomHeight=noPy(getStyle("bottom_holder","height"));

    gebi("content_scroller").style.overflow="";  //remove style, could have been set with shoform();
    gebi("content").style.height="";
    gebi("content").style.height="";
    setStyle("content","height","");


    var topH=gebi("top_holder").offsetHeight;
    var bottomH=gebi("bottom_holder").offsetHeight;

    var margins=       gebi("top1_spacer").offsetHeight+topH+gebi("top2_spacer").offsetHeight;
    margins=margins+gebi("bottom1_spacer").offsetHeight+bottomH+gebi("bottom2_spacer").offsetHeight;

    if ((!haveScrollbar) && (!limit)) {
        bodyHeight=gebi("content").offsetHeight+getHeightStuff("content_scroller")+getHeightStuff("content_outer")+margins+getHeightStuff("body")+getHeightStuff("page");

        if ($("#content #extif").length>0) {
                    bodyHeight=gebi("content").offsetHeight+400+getHeightStuff("content_scroller")+getHeightStuff("content_outer")+margins+getHeightStuff("body")+getHeightStuff("page");
        }
        var L=textHeight("left")+margins+getHeightStuff("body")+getHeightStuff("page");
        var R=textHeight("right")+margins+getHeightStuff("body")+getHeightStuff("page");
        if (isSwapped("left"))  {L=L-margins;}
        if (isSwapped("right")) {R=R-margins;}

        bodyHeight=max(L,bodyHeight);
        bodyHeight=max(R,bodyHeight);
        bodyHeight=max(bodyHeight,windowH);
    }
    else { // limited to the visible window size;

        bodyHeight=windowH;
    }

    bodyWidth=windowW;

    fullPageWidth=windowW-widthWaste("body");
    pageWidth=getStyle("page","width");
    if (pageWidth==="") {pageWidth="100%";}

    if (pageWidth.indexOf("%")!==-1) {
        p=parseInt(pageWidth,10);
        pageWidth=fullPageWidth*p/100;
    }
    else {
        pageWidth=parseInt(pageWidth,10);
    }

    pageHeight=bodyHeight-getHeightStuff("body");

    middleHeight=pageHeight-margins-getHeightStuff("page");
    contentScrollerHeight=middleHeight-getHeightStuff("content_outer");
    contentHeight=contentScrollerHeight-getHeightStuff("content_scroller");

    var margins=parseInt(gebi("top1_spacer").offsetHeight,10);
    margins=margins+parseInt(gebi("bottom2_spacer").offsetHeight,10);

    //report("left");

    leftmax=middleHeight;
    rightmax=middleHeight;
    if (isSwapped("left")) {leftmax=pageHeight-margins-getHeightStuff("page");}
    if (isSwapped("right")) {rightmax=pageHeight-margins-getHeightStuff("page");}

    if (left100==="yes") {
        leftHeight=leftmax;
    }
    else {
        leftHeight=min(textHeight("left"),leftmax);
    }

    if (right100==="yes") {
        rightHeight=rightmax;
    }
    else {
        rightHeight=min(textHeight("right"),rightmax);
    }

    topWidth=pageWidth-getWidthStuff("page")-noPy(getStyleNH("pageleft_spacer","width"))-noPy(getStyleNH("pageright_spacer","width"));

    var w=noPy(getStyle("page","width"));
    var w=pageWidth;
    var x=getStyleNH("left1_spacer","width")+getStyleNH("left_holder","width")+getStyleNH("left2_spacer","width")+max(getscrollwidth("pageleft_spacer"),getStyleNH("pageleft_spacer","width"));
    x=x+getStyleNH("right1_spacer","width")+getStyleNH("right_holder","width")+getStyleNH("right2_spacer","width")+max(getscrollwidth("pageright_spacer"),getStyleNH("pageright_spacer","width"));

    var w=w-x;
    contentScrollerWidth=w-getWidthStuff("page")-getWidthStuff("content_outer");

    }







//=======================================================;
function deleteStyleText(astyle) {

    var mysheet=document.styleSheets[1];
    var myrules=mysheet.cssRules? mysheet.cssRules: mysheet.rules;
    mysheet.crossdelete=mysheet.deleteRule? mysheet.deleteRule : mysheet.removeRule;
    for (var i=0; i<myrules.length; i++){
        if(myrules[i].selectorText.toLowerCase()===astyle.toLowerCase()){
            mysheet.crossdelete(i);
            i--; //decrement i by 1, since deleting a rule collapses the array by 1;
        }
    }

}


//=======================================================;
function round(classname) {
    unround(classname);
    newround2(classname);
}

var rcounter=0;
//=======================================================;
function newround2(classname,generate) {

    //alert("newround: "+classname);
    var destroyed=false;
    for (var i=0;i< theRules.length;i++) {
        var selector=theRules[i].selectorText.toLowerCase().substr(1);

        if ((selector===classname) || (selector===classname+"_hover") ||(selector===classname+"_clicked" )|| (!classname) || (classname==="")) {
        if (!selector.find("rounded_")) {

        if ((!classname) || (classname.find("sublink")) || (classname.find("chapter")) ) {
            if ($(gebi("navholder")).accordion()) {
                $(gebi("navholder")).accordion("destroy");jQuery(".sublink_container").show();
                destroyed=true;
            }
        }

        //if (((selector.indexOf(what)!==-1) && (what!=="")) || ((what==="") && (selector.indexOf("_clicked")===-1) && (selector.indexOf("_hover")===-1)))  {
        var nostate=replace(replace(selector,"_hover",""),"_clicked","");
        var baseStyle=nostate;
        if (nostate.indexOf("linkright_")!==-1) {baseStyle="linkright";}
        if (nostate.indexOf("linkleft_")!==-1) {baseStyle="linkleft";}
        if (nostate.indexOf("linktop_")!==-1) {baseStyle="linktop";}
        if (nostate.indexOf("linkbottom_")!==-1) {baseStyle="linkbottom";}
        if (nostate.indexOf("linkcontent_")!==-1) {baseStyle="linkcontent";}

        if (nostate.indexOf("imageright_")!==-1) {baseStyle="imageright";}
        if (nostate.indexOf("imageleft_")!==-1) {baseStyle="imageleft";}
        if (nostate.indexOf("imagetop_")!==-1) {baseStyle="imagetop";}
        if (nostate.indexOf("imagebottom_")!==-1) {baseStyle="imagebottom";}
        if (nostate.indexOf("imagecontent_")!==-1) {baseStyle="imagecontent";}

        for (var i2=1;i2<11;i2++) {
            if (nostate.find("aux"+i2)) {baseStyle="aux"+i2;}
        }
        //if (nostate.indexOf("vglider_")!==-1) {baseStyle="vglider"}
        //if (nostate.indexOf("vbar_")!==-1) {baseStyle="vbar"}
        if (rounding[baseStyle]) {

            var anindex=false;
            //if (baseStyle===nostate) {anindex=i}

            var r=rounding[baseStyle];
            var ashadow=0;
            var asize=16;
            var doit=false;
            var id=this.id;
            var ds="";  //drop shadow;
            var cutoffbottom=0;  // cut's the bottom of a shadow.;
            var cutoffright=0;  // cut's the bottom of a shadow.;
            var symetric=0;  // top to bottom shading;
            var filetype="jpg";


            if (r.indexOf("big")!==-1)    {asize=32;r=replace(r,"big","");}
            if (r.indexOf("small")!==-1)  {asize=8;r=replace(r,"small","");}
            if (r.indexOf("shadow")!==-1) {doit=true;ds=2;r=replace(r,"shadow","");}
            if (r.indexOf("cutoffright")!==-1) {doit=true;cutoffright=1;r=replace(r,"cutoffright","");}
            if (r.indexOf("cutoffbottom")!==-1) {doit=true;cutoffbottom=1;r=replace(r,"cutoffbottom","");}
            if (r.indexOf("png")!==-1) {filetype="png";r=replace(r,"png","");}
            if (r.indexOf("sym")!==-1) {symetric="1";r=replace(r,"sym","");}

            r=replace(r,"normal","");
            r=replace(r,"cutoff","");

            if (selector.find("_hover")) {
                if (getcolor("efgc_hover",r,baseStyle)!=="") {doit=true;}
                var efgc=getcolor("efgc_hover",rounding[baseStyle],baseStyle);
                var bgc=getcolor("bgc_hover",rounding[baseStyle],baseStyle);
            }
            else if (selector.find("_clicked")) {
                if (getcolor("efgc_clicked",r,baseStyle)!=="") {doit=true;}
                var efgc=getcolor("efgc_clicked",rounding[baseStyle],baseStyle);
                var bgc=getcolor("bgc_clicked",rounding[baseStyle],baseStyle);
            }
            else {
                if (getcolor("efgc",r,baseStyle)!=="") {doit=true;}
                var efgc=getcolor("efgc",rounding[baseStyle],baseStyle);
                var bgc=getcolor("bgc",rounding[baseStyle],baseStyle);
            }
            r=deletecolor("eh",r); // extra height;
            r=deletecolor("efgc",r);
            r=deletecolor("bgc",r);
            r=deletecolor("efgc",r);
            r=deletecolor("bgc_hover",r);
            r=deletecolor("bgc_clicked",r);

            r=deletecolor("efgc_hover",r);
            r=deletecolor("efgc_clicked",r);

            r=deletecolor("fgc_clicked",r);

            r=replace(r," ","");
                    //if (baseStyle==="link") {alert(selector+" "+baseStyle+" "+doit);}

            if (r!=="") {doit=true;}
            if ((doit)) {
                var borderwidth=noPy(getStyle(nostate,"borderTopWidth",true,anindex));

                if (bgc==="") {
                    if (selector==="page") {
                        var bgc=bodyColor;
                    }
                    else {
                        var bgc=pageColor;
                    }
                }
                bgc=replace(bgc,"#","");
                var fgc=getStyle(selector,"backgroundColor",true,anindex);
                if (fgc.indexOf("rgb")!==-1) {fgc=rgb2hex(fgc).substr(1);} else {fgc=fgc.substr(1);}

                bordercolor="";
                //if (borderwidth>0) {
                    var bordercolor=getStyle(selector,"borderTopColor",true,anindex);
                    if (trim(bordercolor)==="-moz-use-text-color") {bordercolor=getStyle(selector,"color",true,anindex);}
                    if (trim(bordercolor)==="") {bordercolor=getStyle(selector,"color",true,anindex);}
                    if (bordercolor.indexOf("rgb")!==-1) {bordercolor=rgb2hex(bordercolor).substr(1);} else {bordercolor=bordercolor.substr(1);}
                //}
                anindex=false;
                //setStyle(selector,"backgroundColor","",true);
                var borders="";
                if (noPy(getStyle(nostate,"borderTopWidth",true,anindex))>0){borders +='t';}
                if (noPy(getStyle(nostate,"borderLeftWidth",true,anindex))>0){borders +='l';}
                if (noPy(getStyle(nostate,"borderRightWidth",true,anindex))>0){borders +='r';}
                if (noPy(getStyle(nostate,"borderBottomWidth",true,anindex))>0){borders +='b';}

                var bt=noPy(getStyle(nostate,"borderTopWidth",true,anindex));
                var bb=noPy(getStyle(nostate,"borderBottomWidth",true,anindex));
                var bl=noPy(getStyle(nostate,"borderLeftWidth",true,anindex));
                var br=noPy(getStyle(nostate,"borderRightWidth",true,anindex));
                if (getStyle(nostate,"borderTopStyle",true,anindex)==="none") {bt=0;}
                if (getStyle(nostate,"borderLeftStyle",true,anindex)==="none") {bl=0;}
                if (getStyle(nostate,"borderRightStyle",true,anindex)==="none") {br=0;}
                if (getStyle(nostate,"borderBottomStyle",true,anindex)==="none") {bb=0;}

                var alist=$("."+nostate);
                for (var i3=0;i3<alist.length;i3++) {

                    rcounter++;
                    var obj=alist[i3];


                    if ((obj)) {
                    var oldstate=state;
                    state="";
                    //obj.newstylename="";
                    var h=noPy(obj.style.height);
                    var w=noPy(obj.style.width);
                    var fixedSize=false;

                    if ((getStyle(baseStyle,"width")!=="") && (getStyle(baseStyle,"height")!=="")) {fixedSize=true;}

                    //if  ((h!==0)  && (w!==0)) {fixedSize=true}

                    if (h===0) {
                        h=obj.offsetHeight;
                    }
                    else {
                        h=h+heightWaste(baseStyle);
                    }
                    if (w===0) {
                        w=obj.offsetWidth;
                    }
                    else {
                        w=w+widthWaste(baseStyle);
                    }

                    //if (baseStyle==="adminbutton") {alert(w+" "+h);}


                    if (ds!==""){
                        if (!cutoffbottom) {h=h-5;}
                        if (!cutoffright) {w=w-5;}
                    }
                    if ((ds==="") && (borders==="") && ((r==="") || (r.find("efgc")) )) {
                        w=1;
                        filetype="jpg";
                        repeat="repeat-x";
                    }
                    else {
                        repeat="no-repeat";
                    }
                    //if ((w===1) && (h===1)) {alert(baseStyle)}

                    var rparameters="corners="+r+"&borders="+borders+"&borderwidth="+borderwidth;
                    rparameters=rparameters+"&ds="+ds+"&radius="+asize+"&w="+w+"&h="+h+"&bgc="+bgc+"&fgc="+fgc+"&bordercolor="+bordercolor;
                    rparameters=rparameters+"&cutoffright="+cutoffright+"&cutoffbottom="+cutoffbottom+"&efgc="+efgc+"&f="+filetype+"&symetric="+symetric;
                    
                    rmd5=hex_md5(rparameters);

                    if (selector.find("_hover")) {
                        newname="rounded_"+baseStyle+"_hover_"+rmd5;
                        obj.roundinghover=newname;
                        $(obj).unbind('mouseenter mouseleave');
                        $(obj).hover(function(){$(this).addClass($(this)[0].roundinghover);},function(){$(this).removeClass($(this)[0].roundinghover);});
                    }
                    else if (selector.find("_clicked")) {
                        newname="rounded"+baseStyle+"_clicked_"+rmd5;
                        obj.roundingclicked=newname;

                        $(obj).click(function(){
                            if (this.id.find("aux")) {removeAuxClickedStates("round");}
                            $(this).addClass($(this)[0].roundingclicked);
                        });
                        if (obj.clicked) {
                            $(obj).addClass(obj.roundingclicked);
                            obj.clicked=false;
                        }
                    }
                    else {
                        newname="rounded_"+baseStyle+"_normal_"+rmd5;
                        obj.roundingnormal=newname;
                        //$(obj).addClass(newname);
                        obj.newstylename=newname;
                        

                    }
                    setStyle(newname,"backgroundColor","transparent",true);  // this does not work for border;

                    state=oldstate;

                    setStyle(newname,"backgroundRepeat",repeat,true,anindex);
                    setStyle(newname,"borderTopWidth","0px",true,anindex);
                    setStyle(newname,"borderLeftWidth","0px",true,anindex);
                    setStyle(newname,"borderRightWidth","0px",true,anindex);
                    setStyle(newname,"borderBottomWidth","0px",true,anindex);
                    setStyle(newname,"paddingTop",noPy(getStyle(nostate,"paddingTop",true,anindex))+bt,true,anindex);
                    setStyle(newname,"paddingLeft",noPy(getStyle(nostate,"paddingLeft",true,anindex))+bl,true,anindex);
                    setStyle(newname,"paddingRight",noPy(getStyle(nostate,"paddingRight",true,anindex))+br,true,anindex);
                    setStyle(newname,"paddingBottom",noPy(getStyle(nostate,"paddingBottom",true,anindex))+bb,true,anindex);


                    var src=vbasepath+"rounded.php?"+rparameters;


                    outfile=rmd5+"."+filetype;

                    var prgrm=vbasepath+"create_assets.asp?site_c="+site_c+"&infile="+encodeURIComponent(src+"&nocache=1")+"&outfile="+encodeURIComponent(outfile);
                    var newsrc=vbaseroot+"uploadfolder/"+site_c+"/assets/"+outfile;

                    if ((generate) && (fixedSize) && (w>0) && (h>0))  {

                        $.ajax({
                          type: "GET",
                          url: prgrm,
                          async: false
                        });


                        //$.get(prgrm);
                    }
                    if (useAssets && fixedSize) {
                        var imagesrc=newsrc;
                     }
                     else {
                        var imagesrc=src;

                    }
                    
                    setStyle(newname,"backgroundImage","url(\""+imagesrc+"\")",true,anindex);
                    if ((selector.find("_hover")) || (selector.find("_clicked"))) {
                        preload(imagesrc);
                    }
                    else {
                        var img=new Image();
                        img.onload=function(obj) {
                            return function() {$(obj).addClass(obj.newstylename);};
                        }(obj);
                        img.src=imagesrc;
                    
                    }
                    
                    a=setTimeout(function(obj,img) {
                        return function() {
                            if (imageLoaded(img)) {$(obj).addClass(obj.newstylename);}
                        
                        };
                    }(obj,img),100);
                    
                }

            }

            }
            }


        }
        }
    }
        if (destroyed) {reaccordion();}

}

//=======================================================;
function imageLoaded(img) {

    if (!img.complete) {
        return false; // firefox is always complete
    }
    if (typeof img.naturalWidth!= 'undefined' && img.naturalWidth== 0) {
        return false;
    }
    return true;
}

//=======================================================;
function unround(target) {

    // target=classname. not states required.;
    // here we delete from the stylesheet the classes rounded_ (definded by obj.roundingnormal, obj.roundinghover) etc;
    // and remove all these references from the obj.className;


    var alist=[];
    if ((!target) || (target==="")) {
        alist=jQuery("[class*=rounded_]");
    }
    else {
        alist=jQuery("."+target);
    }
    for (var i=0;i<alist.length;i++) {
        var obj=alist[i];

        if (obj.roundingnormal) {jQuery(obj).removeClass(obj.roundingnormal);}
        if (obj.roundinghover) {jQuery(obj).removeClass(obj.roundinghover);}
        if (obj.className.find("rounded_clicked")) {obj.clicked=true;}
        if (obj.roundingclicked) {jQuery(obj).removeClass(obj.roundingclicked);}

        aselector=obj.roundingnormal;
        var borders=getbackroundImageProp(aselector,"borders");
        var borderwidth=noPy(getbackroundImageProp(aselector,"borderwidth"));
        var bordercolor="#"+getbackroundImageProp(aselector,"bordercolor");

        //if (target==="aux2") {alert(borderwidth);}

        if (trim(bordercolor)==="-moz-use-text-color") {bordercolor=getStyle(aselector,"color",true,anindex);}
        if (bordercolor.indexOf("rgb")!==-1) {bordercolor=rgb2hex(bordercolor);} else {bordercolor=bordercolor;}
    

        if (borders.indexOf("t")!==-1) {setStyle(target,"borderTop",   borderwidth+"px solid "+bordercolor,true);setStyle(target,"paddingTop",noPy(getStyle(aselector,"paddingTop",true))-borderwidth,true);}
        if (borders.indexOf("l")!==-1) {setStyle(target,"borderLeft",  borderwidth+"px solid "+bordercolor,true);setStyle(target,"paddingLeft",noPy(getStyle(aselector,"paddingLeft",true))-borderwidth,true);}
        if (borders.indexOf("r")!==-1) {setStyle(target,"borderRight", borderwidth+"px solid "+bordercolor,true);setStyle(target,"paddingRight",noPy(getStyle(aselector,"paddingRight"),true)-borderwidth,true);}
        if (borders.indexOf("b")!==-1) {setStyle(target,"borderBottom",borderwidth+"px solid "+bordercolor,true);setStyle(target,"paddingBottom",noPy(getStyle(aselector,"paddingBottom"),true)-borderwidth,true);}

        deleteStyleText("."+obj.roundingnormal);
        deleteStyleText("."+obj.roundinghover);
        deleteStyleText("."+obj.roundingclicked);



    }

}




var imgArray=[];
var imgArrayCounter=0;

//=======================================================;
function preload(src) {

    // use to store rollovers;

    for (var i=0;i< imgArray.length;i++) {
        if (imgArray[i].src===src) {return;}
    }
    imgArray[imgArrayCounter]=new Image();
    imgArray[imgArrayCounter].src=src;
    imgArrayCounter++;

}


//=======================================================;
function getParentBk(x,stylename){
    var el=x.parentNode,c;
        stylename=el.className;

    while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el,stylename))=="transparent"){
        el=el.parentNode;
        stylename=el.className;
    }
    if(c=="transparent") {c="#FFFFFF";}
        return(c);
}


//=======================================================;
function getBk(x,stylename){
    if (getStyle(stylename,"backgroundImage",true).indexOf("rounded.php")!==-1) {
         c="#"+getbackroundImageProp(stylename,"fgc",true);
    }
    else {
        var c=getStyleProp(x,"backgroundColor");

    }

    if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))
        return("transparent");
    if(c.find("rgb")) {c=rgb2hex(c);}
    return(c);
}


// ======================================================================	;
function addOption(selectbox,text,value) {
    var optn = document.createElement("OPTION");
    optn.text = text;
    optn.value = value;
    selectbox.options.add(optn);
}

function initScrollers() {
    initScroller("right_scroller");
    initScroller("content_scroller");
    initScroller("left_scroller");
    initScroller("modal");
    initScroller("modal2");
    initScroller("document_body");
}

// ======================================================================	;
    function initScroller(divId) {

        if ((!hasScrollBar(gebi(divId))) || (!styleScrollbars)) {
            if (gebi("vglider_"+divId)) {gebi("vglider_"+divId).style.display="none";}
            if (gebi("vbar_"+divId)) {gebi("vbar_"+divId).style.display="none";}
            return;
        }

        adiv=gebi(divId);
        gebi(divId).scrollTop=0;
        adiv.onscroll=function() {setGlider(divId);};

        if (!gebi("vbar_"+divId)) {
            abar=document.createElement("div");
            abar.className="vbar_"+divId+" "+"dragme";
            abar.style.position="absolute";
            abar.style.overflow="hidden";
            abar.id="vbar_"+divId;
            if (divId==="document_body") {
                document.body.appendChild(abar);
            }
            else {
                document.body.appendChild(abar);
            }
        }
        else {
            abar=gebi("vbar_"+divId);
        }
        newstylename="vbar_"+divId;

        var eh=getcolor("eh",rounding["vbar_"+divId],"vbar_"+divId); // extra height. needed if rounded to cover the scrollbar;
        if (eh==="") {eh=0;}

        abar.style.height=gebi(divId).offsetHeight-heightWaste("vbar_"+divId)+eh*2;

        awidth=getStyle("vbar_"+divId,"width");
        if (awidth==="") {awidth=16;}
        setStyle("vbar_"+divId,"width",awidth);
        abar.style.width=noPy(awidth)-widthWaste("vbar_"+divId);

        abar.style.display="";
        abar.onclick=function(event) {getMouse(event);scrollClick(divId);};

        abar.style.zIndex=9;
        if (divId==="modal") {abar.style.zIndex=1001;}
        if (divId==="modal2") {abar.style.zIndex=1002;}

        var newGlider=false;
        if (!gebi("vglider_"+divId)) {
            newGlider=true;
            aglider=document.createElement("div");
            aglider.className="vglider_"+divId+" "+"dragme";
            aglider.style.position="absolute";
            aglider.style.overflow="hidden";

            aglider.id="vglider_"+divId;
            if (divId==="document_body") {
                document.body.appendChild(aglider);
            }
            else {
                document.body.appendChild(aglider);
            }
        }
        else {
            aglider=gebi("vglider_"+divId);
        }

        newstylename="vglider_"+divId;

        aglider.style.zIndex=10;
        aglider.style.position="absolute";
        aglider.style.display="";

        awidth=getStyle("vglider_"+divId,"width");
        if (awidth==="") {awidth=16;}
        setStyle("glider_"+divId,"width",awidth);
        aglider.style.width=noPy(awidth)-widthWaste("vglider_"+divId);

        if (divId==="modal") {aglider.style.zIndex=1002;}
        if (divId==="modal2") {aglider.style.zIndex=1012;}

        y=findPosY(adiv);
        x=findPosX(adiv)+adiv.offsetWidth-16;

        abar.style.left=x;
        abar.style.top=y-eh;
        aglider.style.left=x;
        aglider.style.top=y-eh;

        //if (newGlider) {ADD_DHTML("vglider_"+divId+RESET_Z+VERTICAL);        }

        //x if (divId==="modal") {dd.elements["vglider_modal"].defz=1002;}
        //x if (divId==="modal2") {dd.elements["vglider_modal2"].defz=1012;}
        if (divId==="modal") {gebi("vglider_modal").style.zIndex=1002;}
        if (divId==="modal2") {gebi("vglider_modal2").style.zIndex=1012;}

        //x dd.elements["vglider_"+divId].maxofft=0;
        //x dd.elements["vglider_"+divId].moveTo(x,y-eh);
        range=y+noPy(abar.style.height);
        //x dd.elements["vglider_"+divId].maxoffb=range;


        aglider.onmouseover=function(){dragmode='vertical';};
        aglider.onmouseout=function(){dragmode='';};
        abar.onmouseover=function(){dragmode='vertical';};
        abar.onmouseout=function(){dragmode='';};
        
        aglider.limitTop=y;
        aglider.limitBottom=range;


        round("vbar_"+divId);
        round("vglider_"+divId);

    }

// ======================================================================	;
function scroll(aname) {
    //;
    // called when a glider is dragged;
    adiv=gebi(replace(aname,"vglider_",""));
    aglider=gebi(aname);
    if (gebi("vbar_"+replace(aname,"vglider_",""))) {
        abar=gebi("vbar_"+replace(aname,"vglider_",""));
        range=abar.offsetHeight-aglider.offsetHeight;

        fraction=(findPosY(aglider)-findPosY(abar))/range;
        //x fraction=(dd.elements[aname].y-findPosY(abar))/range;
        // how much is there to scroll in amount of pixels;
        toscroll=adiv.scrollHeight-adiv.offsetHeight;
        adiv.scrollTop=toscroll*fraction;


    }

}

// ======================================================================	;
function scrollClick(aname) {

    // called when clicked on a bar;

    adiv=gebi(aname);
    aglider=gebi("vglider_"+aname);
    abar=gebi("vbar_"+aname);

    fraction=(posy-findPosY(abar))/abar.offsetHeight;
    toscroll=adiv.scrollHeight-adiv.offsetHeight;
    $(adiv).stop().animate({scrollTop:toscroll*fraction},500);

}

// ======================================================================	;
function setGlider(aname) {
    // called when sccrolling (with mousewheel for example, to synchronize the glider;
    if (dragobject!=="") {return;}
    adiv=gebi(aname);
    aglider=gebi("vglider_"+aname);
    abar=gebi("vbar_"+aname);

    toscroll=adiv.scrollHeight-adiv.offsetHeight;
    fraction=adiv.scrollTop/toscroll;
    range=abar.offsetHeight-aglider.offsetHeight;

    newy=range*fraction+findPosY(abar);
    aglider.style.top=newy;
    //x dd.elements["vglider_"+aname].moveTo(dd.elements["vglider_"+aname].x,newy);


}


var posx;var posy;
// ======================================================================	;
function getMouse(e){
    posx=0;posy=0;
    var ev=(!e)?window.event:e;//IE:Moz;
    if (ev.pageX){//Moz;
        posx=ev.pageX+window.pageXOffset;
        posy=ev.pageY+window.pageYOffset;
    }
    else if(ev.clientX){//IE;
        posx=ev.clientX+document.body.scrollLeft;
        posy=ev.clientY+document.body.scrollTop;
    }
    else{return false;}//old browsers;
}


// ======================================================================	;
function getcolor(which,roundstring,debugId) {
    var astring=" "+replace(roundstring,"  "," ")+" ";
    ipos=astring.indexOf(" "+which+"=");
    if (ipos===-1) {return "";}
    astring=astring.substr(ipos+which.length+1);
    ipos2=astring.indexOf(" ");
    astring=astring.substr(1,ipos2);
    return trim(astring);
}
// ======================================================================	;
function deletecolor(which,roundstring) {
    var astring=" "+replace(roundstring,"  "," ")+" ";
    acolor=getcolor(which,astring,"delete");
    roundstring=replace(astring," "+which+"="+acolor,"");
    return trim(roundstring);
}


// ======================================================================	;
function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1)
        {
          curleft += obj.offsetLeft+getLeftWidthStuff(obj.className);
          if(!obj.offsetParent) break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }


// ======================================================================	;
  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop+getTopHeightStuff(obj.className);
          if(!obj.offsetParent)break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

    //=======================================================;
    function showtime(aprompt) {
        now=new Date();
        log(aprompt + ": " + (now-timer));
        timer=new Date();

    }

    //=============================================================;
    function picLensCallback(data) {
        if ((piclensTarget!=="modal") && (piclensTarget!=="modal2")) {
                $("#"+piclensTarget).stop();
        }
        if ((piclensTarget==="modal") && (gebi("modal_holder").style.display!=="block")) {showModal(false);}
        if ((piclensTarget==="modal2") && (gebi("modal2_holder").style.display!=="block")) {showModal2(false,true);}
        gebi(piclensTarget).innerHTML=data;

        roundstuff(piclensTarget);
        linkstuff(piclensTarget);
        //round();
        setContentHeight(piclensTarget);
        $("#"+piclensTarget+" img").css("opacity","0");

        $("#"+piclensTarget).animate({opacity:1},500,function(){
            fixIEBlur(); $("#"+piclensTarget+" img").animate({opacity:1},500);
            round("productbackground");
            round("productheader");
            round("productholder");
            round("productpicture");
            round("producttext");
        });
        setIframeSize(piclensTarget,0);
        if (piclensTarget==="content") {initScroller("content_scroller");}
        if (piclensTarget==="left") {initScroller("left_scroller");}
        if (piclensTarget==="right") {initScroller("right_scroller");}
        if (piclensTarget==="modal") {initScroller("modal");}
        if (piclensTarget==="modal2") {initScroller("modal2");}
        initScroller("document_body");
        $(".popper").hover(function () {showPop(this.getAttribute('helptext'));},function () {killPop();});
        hideWait();

    }

// ====================================================================================================;
// guestbook;
// ====================================================================================================;

 function gbedit(id) {
    faderIn(2);
    setcenter("editdiv","screen",true);
    gebi("editdiv").style.display="inline-block";
    text=gebi("content_"+id).innerHTML;
    text=replace(text,"<br>","\n");
    gebi("editta").value=text;
    if (gebi("gbsubject")) {
        text=gebi("subject_"+id).innerHTML;
        text=replace(text,"<br>","\n");
        gebi("editsubject").value=text;

    }
    gebi("gbupdatebutton").onclick=function() {gbupdate(id);};

 }

//=============================================================;
function gbupdate(id) {

    text=gebi("editta").value;
    text=replace(text,"\n","<br>");
    gebi("editdiv").style.display="none";
    gebi("action").value="update";
    gebi("gbid").value=id;
    gebi("text").value=text;
    gebi("content_"+id).innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' />   "+text;
    faderOut(2);

    text=gebi("editsubject").value;
    text=replace(text,"\n","<br>");
    gebi("subject").value=text;

    document.gbform.submit();

 }


//=============================================================;
function gbchanged() { // called by childwindow!;
    x=window.parent.gebi("gbform");
    x.parentNode.removeChild(x);
    x=null;
    gebi("action").value="";
    window.parent.gebi("gbcontent").innerHTML=gebi("gbcontent").innerHTML;
    window.parent.initPopper();
    $(window.parent.gebi("gbcontent")).fadeIn(500);
    window.parent.gebi("gbwait").style.display="none";

}

//=============================================================;
function initPopper() {
    $(".popper").hover(function () {showPop(this.getAttribute('helptext'));},function () {killPop();});
}

//=============================================================;
function gbdelete(id,remark_id) {

    if (remark_id) {
        aprompt="delete this entry?";
    }
    else {
        aprompt="delete this entry?\nNote: all comments on this topic will be deleted as well!";
    }
    if (confirm(aprompt)){
        gebi("action").value="delete";
        gebi("gbid").value=id;
        gebi("content_"+id).innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' />   ";

        document.gbform.submit();
    }
  }

//=============================================================;
function gbcancel() {

    gebi('insertdiv').style.display='none';
    faderOut(2);
    gebi("insertta").innerHTML="";
    gebi("picerrordiv").style.display="none";

}



 //=============================================================;
function gbaddcomment(id,userlogedin,authenticate) {
    if (gebi("gbsubject")) {
        if (id) { //comment on a topic, do not show subject;
            gebi("subjectdiv").style.display="none";
        }
        else {
            gebi("subjectdiv").style.display="";
        }
    }
    if (id) {
        gebi("gbinsertbutton").value="Add Comment";
    }
    else {
        gebi("gbinsertbutton").value="Add Topic";
    }

    if ((userlogedin!=="True") && (authenticate==="True")) {showUserLogin('blogs');return;}
    if (gebi("fader2")) {faderIn(2);}
    setcenter("insertdiv","screen",true);
    gebi("insertdiv").style.display="inline-block";
    gebi("gbinsertbutton").onclick=function() {gbinsert(id);};

 }

 //=============================================================;
function gbinsert(id,rtext) {  // id is 0 or empty if a new topic;
                               // if rtext is given, then we come from rich text editor;

    if (!rtext) {
        if (gebi("countryselector")) {if (gebi("countryselector").options[gebi("countryselector").selectedIndex].text==="") {alert("Please select your country");return;}}
        if (gebi("gbname")) {if (trim(gebi("gbname").value).length<6) {alert("Please privide your name (min. 6 chars)");return;}}
        if ((gebi("gbsubject")) && (gebi("subjectdiv").style.display==="")) {if (trim(gebi("gbsubject").value)==="") {alert("Please provide a subject");return;}}
        if (gebi("insertta")) {if (trim(gebi("insertta").value)==="") {alert("Please add your text");return;}}
        if (gebi("pic_value")) {if (trim(gebi("pic_value"))==="") {alert("Please provide the security number");return;}}

        gebi("insertdiv").style.display="none";
    }
    if (gebi("content_"+id)) {
        gebi("content_"+id).innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' />   ";
    }
    else {
        img=document.createElement("img");
        img.src=vbasepath+"images/wait.gif";
        var first=gebi("gbcontent").childNodes[0];
        gebi("gbcontent").insertBefore(img,first);
        gebi("gbcontent").insertBefore(document.createElement("center"),first);

        gebi("gbcontent").insertBefore(document.createElement("br"),first);
        gebi("gbcontent").insertBefore(document.createElement("br"),first);
        //gebi("gbcontent").innerHTML="<br><br><center><img id=img"+id+" src='"+vbasepath+"images/wait.gif' /></center>   "+gebi("gbcontent").innerHTML;
        var st=getScrollTarget(guestbookTarget);
        $(st).animate({scrollTop:0},500);
    }

    if (!id) {id="NULL";}
    if (id==="0") {id="NULL";}
    if (rtext) {
        text=rtext;
    }
    else {
        text=gebi("insertta").value;
        text=replace(text,"\n","<br>");
        faderOut(2);

    }

    gebi("action").value="insert";
    gebi("gbid").value=id;
    gebi("text").value=text;
    document.gbform.submit();
 }

//=============================================================;
function showUserLogin(atype) {

    if (gebi("fader2")) {faderIn(2);}
    setcenter("userloginpane","screen");
    gebi("userloginpane").style.display="inline-block";
    extra="";
    if (forceRemote) {extra=extra + "&forceremote=1";}
    gebi("userloginif").src=vbasedomain+"?relay=gblogin.asp&type="+atype+"&site_c="+site_c+extra;
    gebi("userloginif").style.height=350;
    gebi("userloginif").style.width=400;
}

//=============================================================;
function hideUserLogin() {
    $("#userloginpane").fadeOut();
    if (gebi("fader2")) {faderOut(2);}
    gebi("userloginif").src="";
}

//=============================================================;
function blacklist(id,blprompt,action) {
    if (confirm(blprompt)) {
        gebi("action").value=action;
        gebi("gbid").value=id;
        gebi("content_"+id).innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' />   ";
        document.gbform.submit();
    }
}

//=============================================================;
function userlogout() {
    gebi("userloginspan").innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' /> ";
    gebi('action').value='logout';
    document.gbform.submit();
}

//=============================================================;
function scrolltonew(id) {

    var st=getScrollTarget(guestbookTarget);
    if (gebi("div_"+id)) {  // a new row might not be visible, cause it's not accepted;
        arow=gebi("div_"+id);
        y=findPosY(arow);
        arow.style.backgroundColor="#eeeeee";
        arow.style.color="#0000ff";

        $(st).animate({scrollTop:y-findPosY(st)},500);

    }
    else {
        st.scrollTop=0;
    }
}
//=============================================================;
function maccept(id,acb)  {

    if (acb.checked) {
        gebi("action").value="accept";
    }
    else {
        gebi("action").value="reject";
    }
    gebi("gbid").value=id;
    gebi("content_"+id).innerHTML="<img id=img"+id+" src='"+vbasepath+"images/wait.gif' />   ";
    document.gbform.submit();

}

//=============================================================;
function busy() {
    gebi("gbcontent").style.display="none";
    gebi("gbwait").style.display="inline";
}



//=============================================================;
function getScrollTarget(id) { // find out what to scroll, returns the object;

    var st;
    if (id==="content") {
        if (haveScrollbar) {
            st=gebi("content_scroller");
        }
        else {
            st=document.body;
        }
    }
    else if (id==="modal") {
        st=gebi("modal");
    }
    else if ((id==="left") || (id==="right") || (id==="top") || (id==="content")) {
        st=gebi(id+"_scroller");
    }
    else {
        st=document.body;
    }
    return st;

}





// ======================================================================	;
function slidePage(num,page_c,asite,ss_name) {
    if (gebi("showcooliris").style.display==="") {searchCoolIris("cooliris_container",gebi("slidesearch").value);return;}

    $("#"+piclensTarget).stop().animate({opacity:0},500);




    if (piclensTarget==="") {
        showWait("content");
    }
    else if (piclensTarget==="modal") {
        showWait("screen");
    }
    else {
        showWait(piclensTarget);
    }
    resetId((piclensTarget));
    var data=initData();
    if (gebi("slidesearch")) {
        search=gebi("slidesearch").value;
    }
    else {
        search="";
    }

//            extern=replace(extern,"slideshow.asp?",vbasedomain+"?relay=slideshow.asp&usermd5="+gbmd5_tags+"&");


    if ((search!=="") && (num===1)) {searchCoolIris("cooliris_container",search);}
    data[4]=vbasedomain+"?relay=slideshow.asp&site_c=" + asite +"&page="+ num +"&search="+search+"&ss_name="+ss_name;
    data[3]=page_c;
    data[2]=piclensTarget;
    showNodeCallBack(data);
}

var gbmd5_tags="";
var gbmd5_blogs="";

// ======================================================================	;
function gbloggedin(type,userid,username,userhash) {  // called by child window!;

    if (type==="tags") {
        tagsloggedin=true;
        tagsuserid=userid;
        tagsusername=username;
        gbmd5_tags=userhash;
    }
    else {
        blogsloggedin=true;
        blogsuserid=userid;
        blogssusername=username;
        gbmd5_blogs=userhash;

    }

    if (gebi('userloginspan')){gebi('userloginspan').innerHTML="<img src='"+vbasepath+"images/wait.gif' />";}
    if (document.gbform) {document.gbform.submit();}
    hideUserLogin();
}



// ======================================================================	;
function searchCoolIris(containerId,search) {
    var a=gebi(containerId);
    var awidth=a.width;
    var aheight=a.height;
    alist=a.innerHTML.split("feed=")[1];
    var newurl=alist.split("\"")[0].split("%26search%3")[0]+encodeURIComponent("&search="+search);

    var flashvars = {
        feed: newurl,
        showEmbed:false,
        showSearch:false,
        showChrome:false


    };
    var params = {
        allowscriptaccess: "always",
        wmode:"transparent"
    };
    //swfobject.embedSWF(url, containerId, width, height, version, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn);
    swfobject.embedSWF("http://apps.cooliris.com/embed/cooliris.swf",containerId, awidth, aheight, "9.0.0", "", flashvars, params);

}

// ======================================================================	;
function floatBox(objId,doit,setit) {
    var obj=gebi(objId);

    if (doit) {
        if (setit) {obj.isFloat=true;}
        obj.style.position="absolute";
        obj.originalNode=obj.parentNode;
        gebi("document_body").appendChild(obj);

        if ((hasDragDrop) && (!dd.elements[objId])) {
            ADD_DHTML(objId+RESET_Z);
            dd.elements[objId].setDropFunc(function(){drop(objId);});
            dd.elements[objId].setCursor(CURSOR_MOVE);
        }
        if (objId==="vbaselink") {obj.originalNode=gebi("toolbox");$(obj).removeClass("adminbutton").addClass("vbaselink");}
        if (objId==="searchspan") {obj.originalNode=gebi("toolbox");$(obj).removeClass("adminbutton").addClass("searchspan");}
        if (objId==="toolbox") {obj.originalNode=gebi("bottom");}
        positionOnAnchor(objId);

    }
    else {
        if (setit) {obj.isFloat=false;}
        if (obj.originalNode) {
            obj.style.width="";
            obj.style.height="";
            if ((obj.originalNode.firstChild ) && (objId==="vbaselink")) {
                obj.originalNode.insertBefore(obj,obj.originalNode.firstChild);
            }
            else {
                obj.originalNode.appendChild(obj);
            }

            if (hasDragDrop) {
                if (dd.elements[objId]) {
                    dd.elements[objId].del();
                }
            }
            obj.style.width="";
            obj.style.height="";
            obj.style.position="relative";
            obj.style.left=0;
            obj.style.top=0;

        }
        if (objId==="vbaselink") {$(obj).removeClass("vbaselink").addClass("adminbutton");}
        if (objId==="searchspan") {$(obj).removeClass("searchspan").addClass("adminbutton");}

    }
}


// ======================================================================	;
function reDHTML(what) {
    if (!hasDragDrop) {return;}
    var list=[];
    var nel=0;
    
    if (dd.elements) {
        oldstate=state;
        state="";
        if (dd.elements[what]) {
            var objId=dd.elements[what].id;
            var obj=gebi(objId);
            obj.t=obj.style.top;
            obj.l=obj.style.left;
            dd.elements[what].del();
            if (getStyle(what,"width",true)!=="") {gebi(what).style.width=noPy(getStyle(what,"width",true))-widthWaste(what);} else {gebi(what).style.width="";}
            if (getStyle(what,"height",true)!=="") {gebi(what).style.height=noPy(getStyle(what,"height",true))-heightWaste(what);} else {gebi(what).style.height="";}
            //if (getStyle(what,"width")!=="") {gebi(what).style.width=noPy(getStyle(what,"width"))-widthWaste(what);}
            //if (getStyle(what,"height")!=="") {gebi(what).style.height=noPy(getStyle(what,"height"))-heightWaste(what);}
            ADD_DHTML(what);
            dd.elements[what].setCursor(CURSOR_MOVE);
            dd.elements[what].moveTo(obj.l,obj.t);
            dd.elements[what].setDropFunc(function(){drop(this.id);});
        }
        state=oldstate;
    }
}

// ======================================================================	;
function updateAuxNode() {
    var a=replace(currentStyle,"_hover","");
    a=replace(a,"_clicked","");
    var obj=gebi(a);
    var thenode=gebi("auxnode").value;
    obj.shownode=thenode;

    if (thenode!=="") {
        $(obj).unbind("click");
        $(obj).bind("click",function(){
            removeAuxClickedStates("round");
            removeClickedStates('all',false,'rounding');
            setNav(this.shownode);
            showNode(this.shownode,"","");
        });
    }
    alert("updated");
}

// ======================================================================	;
function deletePseudoStyles() {

    for (var i=0;i< theRules.length;i++) {
        if (theRules[i].style["content"]) {
            if (theRules[i].style["content"]!=="") {deleteStyleText(theRules[i].selectorText);}
        }
    }
}
function reNav() {
    getJson('nav','navCallBack','','');
}








var dragobject="";
var dragmode="";

var nn6=document.getElementById&&!document.all;
var curx,cury;
var isdrag=false;
disabletag=false;
var targetX=100;        // apoint in the left top corner of contentTD
var targetY=100;         // apoint in the left top corner of contentTD

var picLeft;
var picTop;
var picBottom;
var picRight;

// ======================================================================	
function movemouse(e)
{

    if (nn6) {xnow=e.pageX;} else {xnow=parseInt(event.clientX,10)+parseInt(document.body.scrollLeft,10);}
    if (nn6) {ynow=e.pageY;} else {ynow=parseInt(event.clientY,10)+parseInt(document.body.scrollTop,10);}
    
    xnow=parseInt(xnow+0,10);
    ynow=parseInt(ynow+0,10);
    
    dx=xnow-curx;
    dy=ynow-cury;
    curx=xnow;
    cury=ynow;
    
  if ((isdrag) && (dragobject!==""))
  {
    
    newleft=parseInt(dragobject.style.left+0,10);
    newtop=parseInt(dragobject.style.top+0,10);
    newwidth=parseInt(dragobject.style.width+0,10);
    newheight=parseInt(dragobject.style.height+0,10);
    if (dragmode==='') {return;}
    if (dragmode==='normal') {
        newleft = newleft+dx;
        newtop  = newtop+dy;
    }
    if (dragmode.indexOf("bottom")!==-1) {
        newheight = newheight+dy;
    }
    if (dragmode.indexOf("left")!==-1) {
        newwidth = newwidth-dx;
        newleft =  newleft+dx;
    }        
    if (dragmode.indexOf("right")!==-1) {
        newwidth =  newwidth+dx;
    }
    if (dragmode.indexOf("top")!==-1) {
        newheight =  newheight-dy;
        newtop =  newtop+dy;
    }        
    if (dragmode.indexOf("vertical")!==-1) {
        newtop  = newtop+dy;
        lt=dragobject.limitTop*1;
        lb=dragobject.limitBottom*1;
        if (newtop<lt) {newtop=lt;}
        if (newtop>lb) {newtop=lb;}
        dragobject.style.top = newtop;
        scroll(dragobject.id,false);
        
        
        return;
        
    }        
    
    if (xnow<picLeft) {return;}
    if (xnow>picRight) {return;}
    
    if (ynow<picTop) {return;}
    if (ynow>picBottom) {return;}
    

    if (newwidth<20) {newwidth=20;}
    if (newheight<20) {newheight=20;}
    if (newleft<picLeft) {newleft=picLeft;}
    if (newleft+newwidth>picRight) {newleft=picRight-newwidth;}
    if (newtop+newheight>picBottom) {newtop=picBottom-newheight;}
    if (newtop<picTop) {newtop=picTop;}
    
    dragobject.style.left = newleft;
    dragobject.style.top = newtop;
    dragobject.style.width = newwidth;
    dragobject.style.height = newheight;

    position_input();

    return false;
  }
}

// ======================================================================	
function selectmouse(e) 
{
  var fobj       = nn6 ? e.target : event.srcElement;
  var topelement = nn6 ? "HTML" : "BODY";

  while (fobj.tagName != topelement && !fobj.className.find("dragme"))
  {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
  }
  if (fobj.className.find("dragme"))
  {
    isdrag = true;
    dragobject = fobj;
    if (dragobject.id.find("vbar")) {
        dragobject=gebi(replace(dragobject.id,"vbar_","vglider_"));
    }
    if (dragmode==='normal') {
    
        tx = parseInt(dragobject.style.left+0,10);
        ty = parseInt(dragobject.style.top+0,10);
    }
    else {
    
        sx = parseInt(dragobject.style.width+0,10);
        sy = parseInt(dragobject.style.height+0,10);
    }        
    if (nn6) {curx=e.pageX;} else {curx=parseInt(event.clientX,10)+parseInt(document.body.scrollLeft,10);}
    if (nn6) {cury=e.pageY;} else {cury=parseInt(event.clientY,10)+parseInt(document.body.scrollTop,10);}
    return false;
  }
}



//=====================================
function caption_it() {

    //if(!passwordPassed) {return}
    $("#tag_instructions").hide();
    $("#caption_instructions").show();
    $("#tag_controls").hide();
    $("#caption_controls").show();
    gebi("input").style.top=picTop;
    gebi("input").style.left=picLeft;
    $("#input").show();
    gebi("taginput").style.width=400;
    $(".tdsmall").css("width",400);
    text=gebi("caption_holder").innerHTML;
    text=replace(text,"<br>","/n");
    text=trim(replace(text,"&nbsp;"," "));
    gebi("taginput").value=text ;
}

//=====================================
function tagit(e) {
    if (disabletag) {return;}
    if (!tagsloggedin) {
        if (gebi('loginflag').value==='0') {
            $("#picoptions").hide();   
            showUserLogin("tags");      
            return;
        }
        else {
            tagsloggedin=true;
        }
    }
    gebi("taginput").style.width=200;
    $(".tdsmall").css("width",200);
    
    $("#tag_instructions").show();
    $("#caption_instructions").hide();
    $("#tag_controls").show();
    $("#caption_controls").hide();
    
    gebi("taginput").value="your text here.."    ;
    if (nn6) {anx=e.pageX;} else {anx=parseInt(event.clientX,10)+parseInt(document.body.scrollLeft,10);}
    if (nn6) {any=e.pageY;} else {any=parseInt(event.clientY,10)+parseInt(document.body.scrollTop,10);}
    $(".tag").css("opacity",0.3); // show all existing
    
    $(".dragme").show().css("width",40).css("height",40).css("left",anx-20).css("top",any-20);
    $("#input").show();
    position_input();
}

//=====================================
function position_input() {

    midx=parseInt(gebi("dragme").style.left,10)+parseInt(gebi("dragme").style.width,10)/2;
    
    gebi("input").style.top=parseInt(gebi("dragme").style.top,10)+getscrollheight("dragme")+5;
    gebi("input").style.left=midx-getscrollwidth("input")/2;
 }
 
 //=====================================
function cancel_tag() {
    
    // hide edit tag
    $(".dragme").hide();
    $("#input").hide();
}

//=====================================
function taglogout(encodedcookie,acookie) {
    tagsloggedin=false;
    cancel_tag();
    gebi('loginflag').value='0';
}

//=====================================
function submit_caption() {

    var text=gebi("taginput").value;
    text=replace(text,"\n","<br>");

    gebi("action").value="submitcaption";
    gebi("tagtext").value=text;
    gebi("photo_id").value=gebi("imageId").value;
    ttext="inserting.. <img src='"+vbasepath+"images/wait.gif' />";
    showPop(ttext,picLeft+10,picTop+10);
    if (text==="") { text="&nbsp;";}
    gebi("caption_holder").innerHTML =text;
    document.sform.submit();
    anid=gebi("currentpic").spanid;// id of the small image. we need to change the caption
    gebi(anid).title=text;
    cancel_tag();
}
//=====================================
function submit_tag() {

    if ((gebi("taginput").value==="") || (gebi("taginput").value==="your text here..")){
        alert("You still need to add text...");
    }
    else {
        var text=gebi("taginput").value;
        text=replace(text,"\n","<br>");

        gebi("action").value="submittag";
        gebi("tagtext").value=text;
        gebi("photo_id").value=gebi("imageId").value;
        var imgwidth=getscrollwidth("currentpic");
        var imgheight=getscrollheight("currentpic");
        
        var left=(parseInt(gebi("dragme").style.left,10)-picLeft)/imgwidth*100;
        var top=(parseInt(gebi("dragme").style.top,10)-picTop)/imgheight*100;
        var width=parseInt(gebi("dragme").style.width,10)/imgwidth*100;
        var height=parseInt(gebi("dragme").style.height,10)/imgheight*100;
        
        gebi("sleft").value=parseInt(left+0.5,10);
        gebi("stop").value=parseInt(top+0.5,10);
        gebi("swidth").value=parseInt(width+0.5,10);
        gebi("sheight").value=parseInt(height+0.5,10);

        cancel_tag();

        text="inserting.. <img src='"+vbasepath+"images/wait.gif' />";
        showPopCentered(text,gebi("dragme"));
        
        document.sform.submit();
    }
}    

//=====================================
function kill_tag(check) {

    l=parseInt(gebi("popcontainer").style.left,10);
    r=parseInt(gebi("popcontainer").style.left,10)+getscrollwidth("popcontainer");
    t=parseInt(gebi("popcontainer").style.top,10);
    b=parseInt(gebi("popcontainer").style.top,10)+getscrollheight("popcontainer");
    $(".tag").css("opacity",0);

    if ((curx>l) && (curx<r) && (cury>t) && (cury<b) && (check) )  {return;}
    killPop();
}


//=====================================
function getTags(photo_id) {
    
    callback='JFgetdata(getTagCallback)';
    extra="&photo_id="+photo_id;
    if (forceRemote) {extra=extra+"&forceremote=1";}
    src=vbasepath+"gettags.asp?r="+Math.random()+"&callback="+callback+extra;
    request = new JSONscriptRequest(src,"js");
    request.buildScriptTag();
    request.addScriptTag();

}


//=====================================
function getTagCallback(data) {

// creates and positions the tags
//username, tag_id, photo_id, user_id, tagtop, tagleft, tagwidth,tagheight, tagtext, email,givenname,familyname,blacklisted

    nfields=13;
    
    for (var i=0;i< data.length;i=i+nfields) {
        username=data[i];
        tag_id=data[i+1];
        photo_id=data[i+2];
        user_id=data[i+3];
        tagtop=data[i+4];
        tagleft=data[i+5];
        tagwidth=data[i+6];
        tagheight=data[i+7];
        tagtext=data[i+8];
        tagemail=data[i+9];
        taggivenname=data[i+10];
        tagfamilyname=data[i+11];
        tagblacklisted=data[i+12];
        if (user_id===0) {username="SysAdmin";}
        
        newdiv=document.createElement("div");
        document.body.appendChild(newdiv);
        $(newdiv).addClass("tag");
        
        picWidth=picRight-picLeft;
        picHeight=picBottom-picTop;
        
        newdiv.style.width=picWidth/100*tagwidth;
        newdiv.style.height=picHeight/100*tagheight;
        newdiv.style.left=picLeft+picWidth/100*tagleft;
        newdiv.style.top=picTop+picHeight/100*tagtop;
        newdiv.style.zIndex=10000;
        newdiv.id="tag_"+tag_id;
            
        tagtext=tagtext+"<br><br><font style=font-size:9px>Tagged by: "+username;
        if (passwordPassed) {
            tagtext=tagtext+" <br>("+tagfamilyname+", "+taggivenname+" "+tagemail+")"+"<br>";
            tagtext=tagtext+"<a href=\"javascript:delete_tag('"+tag_id+"');void(0);\">delete</a>";
            //tagtext=tagtext+"<a href=\"javascript:delete_tag('"+tag_id+"');void(0);\">delete</a>";
        }
        else if (user_id===tagsuserid) {
            tagtext=tagtext+"<br><a href=\"javascript:delete_tag('"+tag_id+"');void(0);\">delete</a>";
        }
        newdiv.tagtext=tagtext;
        
        newdiv.onmouseover=function(){popTag(this.tagtext,this);};
        newdiv.onmouseout=function(){kill_tag(true);};
        newdiv.ondblclick=tagit;
        $(".tag").css("opacity",0.0);   
        
    }
    if (data.length===nfields) {
        gebi("ntags").innerHTML=data.length/nfields+ " tag";
    }
    else {
        gebi("ntags").innerHTML=data.length/nfields+ " tags";
    }                
    
}

//=====================================
function showtags() {

    $(".tag").css("opacity",0.7);
    $(".tag").each(function(){
        var aclone=this.cloneNode(true);
        document.body.appendChild(aclone);
        aclone.innerHTML=this.tagtext;
        aclone.style.width="";
        aclone.style.height="";

        xcent=parseInt(this.style.left,10)+parseInt(this.style.width,10)/2;
        ycent=parseInt(this.style.top,10)+parseInt(this.style.height,10)/2;
        aclone.className="tag tagclone";
        
        aclone.style.left=xcent-aclone.scrollWidth/2;
        aclone.style.top=ycent-aclone.scrollHeight/2;  
    });
}

//=====================================
function hidetags() {
    $(".tag").css("opacity",0)        ;   
    $(".tagclone").each(function(){this.parentNode.removeChild(this);});
}

//=====================================
function delete_tag(tag_id) {
    if (!confirm("You are about to delete this tag.\nThis cannot be undone.\nAre you sure you want to do this?")) {return;}

    gebi("action").value="deletetag";
    gebi("tag_id").value=tag_id;
    text="deleting.. <img src='"+vbasepath+"images/wait.gif' />";
    showPopCentered(text,gebi("tag_"+tag_id));
    document.sform.submit();
}    

//=====================================
function removeAllTags() {
    $(".tag").each(function(){this.parentNode.removeChild(this);});
    kill_tag(true); // popup text for a tag
    gebi("ntags").innerHTML="";
}

//=====================================
function slideshowSubmitted(anaction) {  // called by child window!

    if (anaction==="submitcaption") {
        gebi("popcontainer").style.display='none';
    }
    if (anaction==="submittag") {
        killPop();
        removeAllTags();  
        
        getTags(gebi("imageId").value);
    }
    if (anaction==="deletetag") {
        removeAllTags();
        kill_tag(false);
    
        getTags(gebi("imageId").value);
    }    
}


//=====================================
function showPop(text,anx,any) {
    if (text==="") {return;}
    if (!anx) {var anx=curx+50;}if (!any) {var any=cury;}
    gebi("popcontainer").style.display="inline-block";
    gebi("popcontainer").style.width=500;
    $("#popshadow").css("opacity",0.5)[0].innerHTML=text;
    $("#poptext").css("opacity",1)[0].innerHTML=text;
    if ($(".popcaptionspan")[0]) {$(".poptext hr").css("width",$(".popcaptionspan")[0].scrollWidth);}


    gebi("popcontainer").style.width=gebi("poptext").scrollWidth+6;
    gebi("popcontainer").style.height=gebi("poptext").scrollHeight+6;
    any=min(any,windowH-gebi("poptext").scrollHeight+6-20);
    gebi("popcontainer").style.display="none";
    
    gebi("popcontainer").style.left=anx;
    gebi("popcontainer").style.top=any;
    
    $("#popcontainer").stop().css("display","none").css("opacity",1).fadeIn(500);

}
//=====================================
function killPop() {
   $("#popcontainer").stop().fadeOut(500);
}

//=====================================
function showPopCentered(text,obj) {

    
    gebi("popcontainer").style.display="inline-block";
    gebi("popcontainer").style.width=500;
    $("#popshadow").css("opacity",0.5)[0].innerHTML=text;
    $("#poptext").css("opacity",1)[0].innerHTML=text;
    if ($(".popcaptionspan")[0]) {$(".poptext hr").css("width",$(".popcaptionspan")[0].scrollWidth);}
    
    gebi("popcontainer").style.width=gebi("poptext").scrollWidth+6;
    gebi("popcontainer").style.height=gebi("poptext").scrollHeight+6;
    anx=parseInt(obj.style.left,10)+parseInt(obj.style.width,10)/2-getscrollwidth("poptext")/2;
    any=parseInt(obj.style.top,10)+parseInt(obj.style.height,10)/2-getscrollheight("poptext")/2;
    gebi("popcontainer").style.left=anx;
    gebi("popcontainer").style.top=any;

    gebi("popcontainer").style.display="none";
    
    $("#popcontainer").stop().css("display","none").css("opacity",1).fadeIn(500)  ;  
}


//=====================================
function popTag(text,obj) {
    $(obj).css("opacity",0.7);
    showPopCentered(text,obj);
}

    //=====================================;
    function gebi(id) {return document.getElementById(id);}


// ======================================================================	


// ======================================================================	     
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof window.pageYOffset  == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}        


// ======================================================================
function replace(string,text,by) {
	// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength === 0) || (txtLength === 0)) {return string;}

    var i = string.indexOf(text);
    if ((!i) && (text !== string.substring(0,txtLength))) {return string;}
    if (i === -1) {return string;}

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength) {
        newstr += replace(string.substring(i+txtLength,strLength),text,by);
    }
    return newstr;
}	

    //===================================================================================================
    function getWindowSize(item) {
      var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
      if (item=='w') {return parseInt(myWidth,10);}
      if (item=='h') {return parseInt(myHeight,10);}
    }

// ======================================================================	
function getscrollheight(anid) {

	if (document.all) {
		return parseInt(gebi(anid).clientHeight,10);
	}
	else {
		return parseInt(gebi(anid).offsetHeight,10);
	}
}
// ======================================================================	
function getscrollwidth(anid) {
	if (document.all) {
		return parseInt(gebi(anid).clientWidth,10);
	}
	else {
		return parseInt(gebi(anid).offsetWidth,10);
	}
}

//=====================================
function ltrim(str) {
   var whitespace = " \t\n\r";
   var s = String(str);
   if (whitespace.indexOf(s.charAt(0)) !== -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) !== -1) 
        {j++;}
        s = s.substring(j, i);
      
   }
   return s;
}

//=====================================
function rtrim(str) {
   var whitespace = " \t\n\r";
   var s = String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) !== -1) {
      var i = s.length - 1;       // Get length of string
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) !== -1) 
        {i--;}
        s = s.substring(0, i+1);
      
   }
   return s;
}

//=====================================
function trim(str) {return rtrim(ltrim(str));}





	






// ======================================================================	
//    http://adamv.com/dev/javascript/querystring	
// ======================================================================	
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	this.get=Querystring_get;
	if (qs == null) {
		qs=location.search.substring(1,location.search.length);
        if (qs.indexOf("?")!==-1) {
        
            // if coming from a proxy page, then we can have 2 questionmarks. start from the last
            qs=qs.substr(qs.indexOf("?")+1);
       }
        
        
	if (qs.length === 0) 
		{return;}

	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
	for (var i=0;i<args.length;i++) {
		var pair = args[i].split('=');
		var name = unescape(pair[0]);
		if (pair.length===2) {value =unescape(pair[1]);} else {value=name;}
		//var value = (pair.length==2)
		//	? unescape(pair[1])
		//	: name;
		
		this.params[name] = value;
	}
	}
}

// ======================================================================	
function Querystring_get(key, default_) {
	var value=this.params[key];
	return (value!=null) ? value : default_;
}





function isNumeric(strString)
//  check for valid numeric strings	
{
var strValidChars = "0123456789-";
var strChar;
var blnResult = true;

if (strString.length == 0) return false;

//  test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
  {
  strChar = strString.charAt(i);
  if (strValidChars.indexOf(strChar) == -1)
     {
     blnResult = false;
     }
  }
return blnResult;
}


function errorReport() {

    mes="";
    mes=mes + version.substr(1);
    
    gebi("content").innerHTML=mes;
    setContentHeight();
    

}

// ======================================================================	
function removeAllOptions(selectbox){
    var i;
    for(i=selectbox.options.length-1;i>=0;i--) {
        selectbox.remove(i);
    }
}    


// ======================================================================	;
function autoSuggest(aval,site_c,ss_name) {
    if (trim(aval)!=="") {
        extra="";
        if (forceRemote) {extra=extra + "&forceremote=1";}
        src=vbasepath+"autocomplete.asp?site_c="+site_c+"&ss_name="+ss_name+"&search="+aval+extra;
        jQuery.getJSON(src+"&callback=?", function(data){JFgetdata(autoSuggestCallBack,data);});
    }
    else {
        removeAllOptions(gebi("myselect"));
        gebi("myselect").style.display="none";
    }
}
    
// ======================================================================	;
function autoSuggestCallBack(data) {

    a=gebi("slidesearch");
    b=gebi("myselect");
    b.style.position="absolute";

    removeAllOptions(b);
    gebi("myselect").size=min(5,data.length);
    for (var i=0;i<data.length;i=i+2) {
        addOption(b,data[i]+" ("+data[i+1]+")",data[i]);
    }
    
    //now position the box   
    
    a=gebi("slidesearch");
    b=gebi("myselect");
    x=findPosX(a);
    y=findPosY(a)+a.offsetHeight;
    b.style.top=y;
    b.style.zIndex=1000;

    if (data.length>0) {b.style.display="";} else {b.style.display="none";}

    if (a.getAttribute("boxalign")==="left") { //align left with left
        b.style.left=x;
    }
    else { // alight the right side of autosuggest to the right side of slidesearch
        b.style.left=x-b.offsetWidth+a.offsetWidth+35;
    }
     
    
}

// ======================================================================	;
function printNode(node) {
    var extra="";
    if (forceRemote) {extra=extra + "&forceremote=1";}

    src=vbasepath+"printnode.asp?site_c="+site_c+"&content_c="+node +extra;
    imageBrowser=window.open(src,"xyz","fullscreen=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes");
}    

function setContainer(name,w,h,hIsMax) {
    unround(name)
    gebi(name).style.width=""
    gebi(name).style.height=""
    gebi(name+"_scroller").style.width=""
    gebi(name+"_scroller").style.height=""
    
    s.style.overflow="auto"
    s.style.overflowX="hidden"
    
    gebi(name).style.width=w-widthWaste(name)
    gebi(name+"_scroller").style.width=w-getWidthStuff(name)-widthWaste(name+"_scroller")
    
    if ((h) && (!hIsMax)) { // h is fixed, precalulated
        gebi(name).style.height=h-heightWaste(name)
        gebi(name+"_scroller").style.height=h-getHeightStuff(name)-heightWaste(name+"_scroller")
    }
    if (hIsMax) { //h can grow; check against maxh
        if (gebi(name).scrollHeight>h) {
            gebi(name).style.height=h-heightWaste(name)
            gebi(name+"_scroller").style.height=h-getHeightStuff(name)-heightWaste(name+"_scroller")
        }
    }
    
    round(name)
}

function initTest() {


    t=gebi("aux1")
    s=gebi("aux1_scroller")
    t.style.position="absolute"
    s.style.position="relative"
    t.style.top=100
    t.style.left=100
    unround("aux1")
    setStyle("aux1","backgroundColor","#ff0000")
    setStyle("aux1","border","3px solid #0000ff")
    setStyle("aux1_scroller","backgroundColor","#00ff00")
    setStyle("aux1","padding","10px")
    setStyle("aux1_scroller","padding","10px")

    s.innerHTML="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>xxxxxxxxxxxx<br>"
    rounding.aux1="tltrblbr png"
    setContainer("aux1",200,false,200)
};
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('k J=0;k K="";k u=8;p R(s){r L(B(D(s),s.v*u))}p B(x,e){x[e>>5]|=S<<((e)%A);x[(((e+T)>>>9)<<4)+14]=e;k a=U;k b=-V;k c=-W;k d=X;z(k i=0;i<x.v;i+=16){k f=a;k g=b;k h=c;k j=d;a=l(a,b,c,d,x[i+0],7,-Y);d=l(d,a,b,c,x[i+1],12,-Z);c=l(c,d,a,b,x[i+2],17,18);b=l(b,c,d,a,x[i+3],22,-19);a=l(a,b,c,d,x[i+4],7,-1a);d=l(d,a,b,c,x[i+5],12,1b);c=l(c,d,a,b,x[i+6],17,-1c);b=l(b,c,d,a,x[i+7],22,-1d);a=l(a,b,c,d,x[i+8],7,1e);d=l(d,a,b,c,x[i+9],12,-1f);c=l(c,d,a,b,x[i+10],17,-1g);b=l(b,c,d,a,x[i+11],22,-1h);a=l(a,b,c,d,x[i+12],7,1i);d=l(d,a,b,c,x[i+13],12,-1j);c=l(c,d,a,b,x[i+14],17,-1k);b=l(b,c,d,a,x[i+15],22,1l);a=m(a,b,c,d,x[i+1],5,-1m);d=m(d,a,b,c,x[i+6],9,-1n);c=m(c,d,a,b,x[i+11],14,1o);b=m(b,c,d,a,x[i+0],20,-1p);a=m(a,b,c,d,x[i+5],5,-1q);d=m(d,a,b,c,x[i+10],9,1r);c=m(c,d,a,b,x[i+15],14,-1s);b=m(b,c,d,a,x[i+4],20,-1t);a=m(a,b,c,d,x[i+9],5,1u);d=m(d,a,b,c,x[i+14],9,-1v);c=m(c,d,a,b,x[i+3],14,-1w);b=m(b,c,d,a,x[i+8],20,1x);a=m(a,b,c,d,x[i+13],5,-1y);d=m(d,a,b,c,x[i+2],9,-1z);c=m(c,d,a,b,x[i+7],14,1A);b=m(b,c,d,a,x[i+12],20,-1B);a=n(a,b,c,d,x[i+5],4,-1C);d=n(d,a,b,c,x[i+8],11,-1D);c=n(c,d,a,b,x[i+11],16,1E);b=n(b,c,d,a,x[i+14],23,-1F);a=n(a,b,c,d,x[i+1],4,-1G);d=n(d,a,b,c,x[i+4],11,1H);c=n(c,d,a,b,x[i+7],16,-1I);b=n(b,c,d,a,x[i+10],23,-1J);a=n(a,b,c,d,x[i+13],4,1K);d=n(d,a,b,c,x[i+0],11,-1L);c=n(c,d,a,b,x[i+3],16,-1M);b=n(b,c,d,a,x[i+6],23,1N);a=n(a,b,c,d,x[i+9],4,-1O);d=n(d,a,b,c,x[i+12],11,-1P);c=n(c,d,a,b,x[i+15],16,1Q);b=n(b,c,d,a,x[i+2],23,-1R);a=o(a,b,c,d,x[i+0],6,-1S);d=o(d,a,b,c,x[i+7],10,1T);c=o(c,d,a,b,x[i+14],15,-1U);b=o(b,c,d,a,x[i+5],21,-1V);a=o(a,b,c,d,x[i+12],6,1W);d=o(d,a,b,c,x[i+3],10,-1X);c=o(c,d,a,b,x[i+10],15,-1Y);b=o(b,c,d,a,x[i+1],21,-1Z);a=o(a,b,c,d,x[i+8],6,24);d=o(d,a,b,c,x[i+15],10,-25);c=o(c,d,a,b,x[i+6],15,-26);b=o(b,c,d,a,x[i+13],21,27);a=o(a,b,c,d,x[i+4],6,-28);d=o(d,a,b,c,x[i+11],10,-29);c=o(c,d,a,b,x[i+2],15,2a);b=o(b,c,d,a,x[i+9],21,-2b);a=w(a,f);b=w(b,g);c=w(c,h);d=w(d,j)}r E(a,b,c,d)}p C(q,a,b,x,s,t){r w(M(w(w(a,q),w(x,t)),s),b)}p l(a,b,c,d,x,s,t){r C((b&c)|((~b)&d),a,b,x,s,t)}p m(a,b,c,d,x,s,t){r C((b&d)|(c&(~d)),a,b,x,s,t)}p n(a,b,c,d,x,s,t){r C(b^c^d,a,b,x,s,t)}p o(a,b,c,d,x,s,t){r C(c^(b|(~d)),a,b,x,s,t)}p 2c(a,b){k c=D(a);N(c.v>16)c=B(c,a.v*u);k d=E(16),F=E(16);z(k i=0;i<16;i++){d[i]=c[i]^2d;F[i]=c[i]^2e}k e=B(d.O(D(b)),P+b.v*u);r B(F.O(e),P+2f)}p w(x,y){k a=(x&G)+(y&G);k b=(x>>16)+(y>>16)+(a>>16);r(b<<16)|(a&G)}p M(a,b){r(a<<b)|(a>>>(A-b))}p D(a){k b=E();k c=(1<<u)-1;z(k i=0;i<a.v*u;i+=u)b[i>>5]|=(a.2g(i/u)&c)<<(i%A);r b}p 2h(a){k b="";k c=(1<<u)-1;z(k i=0;i<a.v*A;i+=u)b+=2i.2j((a[i>>5]>>>(i%A))&c);r b}p L(a){k b=J?"2k":"2l";k c="";z(k i=0;i<a.v*4;i++){c+=b.H((a[i>>2]>>((i%4)*8+4))&Q)+b.H((a[i>>2]>>((i%4)*8))&Q)}r c}p 2m(a){k b="2n+/";k c="";z(k i=0;i<a.v*4;i+=3){k d=(((a[i>>2]>>8*(i%4))&I)<<16)|(((a[i+1>>2]>>8*((i+1)%4))&I)<<8)|((a[i+2>>2]>>8*((i+2)%4))&I);z(k j=0;j<4;j++){N(i*8+j*6>a.v*A)c+=K;2o c+=b.H((d>>6*(3-j))&2p)}}r c}',62,150,'||||||||||||||||||||var|md5_ff|md5_gg|md5_hh|md5_ii|function||return|||chrsz|length|safe_add|||for|32|core_md5|md5_cmn|str2binl|Array|opad|0xFFFF|charAt|0xFF|hexcase|b64pad|binl2hex|bit_rol|if|concat|512|0xF|hex_md5|0x80|64|1732584193|271733879|1732584194|271733878|680876936|389564586|||||||||606105819|1044525330|176418897|1200080426|1473231341|45705983|1770035416|1958414417|42063|1990404162|1804603682|40341101|1502002290|1236535329|165796510|1069501632|643717713|373897302|701558691|38016083|660478335|405537848|568446438|1019803690|187363961|1163531501|1444681467|51403784|1735328473|1926607734|378558|2022574463|1839030562|35309556|1530992060|1272893353|155497632|1094730640|681279174|358537222|722521979|76029189|640364487|421815835|530742520|995338651|198630844|1126891415|1416354905|57434055|1700485571|1894986606|1051523|2054922799|||||1873313359|30611744|1560198380|1309151649|145523070|1120210379|718787259|343485551|core_hmac_md5|0x36363636|0x5C5C5C5C|128|charCodeAt|binl2str|String|fromCharCode|0123456789ABCDEF|0123456789abcdef|binl2b64|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|else|0x3F'.split('|'),0,{}));
/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();;
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(C){C.8=C.8||{};C.L(C.8,{2m:{1f:3(E,F,H){7 G=C.8[E].1d;1p(7 D 2l H){G.R[D]=G.R[D]||[];G.R[D].2k([F,H[D]])}},m:3(D,E,G){7 H=D.R[E];6(!H){4}1p(7 F=0;F<H.2j;F++){6(D.5[H[F][0]]){H[F][1].d(D.a,G)}}}},w:{},g:3(D){6(C.8.w[D]){4 C.8.w[D]}7 E=C(\'<2i 2h="8-2g-2f">\').2e(D).g({11:"2d",b:"-1o",j:"-1o",2c:"2b"}).2a("O");C.8.w[D]=!!((!/29|28/.k(E.g("27"))||(/^[1-9]/).k(E.g("26"))||(/^[1-9]/).k(E.g("25"))||!(/1m/).k(E.g("24"))||!(/23|22\\(0, 0, 0, 0\\)/).k(E.g("21"))));20{C("O").1n(0).1Z(E.1n(0))}1Y(F){}4 C.8.w[D]},1X:3(D){D.X="1e";D.1l=3(){4 c};6(D.Q){D.Q.1k="1m"}},1W:3(D){D.X="1V";D.1l=3(){4 h};6(D.Q){D.Q.1k=""}},1U:3(G,E){7 D=/b/.k(E||"b")?"1h":"1j",F=c;6(G[D]>0){4 h}G[D]=1;F=G[D]>0?h:c;G[D]=0;4 F}});C.M(["12","1i"],3(E,D){6(!C.P["p"+D]){C.P["p"+D]=3(F){4 F!=1T?2.M(3(){2==v||2==f?v.1S(D=="12"?F:C(v)["1j"](),D=="1i"?F:C(v)["1h"]()):2["p"+D]=F}):2[0]==v||2[0]==f?1R[(D=="12"?"1Q":"1P")]||C.1O&&f.1N["p"+D]||f.O["p"+D]:2[0]["p"+D]}}});7 B=C.P.10;C.P.L({11:3(){7 F=2.1g();7 E=2.N();7 D=E.1g();4{b:F.b-A(2[0],"1M")-D.b-A(E,"1L"),j:F.j-A(2[0],"1K")-D.j-A(E,"1J")}},N:3(){7 D=2[0].N;1I(D&&(!/^O|1H$/i.k(D.1G)&&C.g(D,"11")=="1F")){D=D.N}4 C(D)},K:3(D){4 2.M(3(){1E C.8.K(2,D)})},1D:3(D){4 2.M(3(){6(C.Z(2,"8-Y")){C.Z(2,"8-Y").1c()}})},10:3(){13("*",2).1f(2).1a("10");4 B.d(2,u)}});3 A(D,E){4 1C(C.1B(D.1A?D[0]:D,E,h))||0}C.8.K=3(F,E){7 D=2;2.a=F;C.Z(2.a,"8-Y",2);2.5=C.L({},E);C(F).V("1b.e",3(){4 D.W.d(D,u)});6(C.16.15){C(F).1z("X","1e")}C(F).J(3(){6(D.t){18(D.t)}})};C.L(C.8.K.1d,{1c:3(){C(2.a).s("1b.e")},1a:3(){4 2.W.d(2,u)},W:3(F){6(F.1y!=1||C.1x(F.1w.1v.1u(),2.5.1t||[])!=-1||(2.5.19&&!2.5.19.d(2.5.l||2,[F,2.a]))){4 h}7 E=2;7 D=3(){E.q={j:F.T,b:F.S};C(f).V("J.e",3(){4 E.r.d(E,u)});C(f).V("U.e",3(){4 E.n.d(E,u)});6(!E.1s&&I.z(E.q.j-F.T)>=E.5.y||I.z(E.q.b-F.S)>=E.5.y){6(E.5.x){E.5.x.m(E.5.l||E,F,E.a)}6(E.5.n){E.5.n.m(E.5.l||E,F,2.a)}E.o=h}};6(2.5.17){6(2.t){18(2.t)}2.t=1r(D,2.5.17)}14{D()}4 c},r:3(D){7 E=2.5;6(!2.o){4 C(f).s("J.e").s("U.e")}6(2.5.r){2.5.r.m(2.5.l||2,D,2.a)}C(f).s("J.e").s("U.e");2.o=c;4 c},n:3(D){7 E=2.5;6(C.16.15&&!D.1q){4 2.r.d(2,[D])}6(!2.o&&(I.z(2.q.j-D.T)>=E.y||I.z(2.q.b-D.S)>=E.y)){6(2.5.x){2.5.x.m(2.5.l||2,D,2.a)}2.o=h}14{6(!2.o){4 c}}6(E.n){E.n.m(2.5.l||2,D,2.a)}4 c}})})(13);',62,147,'||this|function|return|options|if|var|ui||element|top|false|apply|draggable|document|css|true||left|test|executor|call|drag|initialized|scroll|_MP|stop|unbind|timer|arguments|window|cssCache|start|distance|abs|||||||||Math|mouseup|mouseInteraction|extend|each|offsetParent|body|fn|style|plugins|pageY|pageX|mousemove|bind|click|unselectable|mouse|data|remove|position|Left|jQuery|else|msie|browser|delay|clearInterval|condition|trigger|mousedown|destroy|prototype|on|add|offset|scrollTop|Top|scrollLeft|MozUserSelect|onselectstart|none|get|5000px|for|button|setTimeout|initalized|dragPrevention|toLowerCase|nodeName|target|inArray|which|attr|jquery|curCSS|parseInt|removeMouseInteraction|new|static|tagName|html|while|borderLeftWidth|marginLeft|borderTopWidth|marginTop|documentElement|boxModel|pageYOffset|pageXOffset|self|scrollTo|undefined|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|absolute|addClass|gen|resizable|class|div|length|push|in|plugin'.split('|'),0,{}))

;
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(A){A.3a.3=4(){6 C=1O 1v[0]=="1N"&&1v[0];6 B=C&&22.1x.39.38(1v,1)||1v;e C=="n"?A.b(2[0],"3").$3.n:2.y(4(){5(C){6 D=A.b(2,"3");5(D){D[C].37(D,B)}}m{36 A.8.3(2,B[0]||{})}})};A.8.3=4(D,C){6 B=2;2.7=A.1j({},A.8.3.28,C);2.f=D;5(C.d===t){2.7.d=t}2.7.w+=".3";A(D).U("35.3",4(F,E,G){5((/^d/).1Y(E)){B.16(G)}m{B.7[E]=G;B.1g()}}).U("34.3",4(F,E){e B.7[E]});A.b(D,"3",2);2.1g(1c)};A.8.3.28={d:0,1t:l,w:"1E",k:[],13:t,1p:"33&#32;",z:l,24:"8-3-",1m:{},14:t,1X:\'<1u><a o="#{o}"><1o>#{1d}</1o></a></1u>\',1C:"<27></27>",1k:"8-3-31",i:"8-3-d",1y:"8-3-1t",V:"8-3-k",Y:"8-3-23",x:"8-3-30",1b:"8-3-2Z"};A.1j(A.8.3.1x,{1D:4(B){e B.26&&B.26.12(/\\s/g,"25").12(/[^A-2Y-2X-9\\-25:\\.]/g,"")||2.7.24+A.b(B)},8:4(C,B){e{2W:2,7:2.7,2V:C,23:B}},1g:4(N){2.$j=A("1u:2U(a[o])",2.f);2.$3=2.$j.1r(4(){e A("a",2)[0]});2.$c=A([]);6 O=2,E=2.7;2.$3.y(4(Q,P){5(P.u&&P.u.12("#","")){O.$c=O.$c.19(P.u)}m{5(A(P).11("o")!="#"){A.b(P,"o.3",P.o);A.b(P,"p.3",P.o);6 S=O.1D(P);P.o="#"+S;6 R=A("#"+S);5(!R.n){R=A(E.1C).11("1h",S).h(E.Y).2T(O.$c[Q-1]||O.f);R.b("18.3",1c)}O.$c=O.$c.19(R)}m{E.k.1R(Q+1)}}});5(N){A(2.f).v(E.1k)||A(2.f).h(E.1k);2.$c.y(4(){6 P=A(2);P.v(E.Y)||P.h(E.Y)});2.$3.y(4(S,P){5(1I.u){5(P.u==1I.u){E.d=S;5(A.X.1i||A.X.2S){6 R=A(1I.u),T=R.11("1h");R.11("1h","");1z(4(){R.11("1h",T)},2R)}2Q(0,0);e l}}m{5(E.13){6 Q=2P(A.13("8-3"+A.b(O.f)),10);5(Q&&O.$3[Q]){E.d=Q;e l}}m{5(O.$j.r(S).v(E.i)){E.d=S;e l}}}});2.$c.h(E.x);2.$j.q(E.i);5(E.d!==t){2.$c.r(E.d).1Z().q(E.x);2.$j.r(E.d).h(E.i)}6 D=E.d!==t&&A.b(2.$3[E.d],"p.3");5(D){2.p(E.d)}E.k=A.2O(E.k.2N(A.1r(2.$j.Z("."+E.V),4(Q,P){e O.$j.1e(Q)}))).1Q();A(2M).U("2L",4(){O.$3.15(".3");O.$j=O.$3=O.$c=t})}2K(6 H=0,M;M=2.$j[H];H++){A(M)[A.1U(H,E.k)!=-1&&!A(M).v(E.i)?"h":"q"](E.V)}5(E.z===l){2.$3.1a("z.3")}6 C,J,B={"2J-2I":0,1H:1},F="2H";5(E.14&&E.14.2G==22){C=E.14[0]||B,J=E.14[1]||B}m{C=J=E.14||B}6 I={1q:"",2F:"",2E:""};5(!A.X.1i){I.1G=""}4 L(Q,P,R){P.21(C,C.1H||F,4(){P.h(E.x).1f(I);5(A.X.1i&&C.1G){P[0].20.Z=""}5(R){K(Q,R,P)}})}4 K(Q,R,P){5(J===B){R.1f("1q","1B")}R.21(J,J.1H||F,4(){R.q(E.x).1f(I);5(A.X.1i&&J.1G){R[0].20.Z=""}A(O.f).W("2D",[O.8(Q,R[0])],E.1Z)})}4 G(Q,S,P,R){S.h(E.i).2C().q(E.i);L(Q,P,R)}2.$3.15(".3").U(E.w,4(){6 S=A(2).2B("1u:r(0)"),P=O.$c.Z(":2A"),R=A(2.u);5((S.v(E.i)&&!E.1t)||S.v(E.V)||A(2).v(E.1b)||A(O.f).W("2z",[O.8(2,R[0])],E.16)===l){2.1s();e l}O.7.d=O.$3.1e(2);5(E.1t){5(S.v(E.i)){O.7.d=t;S.q(E.i);O.$c.1F();L(2,P);2.1s();e l}m{5(!P.n){O.$c.1F();6 Q=2;O.p(O.$3.1e(2),4(){S.h(E.i).h(E.1y);K(Q,R)});2.1s();e l}}}5(E.13){A.13("8-3"+A.b(O.f),O.7.d,E.13)}O.$c.1F();5(R.n){6 Q=2;O.p(O.$3.1e(2),P.n?4(){G(Q,S,P,R)}:4(){S.h(E.i);K(Q,R)})}m{2y"1J 2x 2w: 2v 2u 2t."}5(A.X.1i){2.1s()}e l});5(!(/^1E/).1Y(E.w)){2.$3.U("1E.3",4(){e l})}},19:4(E,D,C){5(C==1M){C=2.$3.n}6 G=2.7;6 I=A(G.1X.12(/#\\{o\\}/,E).12(/#\\{1d\\}/,D));I.b("18.3",1c);6 H=E.2s("#")==0?E.12("#",""):2.1D(A("a:2r-2q",I)[0]);6 F=A("#"+H);5(!F.n){F=A(G.1C).11("1h",H).h(G.Y).h(G.x);F.b("18.3",1c)}5(C>=2.$j.n){I.1W(2.f);F.1W(2.f.2p)}m{I.1V(2.$j[C]);F.1V(2.$c[C])}G.k=A.1r(G.k,4(K,J){e K>=C?++K:K});2.1g();5(2.$3.n==1){I.h(G.i);F.q(G.x);6 B=A.b(2.$3[0],"p.3");5(B){2.p(C,B)}}A(2.f).W("2o",[2.8(2.$3[C],2.$c[C])],G.19)},17:4(B){6 D=2.7,E=2.$j.r(B).17(),C=2.$c.r(B).17();5(E.v(D.i)&&2.$3.n>1){2.16(B+(B+1<2.$3.n?1:-1))}D.k=A.1r(A.1T(D.k,4(G,F){e G!=B}),4(G,F){e G>=B?--G:G});2.1g();A(2.f).W("2n",[2.8(E.2m("a")[0],C[0])],D.17)},1S:4(B){6 C=2.7;5(A.1U(B,C.k)==-1){e}6 D=2.$j.r(B).q(C.V);5(A.X.2l){D.1f("1q","2k-1B");1z(4(){D.1f("1q","1B")},0)}C.k=A.1T(C.k,4(F,E){e F!=B});A(2.f).W("2j",[2.8(2.$3[B],2.$c[B])],C.1S)},1P:4(C){6 B=2,D=2.7;5(C!=D.d){2.$j.r(C).h(D.V);D.k.1R(C);D.k.1Q();A(2.f).W("2i",[2.8(2.$3[C],2.$c[C])],D.1P)}},16:4(B){5(1O B=="1N"){B=2.$3.1e(2.$3.Z("[o$="+B+"]")[0])}2.$3.r(B).2h(2.7.w)},p:4(F,K){6 L=2,C=2.7,D=2.$3.r(F),J=D[0],G=K==1M||K===l,B=D.b("p.3");K=K||4(){};5(!B||(A.b(J,"z.3")&&!G)){K();e}5(C.1p){6 H=A("1o",J);H.b("1d.3",H.1n()).1n("<1L>"+C.1p+"</1L>")}6 I=4(){L.$3.Z("."+C.1b).y(4(){A(2).q(C.1b);5(C.1p){6 M=A("1o",2);M.1n(M.b("1d.3")).1a("1d.3")}});L.1l=t};6 E=A.1j({},C.1m,{1K:B,1A:4(N,M){A(J.u).1n(N);I();K();5(C.z){A.b(J,"z.3",1c)}A(L.f).W("2g",[L.8(L.$3[F],L.$c[F])],C.p);C.1m.1A&&C.1m.1A(N,M)}});5(2.1l){2.1l.2f();I()}D.h(C.1b);1z(4(){L.1l=A.2e(E)},0)},1K:4(C,B){2.$3.r(C).1a("z.3").b("p.3",B)},18:4(){6 B=2.7;A(2.f).15(".3").q(B.1k).1a("3");2.$3.y(4(){6 C=A.b(2,"o.3");5(C){2.o=C}6 D=A(2).15(".3");A.y(["o","p","z"],4(E,F){D.1a(F+".3")})});2.$j.19(2.$c).y(4(){5(A.b(2,"18.3")){A(2).17()}m{A(2).q([B.i,B.1y,B.V,B.Y,B.x].2d(" "))}})}});A.1j(A.8.3.1x,{1w:t,2c:4(C,F){F=F||l;6 B=2,E=2.7.d;4 G(){B.1w=2b(4(){E=++E<B.$3.n?E:0;B.16(E)},C)}4 D(H){5(!H||H.2a){29(B.1w)}}5(C){G();5(!F){2.$3.U(2.7.w,D)}m{2.$3.U(2.7.w,4(){D();E=B.7.d;G()})}}m{D();2.$3.15(2.7.w,D)}}})})(1J);',62,197,'||this|tabs|function|if|var|options|ui|||data|panels|selected|return|element||addClass|selectedClass|lis|disabled|false|else|length|href|load|removeClass|eq||null|hash|hasClass|event|hideClass|each|cache|||||||||||||||||||||bind|disabledClass|triggerHandler|browser|panelClass|filter||attr|replace|cookie|fx|unbind|select|remove|destroy|add|removeData|loadingClass|true|label|index|css|tabify|id|msie|extend|navClass|xhr|ajaxOptions|html|span|spinner|display|map|blur|unselect|li|arguments|rotation|prototype|unselectClass|setTimeout|success|block|panelTemplate|tabId|click|stop|opacity|duration|location|jQuery|url|em|undefined|string|typeof|disable|sort|push|enable|grep|inArray|insertBefore|appendTo|tabTemplate|test|show|style|animate|Array|panel|idPrefix|_|title|div|defaults|clearInterval|clientX|setInterval|rotate|join|ajax|abort|tabsload|trigger|tabsdisable|tabsenable|inline|safari|find|tabsremove|tabsadd|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|tabsselect|visible|parents|siblings|tabsshow|height|overflow|constructor|normal|width|min|for|unload|window|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|instance|z0|Za|loading|hide|nav|8230|Loading|getData|setData|new|apply|call|slice|fn'.split('|'),0,{}))

;
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3($){$.5=$.5||{};$.1v.E({6:3(b,c){7 d=1w.11.1x.F(12,1);h 2.x(3(){4(13 b=="1y"){7 a=$.j(2,"5-6");a[b].14(a,d)}s 4(!$(2).O(".5-6"))$.j(2,"5-6",1z $.5.6(2,b))})},P:3(a){h 2.6("P",a)}});$.5.6=3(a,b){2.9=b=$.E({},$.5.6.15,b);2.G=a;$(a).H("5-6");4(b.1A){7 c=$(a).16("a").t(b.17);4(c.Q){4(c.t(b.u).Q){b.8=c}s{b.8=c.m().m().1B();c.H("1C")}}}b.k=$(a).16(b.u);b.8=R(b.k,b.8);4(b.18){7 d=$(a).m().i();b.k.x(3(){d-=$(2).19()});7 e=0;b.k.n().x(3(){e=S.1a(e,$(2).1D()-$(2).i())}).i(d-e)}s 4(b.o){7 d=0;b.k.n().x(3(){d=S.1a(d,$(2).19())}).i(d)}b.k.T(b.8||"").n().U();b.8.m().I().H(b.y);4(b.V)$(a).1E((b.V)+".5-6",W)};$.5.6.11={P:3(a){W.F(2.G,{X:R(2.9.k,a)[0]})},1F:3(){2.9.Y=p},1G:3(){2.9.Y=z},1H:3(){2.9.k.n().A("1I","");4(2.9.18||2.9.o){2.9.k.n().A("i","")}$.1J(2.G,"5-6");$(2.G).1K("5-6").1L(".5-6")},1M:3(){2.9.q=z},1N:3(){2.9.q=p}};3 1b(a,b){h 3(){h a.14(b,12)}}3 1c(a){4(!$.j(2,"5-6"))h;7 b=$.j(2,"5-6");7 c=b.9;c.v=a?0:--c.v;4(c.v)h;4(c.1O){c.l.1P(c.r).A({i:"",1d:""})}$(2).1Q("1e.5-6",[c.j],c.1e)}3 J(a,b,c,d,e){7 f=$.j(2,"5-6").9;f.l=a;f.r=b;f.j=c;7 g=1b(1c,2);f.v=b.K()==0?a.K():b.K();4(f.L){4(!f.q&&d){$.5.6.Z[f.L]({l:M([]),r:b,B:g,w:e,o:f.o})}s{$.5.6.Z[f.L]({l:a,r:b,B:g,w:e,o:f.o})}}s{4(!f.q&&d){a.J()}s{b.U();a.10()}g(z)}}3 W(a){7 b=$.j(2,"5-6").9;4(b.Y)h p;4(!a.X&&!b.q){b.8.m().I().1f(b.y);7 c=b.8.n(),j={1g:2,9:b,1h:M([]),1i:b.8,1j:M([]),1k:c},f=b.8=$([]);J.F(2,f,c,j);h p}7 d=$(a.X);4(d.1R(b.u).Q)1S(!d.O(b.u))d=d.m();7 e=d[0]==b.8[0];4(b.v||(b.q&&e))h p;4(!d.O(b.u))h;b.8.m().I().1f(b.y);4(!e){d.m().I().H(b.y)}7 f=d.n(),c=b.8.n(),j={1g:2,9:b,1h:d,1i:b.8,1j:f,1k:c},w=b.k.1l(b.8[0])>b.k.1l(d[0]);b.8=e?$([]):d;J.F(2,f,c,j,e,w);h p};3 R(a,b){h b!=1T?13 b=="1U"?a.t(":1m("+b+")"):a.T(a.T(b)):b===p?$([]):a.t(":1m(0)")}$.E($.5.6,{15:{y:"1V",q:z,L:\'N\',V:"1W",u:"a",o:z,v:0,17:3(){h 2.1n.1o()==1X.1n.1o()}},Z:{N:3(c,d){c=$.E({C:"1p",D:1Y},c,d);4(!c.r.K()){c.l.1q({i:"10"},c);h}7 e=c.r.i(),1r=c.l.i(),1s=1r/e;c.l.A({i:0,1d:\'1t\'}).10();c.r.t(":1t").x(c.B).1Z().t(":20").1q({i:"U"},{21:3(a){7 b=(e-a)*1s;4($.1u.22||$.1u.23){b=S.24(b)}c.l.i(b)},D:c.D,C:c.C,B:3(){4(!c.o){c.l.A("i","25")}c.B()}})},26:3(a){2.N(a,{C:a.w?"27":"1p",D:a.w?28:29})},2a:3(a){2.N(a,{C:"2b",D:2c})}}})})(M);',62,137,'||this|function|if|ui|accordion|var|active|options||||||||return|height|data|headers|toShow|parent|next|autoHeight|false|alwaysOpen|toHide|else|filter|header|running|down|each|selectedClass|true|css|complete|easing|duration|extend|call|element|addClass|andSelf|toggle|size|animated|jQuery|slide|is|activate|length|findActive|Math|not|hide|event|clickHandler|target|disabled|animations|show|prototype|arguments|typeof|apply|defaults|find|navigationFilter|fillSpace|outerHeight|max|scopeCallback|completed|overflow|change|toggleClass|instance|newHeader|oldHeader|newContent|oldContent|index|eq|href|toLowerCase|swing|animate|showHeight|difference|hidden|browser|fn|Array|slice|string|new|navigation|prev|current|innerHeight|bind|enable|disable|destroy|display|removeData|removeClass|unbind|alwaysOpenTrue|alwaysOpenFalse|clearStyle|add|triggerHandler|parents|while|undefined|number|selected|click|location|300|end|visible|step|msie|opera|ceil|auto|bounceslide|bounceout|1000|200|easeslide|easeinout|700'.split('|'),0,{}));
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('m 7={J:[1i+"1j/2c.1k",1i+"1j/17.1k",1i+"1j/1l.1k",1i+"1j/1m.1k"],2d:U,2e:"<b>38 39. 3a 3b...</b>",K:0,1n:3c,L:[],1C:{},2f:9(t,d){m e=p.3d("q");e.V=t;e.18="7";m f="";f="<q 19=\\"C-D\\">";f+="1D 1E <q 19=\\"C-H\\"><2g 8=u:I W=\\""+6.J[0]+"\\" E=\\"1o\\" /><2g W=\\""+6.J[1]+"\\" E=\\"2h\\" /></q>";f+="</q>";f+="<q 19=\\"C-o\\"></q>";f+="<q 19=\\"C-1p\\"><q 19=\\"C-1a\\" 8=\\"3e: 3f 3g("+6.J[3]+") M 3h 2i-3i;\\"></q>3j</q>";f+="</q>";e.B=f;p.1b("2j").3k(e);m t=p.1b(t);m g=t.3l("q");2k(m i=0;i<g.1F;i++){l(/C-/.X(g[i].18)){t[g[i].18.1G(/C-/,"")]=g[i]}}t.D.z=t;t.1a.z=t;t.H.z=t;t.1H=9(){A U};t.1I=9(){7.1q(6)};t.D.1I=7.1J;t.1a.1I=7.1J;t.H.3m=7.2l;t.1r=9(){7.1r(6)};t.1K=9(){7.1K(6)};t.17=9(){7.17(6)};t.1s=9(w,h){7.1s(6,w,h)};t.Y=9(x,y){7.Y(6,x,y)};t.1t=9(a){7.1t(6,a)};t.1u=9(a){7.1u(6,a)};t.N=9(a,b,c){7.N(6,a,b,c)};6.L[6.L.1F]=t;A t},2m:9(c,t,e,f,g,h,i){m d=7;9 F(a){m b=Z 2n(a+"=([^,]+)","i");A b.X(h)?r(2n.$1):0}l(p.1b(t)==O){t=6.2f(t)}s{t=p.1b(t)}t.1n=c;6.1q(t);t.1s(F("G"),F("1v"));m j=F("2o")?"1w":F("11");m k=F("2o")?"1w":F("M");l(P i!="12"&&i=="3n"&&6.Q==0){l(n.1L&&!n.2p){6.1M(n,9(){3o(9(){t.Y(j,k)},3p)},"N")}s{6.1M(n,9(){t.Y(j,k)},"N")}}t.1t(F("1m"));t.1u(F("3q"));t.8.1N="2q";t.8.u="R";t.o.8.u="R";t.Y(j,k);t.N(e,f,g);l(t.13=="1O"&&t.H.S.E=="1P"){t.H.S.14("W",7.J[0]);t.H.S.14("E","1o");t.13="1Q"}A t},1s:9(t,w,h){t.8.G=1c.1x(r(w),2r)+"v";t.o.8.1v=1c.1x(r(h),15)+"v"},Y:9(t,x,y){6.1y();t.8.11=x=="1w"?6.1d+(6.2s-t.2t)/2+"v":6.1d+r(x)+"v";t.8.M=y=="1w"?6.Q+(6.1R-t.1S)/2+"v":6.Q+r(y)+"v"},1t:9(t,a){t.1p.8.u=a?"R":"I";t.2u=a?1:0},1u:9(t,a){t.o.8.2v=a?"3r":"1T"},N:9(t,a,b,c){l(t.1z){1U("1D 1E 1V 2w 2x, 2y 2i n 2z N 3s 3t. 2A/2B 2C n 2D.");A}m a=a.3u();l(P c!="12"){t.D.S.3v=c}l(a=="3w"){t.o.B=b}s l(a=="q"){m d=p.1b(b);t.o.B=d.1W||d.B;l(!d.1W){d.1W=d.B}d.B="";d.8.u="I"}s l(a=="1e"){t.o.8.2v="1T";l(!t.o.S||t.o.S.3x!="3y"){t.o.B="<1e W=\\"\\" 8=\\"3z:0; 3A:0; G:15%; 1v: 15%\\" 3B=\\"1A-"+t.V+"\\"></1e>"}n.1X["1A-"+t.V].1Y.1G(b)}s l(a=="3C"){6.2E(b,t)}t.o.1Z=a},1J:9(e){m d=7;m t=6.z;d.20=6;m e=n.1f||e;d.2F=e.2G;d.2H=e.2I;d.2J=r(t.2K);d.2L=r(t.2M);d.G=r(t.2t);d.2N=r(t.o.1S);l(t.o.1Z=="1e"){t.8.2O="#3D";t.o.8.1N="1T"}p.2P=d.2Q;p.2R=9(){l(t.o.1Z=="1e"){t.o.8.2O="3E";t.o.8.1N="2q"}d.2S()};A T},2Q:9(e){m d=7;m a=d.20;m e=n.1f||e;d.21=e.2G-d.2F;d.22=e.2I-d.2H;l(a.18=="C-D"){d.2T(a.z,e)}s l(a.18=="C-1a"){d.1m(a.z,e)}A T},1y:9(){m a=p.3F&&!n.2p;m b=p.23&&r(p.23.2U)||3G;6.1g=p.3H=="3I"?p.23:p.3J;6.Q=a?6.1g.3K:n.3L;6.1d=a?6.1g.3M:n.3N;6.2s=a?6.1g.2U:/3O/i.X(3P.3Q)?n.2V:1c.2c(b,n.2V-16);6.1R=a?6.1g.3R:n.3S},24:9(t){6.1y();t.25=r(t.8.11||t.2K)-7.1d;t.2W=r(t.8.M||t.2M)-7.Q;t.2X=r(t.8.G)},2T:9(t,e){t.8.11=7.21+7.2J+"v";t.8.M=7.22+7.2L+"v"},1m:9(t,e){t.8.G=1c.1x(7.G+7.21,2r)+"v";t.o.8.1v=1c.1x(7.2N+7.22,15)+"v"},2l:9(e){m d=7;m a=n.1f?n.1f.3T:e.3U;l(/1o/i.X(a.26("E"))){d.2Y(a,6.z)}s l(/1P/i.X(a.26("E"))){d.1l(a,6.z)}s l(/2h/i.X(a.26("E"))){d.17(6.z)}A T},2Y:9(a,t){7.24(t);a.14("W",7.J[2]);a.14("E","1P");t.13="1O";t.o.8.u="I";t.1p.8.u="I";l(P t.K=="12"){7.K++;t.K=7.K}t.8.11="3V";t.8.G="3W";m b=t.K*10;t.8.M=7.Q+7.1R-t.D.1S*t.K-b+"v"},1l:9(a,t){7.1y();a.14("W",7.J[0]);a.14("E","1o");t.13="1Q";t.8.u="R";t.o.8.u="R";l(t.2u){t.1p.8.u="R"}t.8.11=r(t.25)+7.1d+"v";t.8.M=r(t.2W)+7.Q+"v";t.8.G=r(t.2X)+"v"},17:9(t){27{m a=t.1H()}28(3X){m a=U}3Y{l(P a=="12"){1U("3Z 40 1V 41 42 43 44 \\"1H\\" 1f 45");m a=U}}l(a){l(t.13!="1O"){7.24(t)}l(n.1X["1A-"+t.V]){n.1X["1A-"+t.V].1Y.1G("46:47")}s{t.o.B=""}t.8.u="I";t.1z=U}A a},29:9(a,b){l(!a){A}l(a.1B&&a.1B[0]){l(P a.1B[0].1h=="48"){a.1B[0].1h=b*15}s{a.8.49="4a(1h="+b*15+")"}}s l(P a.8.2Z!="12"){a.8.2Z=b}s l(P a.8.1h!="12"){a.8.1h=b}},1q:9(t){t.1n++;t.8.4b=t.1n;t.1z=T;6.29(6.1C.D,0.5);6.29(t.D,1);6.1C=t},1r:9(t){l(t.1z){1U("1D 1E 1V 2w 2x, 2y 4c 2z 1r. 2A/2B 2C n 2D.");A}l(t.25){7.1l(t.H.S,t)}s{t.8.u="R"}6.1q(t);t.13="1Q"},1K:9(t){t.8.u="I"},2E:9(a,t){m b=T;m c="";l(n.30){b=Z 30}s l(n.2a){27{b=Z 2a("4d.31")}28(e){27{b=Z 2a("4e.31")}28(e){}}}s{A T}t.o.B=6.2e;b.4f=9(){7.32(b,t)};l(6.2d){c=a.33("?")!=-1?"&"+(Z 34).35():"?"+(Z 34).35()}b.2m("4g",a+c,U);b.4h(O)},32:9(a,t){l(a.4i==4&&(a.4j==4k||n.1Y.4l.33("4m")==-1)){t.o.B=a.4n}},2S:9(){7.20=O;p.2P=O;p.2R=O},1M:9(a,b,c){m c=n.2b?c:"4o"+c;l(a.2b){a.2b(c,b,T)}s l(a.1L){a.1L(c,b)}},36:9(){2k(m i=0;i<7.L.1F;i++){7.L[i].D.z=7.L[i].1a.z=7.L[i].H.z=O}n.4p=O}};p.4q("<q V=\\"2j\\"><37 8=\\"u:I\\">.</37></q>");n.4r=7.36;',62,276,'||||||this|dhtmlwindow|style|function||||||||||||if|var|window|contentarea|document|div|parseInt|else||display|px||||_parent|return|innerHTML|drag|handle|title|getValue|width|controls|none|imagefiles|minimizeorder|tobjects|top|load|null|typeof|scroll_top|block|firstChild|false|true|id|src|test|moveTo|new||left|undefined|state|setAttribute|100||close|className|class|resizearea|getElementById|Math|scroll_left|iframe|event|standardbody|opacity|vbasepath|windowfiles|gif|restore|resize|zIndexvalue|Minimize|statusarea|setfocus|show|setSize|isResize|isScrolling|height|middle|max|getviewpoint|isClosed|_iframe|filters|lastactivet|DHTML|Window|length|replace|onclose|onmousedown|setupdrag|hide|attachEvent|addEvent|visibility|minimized|Restore|fullview|docheight|offsetHeight|hidden|alert|has|defaultHTML|frames|location|datatype|etarget|distancex|distancey|documentElement|rememberattrs|lastx|getAttribute|try|catch|setopacity|ActiveXObject|addEventListener|min|ajaxbustcache|ajaxloadinghtml|init|img|Close|no|dhtmlwindowholder|for|enablecontrols|open|RegExp|center|opera|visible|150|docwidth|offsetWidth|resizeBool|overflow|been|closed|so|to|Open|Create|the|again|ajax_connect|initmousex|clientX|initmousey|clientY|initx|offsetLeft|inity|offsetTop|contentheight|backgroundColor|onmousemove|getdistance|onmouseup|stop|move|clientWidth|innerWidth|lasty|lastwidth|minimize|MozOpacity|XMLHttpRequest|XMLHTTP|ajax_loadpage|indexOf|Date|getTime|cleanup|span|Loading|Page|Please|wait|5000|createElement|background|transparent|url|right|repeat|vBase|appendChild|getElementsByTagName|onclick|recal|setTimeout|400|scrolling|auto|contents|into|toLowerCase|nodeValue|inline|tagName|IFRAME|margin|padding|name|ajax|F8F8F8|white|all|100000|compatMode|CSS1Compat|body|scrollTop|pageYOffset|scrollLeft|pageXOffset|Safari|navigator|userAgent|clientHeight|innerHeight|srcElement|target|10px|200px|err|finally|An|error|occured|somwhere|inside|your|handler|about|blank|number|filter|alpha|zIndex|nothing|Msxml2|Microsoft|onreadystatechange|GET|send|readyState|status|200|href|http|responseText|on|onload|write|onunload'.split('|'),0,{}));
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
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="+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}}}}();;
