// THIS IS A STANDARD JAVASCRIPT FILE USED FOR CDMS INTERNATIONAL
// THIS DECLARES ALL THE REGULAR EXPRESSIONS THAT WE WILL BE USING
// FOR VALIDATION FUNCTIONS.

var regWhitespace                = /^\s+$/;
var regLetter                    = /^[a-zA-Z]$/;
var regAlphabetic                = /^[a-zA-Z]+$/;
var regAlphanumeric              = /^[a-zA-Z0-9]+$/;
var regDigit                     = /^\d/;
var regLetterOrDigit             = /^([a-zA-Z]|\d)$/;
var regInteger                   = /^\d+$/;
var regEmail                     = /^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$/;
var regHnW                       = /^\d+\.\d{4}$/;
var digits                       = "0123456789";
var lowercaseLetters             = "abcdefghijklmnopqrstuvwxyz";
var uppercaseLetters             = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var whitespace                   = " \t\n\r";
var phoneNumberDelimiters        = "()- ";
var validUSPhoneChars            = digits + phoneNumberDelimiters;
var validWorldPhoneChars         = digits + phoneNumberDelimiters + "+";
var SSNDelimiters                = "- ";
var validSSNChars                = digits + SSNDelimiters;
var digitsInSocialSecurityNumber = 9;
var digitsInUSPhoneNumber        = 10;
var ZIPCodeDelimiters            = "-";
var ZIPCodeDelimeter             = "-";
var validZIPCodeChars            = digits + ZIPCodeDelimiters;
var digitsInZIPCode1             = 5;
var digitsInZIPCode2             = 9;
var creditCardDelimiters         = " ";
var mPrefix                      = "THE FOLLOWING FIELD NEEDS A VALUE\n\n";
var mSuffix                      = "\n\nPLEASE ENTER A VALUE.\n";

function isEmpty(s)       { return ((s == null) || (s.length == 0)) }

function isWhitespace (s) { return (isEmpty(s)  || regWhitespace.test(s)); }

function warnEmpty (theField, s) { 
	theField.focus();
	cName = convert_name(s);
	alert('EMPTY:\n' + mPrefix + cName + mSuffix);
}

function warnInvalid (theField, s) {   
	theField.focus();
    theField.select();
    alert('INVALID:' + s);
}

if (document.images) {


}

function convert_name (s) {
	var v;
   if (s == 'NAME')          { v = 'Name'; }
   if (s == 'TITLE')         { v = 'Title'; }
   if (s == 'FNAME')         { v = 'First Name'; }
   if (s == 'LNAME')         { v = 'Last Name'; }
   if (s == 'HANDLE')        { v = 'User ID'; }
   if (s == 'EMAIL')         { v = 'Email Address'; }
   if (s == 'PASSWD')        { v = 'Password'; }
   if (s == 'PHONE')         { v = 'Phone Number'; }
   if (s == 'REQUIRED_RESP') { v = 'Responsible Employee'; }
   if (s == 'MESSAGE')       { v = 'Message or Note Field'; }
   if (s == 'SERIALNUM')     { v = 'Model/Serial Number'; }
	{
	}
	return v;
}

function validate(form) {
 var valid = true;

 for (i=0;i<form.length;i++) {
 		var tempobj=form.elements[i];
		if (tempobj.name.substring(0,9)== "required_") {
			shortFieldName=tempobj.name.substring(9,30).toUpperCase();
			// THIS IS TO CHECK TEXT BOXES AND TEXTAREA
			if (tempobj.type == 'text' || tempobj.type == 'textarea' || tempobj.type == 'hidden' || tempobj.type == 'password') {
			    if (isWhitespace(tempobj.value)) { 
					if (tempobj.type == 'hidden') { alert(mPrefix + 'Hidden' + mSuffix);valid = false; break; }
					warnEmpty(tempobj,shortFieldName); valid = false; break; }
			}
			//  THIS IS TO CHECK SELECT BOXES THAT ARE NOT SET TO THE FIRST OPTION
			if (tempobj.type.toString().charAt(0)=="s"&& tempobj.selectedIndex==0) { 
		     FieldName = tempobj.name.substring(0,30).toUpperCase();
			 cName = convert_name(FieldName);
		     alert(mPrefix + cName + mSuffix);
		     valid = false;
		     break;
            }
		}
  }

   if (!valid) { form.returnValue = false; } else { form.submit(); }

} // CLOSING THE VALIDATE FUNCTION

