/*

*/

function w(strPage,iHeight,iWidth)
{
	imgWindow = window.open(strPage,'Preview','width=' + iWidth + ',height=' + iHeight + ',resizable,scrollbars');	
	//imgWindow.parWindow = parent;
	imgWindow.focus();
}

function doSearch(cbo,tbo)
{
	if (tbo.value != "")
	{
		var item,i;
		var sText = tbo.value.toLowerCase();
		
		for (i=0;i<cbo.length;i++)
		{
			item = cbo.options[i].text;
			//if the item is shorter or equal to the text
			if (!item.length <= sText.length)
			{
				if (item.substr(0,sText.length).toLowerCase() == sText)
				{
					cbo.selectedIndex = i;
					break;
				}
			}
		}
	}
}

/*save add load event function*/
	function addLoadEvent(func) {
		var oldonload = window.onload;
		
  		if (typeof window.onload != 'function') {
  		  window.onload = func;
	  } else {
	    window.onload = function() {
	      oldonload();
	      func();
	    }
	  }
	  
	  
	}
	
function setAction(strAction)
{
	document.form.action = strAction;
	document.form.submit();
}

var previousStyle;

function tableruler(){
	
	//set the hand type
 	if (navigator.appName.indexOf("Microsoft")!=-1)
 		handType = 'hand';
 	else
 		handType = 'pointer';
	
	if (document.getElementById && document.createTextNode){
	   var tables=document.getElementsByTagName('table');
	   for (var i=0;i<tables.length;i++){
		   if(tables[i].className.indexOf('ruler') != -1){
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++){
					if(trs[j].parentNode.nodeName=='TBODY' && trs[j].parentNode.nodeName!='TFOOT'){
						
						 if (trs[j].onclick){
						 	var tds=trs[j].getElementsByTagName('td');
							for(var k=0;k<tds.length;k++){
								if (!tds[k].onmouseover)
									tds[k].onmouseover=function(){this.style.cursor=handType;};
							}
							
						 }
						
						trs[j].onmouseover=function(){previousStyle=this.className;this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className=previousStyle;return false}
					}
				}
			}
			if(tables[i].className.indexOf('stripe') != -1)
				stripe(tables[i]); //call the strip function
		}
	}
}

  // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
	  //if (obj.getAttribute("class") != null) {
     //    result = obj.getAttribute("class");
     //}

	  return (obj.className != '');
  }   

 function stripe(table) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenStyle = arguments[1] ? arguments[1] : "altOne";
    var oddStyle = arguments[2] ? arguments[2] : "altTwo";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    //var table = document.getElementById(id);
    //if (! table) { return; }
	 
	 hasClass(table);
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");
	 
    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
	 
	     
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {
		
		  // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
				
				trs[i].className = even ? evenStyle : oddStyle;
 		   /*
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
          			 
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }*/
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }