//1k DHTML API
d=document;l=d.layers;op=navigator.userAgent.indexOf('Opera')!=-1;ff=navigator.userAgent.indexOf('Firefox')!=-1;
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
function sE(e){l?e.visibility='show':e.style.visibility='visible';}
function hE(e){l?e.visibility='hide':e.style.visibility='hidden';}
function sZ(e,z){l?e.zIndex=z:e.style.zIndex=z;}
function sX(e,x){l?e.left=x:op?e.style.pixelLeft=x:e.style.left=x;}
function sY(e,y){l?e.top=y:op?e.style.pixelTop=y:e.style.top=y;}
function sW(e,w){l?e.clip.width=w:op?e.style.pixelWidth=w:e.style.width=w;}
function sH(e,h){l?e.clip.height=h:op?e.style.pixelHeight=h:e.style.height=h;}
function sC(e,t,r,b,x){l?(X=e.clip,X.top=t,X.right=r,X.bottom=b,X.left=x):e.style.clip='rect('+t+' '+r+' '+b+' '+x+')';}
function wH(e,h){if(l){Y=e.document;Y.open();Y.write(h);Y.close();}else e.innerHTML=h;}
function dsE(e){l?e.display='':e.style.display='';}
function dhE(e){l?e.display='none':e.style.display='none';}
//Simple Ajax Call
function xmlhttpPost(strURL, strVal, strDiv, funcCallBack)
{
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest)
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject)
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function()
    {
        if (self.xmlHttpReq.readyState == 4)
        {
            var e = gE(strDiv);
            if (e != null)
            {
                wH(e,self.xmlHttpReq.responseText);
            }
            if (funcCallBack != null)
            {
                funcCallBack(self.xmlHttpReq.responseText);
            }
        }
    }
    self.xmlHttpReq.send(strVal);
}

function formatCurrency(num)
{
    num = num.toString().replace(/\$|\,/g,'');
    if(isNaN(num))num = "0";
    sign = (num == (num = Math.abs(num)));num = Math.floor(num*100+0.50000000001); cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10) cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
         num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
    return (((sign)?'':'-') + '$' + num + '.' + cents);
}
function pop(url, title){window.open (url, title,'left=20,top=20,width=500,height=500,toolbar=1,resizable=1,scrollbars=1');}
function showHelp() {var o = gE('divHelp');if (o != null) dsE(o);};
function hideHelp() {var o = gE('divHelp');if (o != null) dhE(o);};

function shdiv(divid)
{
    var o = gE('shlink_' + divid);
    var i = gE('inp_' + divid);
    var e = gE('div_' + divid);
    if (i!=null)
    {
        if (i.value==1)
        {
            if (e!=null) dhE(e);
            if (o != null) wH(o, 'Show Details');
            i.value = 0;
        }
        else
        {
            if (e!=null) dsE(e);
            if (o != null) wH(o, 'Hide Details');
            i.value = 1;
        }
    }
}


/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function getposOffset(overlay, offsettype)
{
    var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
    var parentEl=overlay.offsetParent;
    while (parentEl!=null)
    {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}

function overlay(curobj, subobjstr, opt_position)
{
    if (document.getElementById)
    {
        var subobj=document.getElementById(subobjstr);
        subobj.style.display=(subobj.style.display!="block")? "block" : "none";
        var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) ;
        var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0);
        subobj.style.left=xpos+"px";
        subobj.style.top=ypos+"px";
        return false;
    }
    else
        return true;
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none";
}

function popPlayer(url) {   mywindow = window.open ("playcmd.php?plist="+url, "akPlayer","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,width=332,height=300"); return mywindow;}
function popWindow(url) {   mywindow = window.open (url, "akHelper","status=0,toolbar=0,location=0,menubar=1,directories=0,resizable=1,scrollbars=1,width=640,height=480"); return mywindow;}
function play(v){popPlayer(v);}
function checkAll(pf){ff=true;ff?firfoxCheckUncheckAll(pf, true):CheckUncheckAll(pf, true)}
function uncheckAll(pf) {ff=true;ff?firfoxCheckUncheckAll(pf, false):CheckUncheckAll(pf, false)}
//hard coded values for formObject
function firfoxCheckUncheckAll(pf, v)
{
	for (var i=0;i<frmSongs.elements.length;i++) {
	    var e = frmSongs.elements[i];
	    if ( (e.name == pf+'song[]') ) {
	      e.checked = v;
	    }
	}
}
function CheckUncheckAll(pf, v)
{
	var field = gE(pf+'song[]');
	for (i = 0; i < field.length; i++) field[i].checked = v ;
}
function limitTA(field, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
}