function verify_date(fld)
{ // tenacious phone # correction
  if(!fld.value) return true; // blank fields are the domain of validate function
   var val = fld.value.replace(/[a-zA-Z]/g,''); // replace all non-numeric characters
       val = val.replace(/[\(\)\.\-\s\/]/g, '');

   if (val.length == 8)
   {
	fld.value = val.substring(0,2) + '/' + val.substring(2,4) + '/' + val.substring(4,8)
    return true;
   }
    fld.value = '';
	alert('DATES are filled in with MM/DD/YYYY');
	fld.focus();
	fld.select();
    return false;
}


function verify_postal_code(fld)
{ // tenacious phone # correction
  if(!fld.value) return true; // blank fields are the domain of validate function
   var val = fld.value.replace(/[a-zA-Z]/g,''); // replace all non-numeric characters
       val = val.replace(/[\(\)\.\-\ ]/g, '');

   if (val.length == 5)
   {
    fld.value= val;
    return true;
   }

   if (val.length == 9)
   {
	fld.value = val.substring(0,5) + '-' + val.substring(5,9)
    return true;
   }
    fld.value = '';
	alert('The postal code is invalid');
	fld.focus();
	fld.select();
    return false;
}


function verify_phone(fld)
{ // tenacious phone # correction
  if(!fld.value) return true; // blank fields are the domain of validate function
  
  var val = fld.value.replace(/[a-zA-Z]/g,''); // replace all non-numeric characters
      val = val.replace(/[\(\)\.\-\ ]/g, '');

  if(val.length == 7)
  {
    fld.value= '(xxx)' + val.substring(0,3) + '-' + val.substring(3,20);
    return true;
  }

  if(val.length == 10)
  {
      fld.value= '(' + val.substring(0,3) + ')' +
      val.substring(3,6) + '-' + val.substring(6,20);
    return true;
  }

  fld.value = val;
  alert('The phone number you supplied for the ' + fld.name + ' field was incorrect.\nFORMAT: (NNN)NNN-NNNN');
  fld.focus();
  return false;
}

function verify_email (fld) {

	if (regEmail.test(fld.value))	{
	} else {
	fld.value = '';
	alert('Invalid Email Format:\n\nProper Format:\n\nxxxx@xxxx.com\n\nAccepted Domains:\ncom\norg\nws\nnet\nbiz\nbz\ngov\ntv\ncc\ninfo\n\n');
    fld.focus();
    fld.select();
    }
}

function verify_HnW (fld) {

	if (regHnW.test(fld.value))	{
	} else {
	fld.value = '0.0000';
	alert('Invalid Value: Valid Values are\n\n 0.0000\n\n');
    fld.focus();
    fld.select();
    }
}


function spac_tran (fld) {
  var val = fld.value.replace(/\s+/g, '');
  fld.value = val;
}

function checknumberday(field, i) {
	if (i == 0) { 
		if (field[0].checked == true) {
			field[1].checked = false;
			var h = 10 ;  
			document.pickform.days.value = h  
		}
	}
	else {  
		if (field[1].checked == true) {
			field[0].checked = false;
			var nHistory = pickform.days.value ; 
			if ((nHistory >60 ) || (nHistory == 0)) {
				alert("You must specify a number between 0 and 60 days.");
				return false;
			}
		}
	}
}

function checkview(field, i) {
	if (i == 2) { 
		if (field[2].checked == true) {
			field[3].checked = false;
			pickform.WAA_FORM.value = "custlog"; 
		}
	}
	else { 
		if (field[3].checked == true) {
			field[2].checked = false;
			pickform.WAA_FORM.value =  "viewlog"; 
		}
	}
}


// function that displays status bar message

function dm(msgStr) {
  document.returnValue = false;
  if (document.images) { 
     window.status = msgStr;
     document.returnValue = true;
  }
}
// functions that swap images

function di(id,name){
  if (document.images) document.images[id].src=eval(name+".src");
}

function isZIPCode (theField) {
   var s = theField.value;
   if (isInteger(s) && ((s.length == digitsInZIPCode1) || (s.length == digitsInZIPCode2))) { return true;}
   warnInvalid(theField,'Zip Code Malformed');
}

function isInteger (s) {   
	return regInteger.test(s)
}


// ================================================================
function move() {
    for (var Current=0;Current < document.add_members.list1.options.length;Current++) {
        if (document.add_members.list1.options[Current].selected) {
            var defaultSelected = true, selected = true;
            var optionName = new Option(document.add_members.list1.options[Current].value, document.add_members.list1.options[Current].text, defaultSelected, selected)
            if (replacedfirst)
                var length = document.add_members.list2.length;
            else
                var length = 0;
            document.add_members.list2.options[length] = optionName;
            replacedfirst = true;
        }
    }
}

