/*© 1999 Dancecats.com Incorporated. All rights reserved. */
function nothing() 
{
}
function IEsetup()
{
	if(!document.all) return;
	IE5 = navigator.appVersion.indexOf("5.")!=-1;
	if(!IE5) {
		for (i=0;i<document.forms.length;i++) {
			document.forms[i].reset();
		}
	}
}
function setInitialFocus(elName) 
{    
    var el;
    if (document.all)      
    {
        el = document.all[elName];
        if (el)    el.focus();
    }
    else       
    {           
        el = document.forms[0][elName]; 
        if (el) el.focus();
    }
}

function getElement(elName) 
{    
    if (document.all)      
    {
     return document.all[elName];
    }
    else       
    {    
	if (document.forms[0])               
	{
	      return document.forms[0][elName];
	}
    }
}
function getFormNum(formName) 
{
	var formNum =-1;
	for (i=0;i<document.forms.length;i++)
    {
		tempForm = document.forms[i];
		if (tempForm == formName) 
        {
			formNum = i;
			break;
		}
	}
	return formNum;
}

function getFormByName(formName) 
{
    var ofrm = null;
    for (i=0;i<document.forms.length;i++)
    {	
	if (document.forms[i].name == formName)
          {      
            ofrm = document.forms[i];
	    break;
           }
     }
     return ofrm;
}
function getApplet()
{
    appiCityServer = this.document.applets[0];                              
    return appiCityServer;
    
    var  doci = parent;
    for (var i=0; i <6; i++)
    {
        if (doci.navTop != null )
            {            
                appiCityServer = doci.navTop.document.applets[0];                              
                return appiCityServer;            
            }
            else
            {
                doci = doci.parent;                  
            }                 
    }
    
    return null;
}
function selectItem( el, item)
{
    if (el != null) 
    {
        var str = "" + item;
        for (i=0; i<el.options.length; i++) 
        {
            if (el.options[i].text == item )   
                {
                el.options[i].selected = true;                         
                return;    
                }
        }
    }    
}

function fillLb(lbElement, arItems)
{   
arItems.sort();
        with (lbElement) 
        {                
        for(var i = options.length - 1; i > 0; i--) 
            options[i] = null;

        options[0] = new Option(arItems[0], -1); 
        for(i=1; i < arItems.length; i++)
        {
            options[i] = new Option(arItems[i], arItems[i]); 
        }
        options[0].selected = true;
        } 
}
function setCookie(name, value, expires, path, domain, secure) 
{
      var curCookie = name + "=" + escape(value) +
         ((expires) ? "; expires=" + expires.toGMTString() : "") +
         ((path) ? "; path=" + path : "") +
         ((domain) ? "; domain=" + domain : "") +
         ((secure) ? "; secure" : "");

      if ((name + "=" + escape(value)).length <= 4000)
         document.cookie = curCookie;      
      else
         if (confirm("Cookie exceeds 4KB and will be cut!"))
            document.cookie = curCookie;   
}  

function getCookie(name) 
{     
    var prefix = name + "=";
    var cookieStartIndex = document.cookie.indexOf(prefix);
    if (cookieStartIndex == -1)         
        return null;

    var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex +
         prefix.length)      
    if (cookieEndIndex == -1)
         cookieEndIndex = document.cookie.length;
    return unescape(document.cookie.substring(cookieStartIndex +
         prefix.length,   cookieEndIndex)) ;
}
//above = netscape ready
/*
function trimTextFields(doc)
{
    var docInput = doc.all.tags("INPUT");
    var str;    
    
    var re0, re1;    
    re0 = /'/;    
    re1 = /"/;      
    
    var val0, val1;  
    val0 = "&#39;"
    val1 = "&#34;"
    
    for (i=0; i<docInput.length; i++)
    {
        if (docInput(i).type == "text")                 
          {           
            str =  Trim(docInput(i).value);                         
            
            while (-1 != str.search(re0))
                str = str.replace(re0, val0 );
                     
            while (-1 != str.search(re1))            
                str = str.replace(re1, val1 );            
            docInput(i).value = str;           
            
            //Translate the ' -> &#39;
            //Translate the " -> &#34;
          }
    }
}
function Trim( str ) 
{
	var resultStr = "";	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);		
	return resultStr;
}
function TrimLeft( str ) 
{
	var resultStr = "";
	var i = len = 0;
	if (str+"" == "undefined" || str == null)	
		return null;
	str += "";

	if (str.length == 0) 
		resultStr = "";
	else {	
		len = str.length;		
  		while ((i <= len) && (str.charAt(i) == " "))
			i++;
  		resultStr = str.substring(i, len);
  	}
  	return resultStr;
} 
function TrimRight( str ) 
{
	var resultStr = "";
	var i = 0;
	if (str+"" == "undefined" || str == null)	
		return null;

	str += "";	

	if (str.length == 0) 
		resultStr = "";
	else 
   {
  		i = str.length - 1;
  		while ((i >= 0) && (str.charAt(i) == " "))
 			i--;
  		resultStr = str.substring(0, i + 1);
  	}  	
  	return resultStr;  	
} 
*/

