function setNav(curentPanel)
{
    $("#navCell").show();
    $("div.nav").hide();
    $(".panelBtn a.cur").removeClass("cur");
    $("#" + curentPanel).show();
    $("#a" + curentPanel).addClass("cur");
}

function loadflash(name, movie, width, height, bgColor)
{
 var custflash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"' + ' width="' + width + '" height="' + height + '" id="' + name + '" align="middle"><param name="movie" ' + ' value="' + movie + '"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <param name="bgcolor" value="' + bgColor + '"#FFFFFF> <embed src="' + movie + '" quality="high"  wmode="transparent" bgcolor="' + bgColor + '" width="' + width + '" height="' + height + '" name="' + name + '" align="middle" type="application/x-shockwave-flash"' + ' pluginspage="http://www.macromedia.com/go/getflashplayer"></object>';  
 document.write(custflash);
}


       function showHelp()
       {
        document.getElementById("help").style.display="block";
        document.getElementById("helpBtn").style.display="none";
        document.getElementById("helpCell").style.width="200px";
       } 

       function hideHelp()
       {
        document.getElementById("help").style.display="none";
        document.getElementById("helpBtn").style.display="block";
            document.getElementById("helpCell").style.width="32px";
   } 
       
        function addTag(listId, ftbId)
        {
            var list = document.getElementById(listId);
            var ftb = document.getElementById(ftbId);
            insertAtCursor(ftb, list.value);
            return false;
        }
        
        function insertAtCursor(myField, myValue) { 
            if (document.selection) 
            { 
                myField.focus(); 
                sel = document.selection.createRange(); 
                sel.text = myValue; 
            } 

            else if (myField.selectionStart || myField.selectionStart == '0') { 

            var startPos = myField.selectionStart; 
            var endPos = myField.selectionEnd; 
            myField.value = myField.value.substring(0, startPos)+ myValue+ myField.value.substring(endPos, myField.value.length); 
            } else { 
            myField.value += myValue; 
            } 
        } 
        
        function tbClear(tb1, tb2)
        {
            document.getElementById(tb1).value="";
            document.getElementById(tb2).value="";
            return false;
        }
        
         function insertFTBImage(tb){
            var url = 'IBrowser.aspx?tb=' + tb + '&ftb=1';
	        var w = 850;
	        var h = 650;
        	
	        var l = (window.screen.availWidth-w)/2; 
	        var t = 8; 
	        window.open(url,tb,'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l + ', status=no, toolbar=no, menubar=no, scrollbars=yes, resizable=yes');
	        return false;
        }
        
         function insertFTBImageCallback(tb, imgURL)
         {
            FTB_API[tb].InsertHtml("<img src='" + imgURL + "'>");
         }

        function IBrowser(tb)
        {
            var url = 'IBrowser.aspx?tb=' + tb + '&url=' + document.getElementById(tb).value;
	        var w = 850;
	        var h = 650;
        	
	        var l = (window.screen.availWidth-w)/2; 
	        var t = 8; 
	        window.open(url,tb,'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l + ', status=no, toolbar=no, menubar=no, scrollbars=yes, resizable=yes');
	        return false;
        }

        function CategoryBrowse(tb)
        {
            var url = 'CategoryBrowse.aspx?tb=' + tb + '&category=' + document.getElementById(tb).value;
	        var w = 850;
	        var h = 400;
        	
	        var l = (window.screen.availWidth-w)/2; 
	        var t = 8; 
	        window.open(url,tb,'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l + ', status=no, toolbar=no, menubar=no, scrollbars=yes, resizable=yes');
	        return false;
        }

        function showHide(elementId)
        {
            var div = document.getElementById(elementId);
            if (div.style.display=="none")
                div.style.display="block";
            else
                div.style.display="none";
        }


        function addStyleTag(listId, ftbId)
        {
            var list = document.getElementById(listId);
            var ftb = document.getElementById(ftbId);
            insertAtCursor(ftb, list.value);
            return false;
        }
        
        function fillTag(tb1name, tb2name)
        {
            var tb1 = document.getElementById(tb1name);
            var tb2 = document.getElementById(tb2name);
            var name = tb1.value;
            
            name = name.toUpperCase().replace(' ', '_').replace(' ', '_').replace(' ', '_').replace(' ', '_').replace(' ', '_').replace(' ', '_');
            name = '[[' + name + ']]';
            tb2.value = name;
        }

        function openWindow(url, w,h)
        {
        	
	        var l = (window.screen.availWidth-w)/2; 
	        var t = 8; 
	        window.open(url,"",'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l + ', status=no, toolbar=no, menubar=no, scrollbars=yes, resizable=yes');
	        return false;
        }
     
        function openWindow2(url, w,h)
        {
        	
	        var l = (window.screen.availWidth-w)/2; 
	        var t = 8; 
	        window.open(url,"",'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l + ', status=no, toolbar=no, menubar=no, scrollbars=yes, resizable=yes');
        }
     
        function selectCbColumn(checkBox, col)
        {
            var table = checkBox.parentElement.parentElement.parentElement;
            var rowsCount = table.rows.length;
            var cb;
            for(i=0;i<rowsCount; i++)
            { 
                try{
                cb=table.rows[i].cells[col].children[0];
                cb.checked=checkBox.checked;
                }catch(ex){}
            }

        }
        
        function onFormSubmit()
        {
        
            document.body.style.cursor = 'wait';

            var f = document.forms[0];
            var inputs = f.getElementsByTagName("input");
            for(var i = 0; i < inputs.length; i++)
            {
                if(inputs[i].type != "submit" && inputs[i].type != "button") 
                inputs[i].readOnly = true;
                else
                inputs[i].className="disabledBtn";
            }
            return true;
            
       }