var replacedfirst = false;

function RemoveOptions() {
  field=document.add_members.list2   //Your selectbox
  for( i=field.length-1; i>=0; i--) {	
    if(field.options[i].selected) {
    
       field.options[i] = null;	
    }
  }
}
// =========================== END OF FILE
// var msgWindow = null;

function newWindow(file,window,wid,hei) {
	var wtop  = (screen.height - hei) / 2;
    var wleft = (screen.width - wid) / 2;
   // if (msgWindow != null) { msgWindow.close(); } 
    msgWindow=open(file,window,"toolbar=yes,resizable=yes,scrollbars=yes,width=" + wid + ",height=" + hei + ",top=" + wtop + ",left=" + wleft + ",screenX=" + wleft + ",screenY=" + wtop);
	msgWindow.focus();
	//toolbar=no,menubar=no
    if (msgWindow.opener == null) msgWindow.opener = self;
}

//
// ************************
// layer utility routines *
// ************************

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

// ********************************
// application-specific functions *
// ********************************

// store variables to control where the popup will appear relative to the cursor position
// positive numbers are below and to the right of the cursor, negative numbers are above and to the left
var xOffset = 30;
var yOffset = -5;

function showPopup (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;
	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup

function hideCurrentPopup() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup



// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}

function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj

function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

// 11/11/2002 - THE FOLLOWING FUNCTION HAS BEEN ADDED
// THIS ALLOWS FOR MOUSEOVER ALT TAGS AND EXPANDABLE 
// SECTIONS.

function toggle(img, node) {
    var target = document.getElementById(node);
    if (target.style.display == "none") {
    target.style.display = "block";
    img.src = "images/openfolder.gif";
    } else {
     target.style.display = "none";
     img.src = "images/closedfolder.gif";
    }
}

// ==================================================

function explorerMacResizeFix () {
    location.reload(false);
}


function currencyFormat(fld, milSep, decSep, e) {
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;  // Enter
key = String.fromCharCode(whichCode);  // Get key value from key code
if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
len = fld.value.length;
for(i = 0; i < len; i++)
if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
aux = '';
for(; i < len; i++)
if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
aux += key;
len = aux.length;
if (len == 0) fld.value = '';
if (len == 1) fld.value = '0'+ decSep + '0' + aux;
if (len == 2) fld.value = '0'+ decSep + aux;
if (len > 2) {
aux2 = '';
for (j = 0, i = len - 3; i >= 0; i--) {
if (j == 3) {
aux2 += milSep;
j = 0;
}
aux2 += aux.charAt(i);
j++;
}
fld.value = '';
len2 = aux2.length;
for (i = len2 - 1; i >= 0; i--)
fld.value += aux2.charAt(i);
fld.value += decSep + aux.substr(len - 2, len);
}
return false;
}


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 comboItemSelected(oList1,oList2,cType) {
	if (oList2!=null){
 	    alert('oList2 Not Null and need to clear it out');
		clearComboOrList(oList2);
       if (oList1.selectedIndex==-1){
         oList2.options[oList2.options.length] = new Option('SELECT','');
       } else {
	  // fillCombobox(oList2,cType + '=' + oList1.options[oList1.selectedIndex].value);
	   fillCombobox(oList2,cType + oList1.options[oList1.selectedIndex].value);
	   }
	}
}

function listboxItemSelected(oList1,oList2,cType) {
   if (oList2!=null) {
	   clearComboOrList(oList2);
      if (oList1.selectedIndex==-1) {
         oList2.options[oList2.options.length] = new Option('SELECT','');
      } else {
		 fillListbox(oList2,cType + oList1.options[oList1.selectedIndex].value)
		 // fillListbox(oList2,oList1.name + '=' + oList1.options[oList1.selectedIndex].value)
	  }
   }
}

function clearComboOrList(oList) {
   for (var i = oList.options.length-1; i>=0 ; i--) {
	   oList.options[i]=null;
   }
   oList.selectedIndex = -1;
   if (oList.onchange) oList.onchange();
}

function fillCombobox(oList,vValue){
   if (vValue!=''){
	   if (assocArray[vValue]){
		   oList.options[0] = new Option('SELECT','');
		   var arrX = assocArray[vValue];
           for ( var i = 0; i<arrX.length ; i = i+2 ){
			   if (arrX[i]!='EOF') oList.options[oList.options.length] = new Option(arrX[i+1],arrX[i]);
           }
           if (oList.options.length == 1){
			   oList.selectedIndex=0;
			   if (oList.onchange) oList.onchange();
           }
       } else {
		 oList.options[0] = new Option('None Selected','');  
	   }
   }
}

function fillListbox(oList,vValue){
   if (vValue!=''){
	   if (assocArray[vValue]){
		   var arrX = assocArray[vValue];
	       for ( var i = 0; i<arrX.length ; i = i+2 ){
			   if (arrX[i]!='EOF') oList.options[oList.options.length] = new Option(arrX[i+1],arrX[i]);
           }
           if (oList.options.length == 1){
			   oList.selectedIndex=0;
			   if (oList.onchange) oList.onchange();
           }
       } else {
		 oList.options[0] = new Option('None Selected','');  
	   }
   }
}

//Pop-it menu- By Dynamic Drive

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]= '<div class="menutitle">Profiles</div>'
linkset[0]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVPROFSUBS">My&nbsp;Subs</a></div>'
linkset[0]+='<div class="menutitle">My Profile</div>'
linkset[0]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVMYPROF">Overview</a></div>'
linkset[0]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVMYPROF&PAGE=2">Statistics</a></div>'
linkset[0]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVMYPROF&PAGE=3">References</a></div>'
linkset[0]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVMYPROF&PAGE=4">Locations</a></div>'