var arMonth = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
function WriteMonth(nCalYear, nCalMonth, strStyle)
{
strStyle = "calField";

document.write("<table  border=\"0\"><tbody>")
var temp;

document.write("<th COLSPAN=\"7\" id=\"" + strStyle + "\"><FONT size=1>")
document.write(arMonth[nCalMonth] +" - " + nCalYear) 
document.write("</font></th></tr><tr  id=\"" + strStyle + "\"><td><FONT size=1>S</font></td><td><FONT size=1>M</font></td><td><FONT size=1>T</font></td><td><FONT size=1>W</font></td><td><FONT size=1>T</font></td><td><FONT size=1>F</font></td><td><FONT size=1>S</font></td></tr>");


    var nStartDay, nPrintDay, nLoopDay, nLoopWeek ;
    var calMonth;

    calMonth = new Date(nCalYear, nCalMonth, 1);
    nStartDay  = calMonth.getDay();

    calNextMonth = new Date(nCalYear, nCalMonth +1, 1);
    calNextMonth.setDate(calNextMonth.getDate()-1);
    nLastDay = calNextMonth.getDate();
    
    nPrintDay=1;
        
    for ( nLoopWeek = 0; nLoopWeek  < 6; nLoopWeek++)    
    {
     document.write("<tr>");            
      for ( nLoopDay = 0; nLoopDay  < 7; nLoopDay++)    
        {
        document.write("<td id=\"" +strStyle+ "\"><FONT size=1>");          
        if ((nLoopDay < nStartDay) && ( nLoopWeek == 0))
        { 
            document.write( "&nbsp;" );
        }
        else 
        {
            if ( nLastDay >= nPrintDay ) 
            {
                document.write( nPrintDay++ )            
            } else   document.write( "&nbsp;" )            
        }
        document.write("</font></td>");
       }
    } 
    document.write("</tbody>")
    document.write("</table></font>")
}
function writeCalendar(strStyle)
{     
    var d, y, m, j;    
    d = new Date();          
    //d.setMonth(d.getMonth()-1);    

  document.write("<table border=\"0\" cellPadding=\"0\" cellSpacing=\"0\" width=\"100%\"><tbody><tr>")    
    for (var i= 0; i <2; i++)
    {        
        document.write("<tr >")    
            document.write("<td align = \"center\" valign=\"top\" nowrap><font size = \"1\">")    
            m = d.getMonth();    
            y = d.getYear();  
            WriteMonth(y, m, strStyle);
            d.setMonth(d.getMonth() +1);
            document.write("</font></td>")    
        document.write("</tr>")    
    }
    document.write("</tbody></table>")   
    return(true);
}
function checkSelCount(theForm)
{   
    var chk = theForm["getDetail[]"];   
    var j = 0; 
    if (chk!=null) 
    {   
        if (chk.length!=null)     
        {
            for (i=0; i < chk.length; i++) 
            {            
                if ( chk[i].checked)                    
                      j = j+1;                                    
            }
            if (j > 10) 
            {
                alert ("Please select atmost ten events")
                return false;    
            }
            if (j > 0 )
                return true;                                 
         }   
        else    
        {            
            if ( chk.checked)
                return true;
        }       
    }
    alert ("Please select atleast one event to view")
    return false;    
}
function setupCBO_Partner()
{
    var frm;
    frm = getFormByName("frmInputDC");
    if (frm != null) 
    {	    
            var Opt0 =   frm.iAge.options[frm._age.value ];
            if (Opt0 != null) 
		Opt0.selected = true;         

            var Opt1 =   frm.iEthnicity.options[frm._eth.value ];
            if (Opt1 != null) 
		Opt1.selected = true;         

            var Opt2 =   frm.iHeight.options[frm._ht.value ];
            if (Opt2 != null) 
		Opt2.selected = true;         	
     }
}

function setupCBO_Band()
{
    var frm;
    frm = getFormByName("frmInputDC");
    if (frm != null) 
    {	    
            var Opt0 =   frm.price.options[frm._price.value ];
            if (Opt0 != null) 
	    {
		Opt0.selected = true;         
	    }	
     }
}
function onChangeChannel(theForm)
{
  var strLsn;
  var lbElement = getElement("lsnChannel");
  with (lbElement) 
      {
	 	if (0 <= selectedIndex)
		strLsn = options[selectedIndex].value;
      }          
 if(parent.menuFrame)
 {
 parent.menuFrame.location.href = "/video/menuLeft.php?cmd="+strLsn;
 parent.detailFrame.location.href = "/video/video.php?cmd="+strLsn;
 }else
  {
parent.location = "video/index.php?cmd=" +strLsn;
  }
}