linkset[1]= '<div class="menutitle">Projects</div>'
linkset[1]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVHOME&PRJPG=1">My Projects</a></div>'
linkset[1]+='<div class="menuitems"><a href="/scripts/cdmgate.exe?WAA_PACKAGE=CDMSI&WAA_FORM=BVHOME&PRJPG=2">BidVantage Projects</a></div>'



////No need to edit beyond here

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers

function showmenu(e,which){

if (!document.all&&!document.getElementById&&!document.layers)
return

clearhidemenu()

menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

if (ie4||ns6)
menuobj.innerHTML=which
else{
menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
menuobj.document.close()
}

menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
eventX=ie4? event.clientX : ns6? e.clientX : e.x
eventY=ie4? event.clientY : ns6? e.clientY : e.y

//Find out how close the mouse is to the corner of the window
var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX

//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight
else
menuobj.thestyle.top=ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY
menuobj.thestyle.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
}

function dynamichide(e){
if (ie4&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
if (ie4||ns6||ns4)
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

function highlightmenu(e,state){
if (document.all)
source_el=event.srcElement
else if (document.getElementById)
source_el=e.target
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
else{
while(source_el.id!="popmenu"){
source_el=document.getElementById? source_el.parentNode : source_el.parentElement
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
}
}
}

function OpenRaidWin(cUrl){
   window.open(cUrl,'catswin','alwaysRaised=1,directories=0,height=600,width=800,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0')
}

function OpenWin(cUrl,w,h){
   window.open(cUrl,'catswin','alwaysRaised=1,directories=0,height='+h+',width='+w+',location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0')
}

function showDiv(doc,img) {
   if(document.getElementById(doc).style.display == 'block') {
      document.getElementById(doc).style.display='none';
      //document.getElementById(img).src='/images/show_more.jpg';
	  document.getElementById(img).src = document.getElementById(img).src.replace('show_less','show_more');
   }else {
      document.getElementById(doc).style.display='block';
      //document.getElementById(img).src='/images/show_less.jpg';
	  document.getElementById(img).src = document.getElementById(img).src.replace('show_more','show_less');
   }
}

function changeTab(cTab) {
   for (var i=0;i<document.getElementsByTagName('div').length;i++) {
      if( document.getElementsByTagName('div')[i].id.match('_data') ) {
         document.getElementsByTagName('div')[i].style.display = 'none';
      }
   }
   for (var i=0;i<document.getElementsByTagName('li').length;i++) {
      if( document.getElementsByTagName('li')[i].id.match('tab') ) {
         document.getElementsByTagName('li')[i].className = '';
      }
   }
   document.getElementById('tab_'+cTab).className = 'current';
   if(document.getElementById('tab_'+cTab+'_data')) {
      document.getElementById('tab_'+cTab+'_data').style.display = 'block';
   }
}

if (ie4||ns6)
document.onclick=hidemenu

function setPerPage(value) {
   var date = new Date();
   var days = 1;
   date.setTime(date.getTime()+(days*24*60*60*1000));
   var expires = "; expires="+date.toGMTString();
   document.cookie = "perpage="+value+expires+"; path=/";
}

