/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function buttonMouseOver(name){
    $(name+'Button').className='buttonRollover';
    $(name+'ButtonContent').className='buttonContentRollover';
}
function buttonMouseOut(name){
    $(name+'Button').className='button';
    $(name+'ButtonContent').className='buttonContent';
}
function contractIdCollection(formName, targetFieldId, readFieldPref){
    var valuesForm = $(formName);
    var contrIds="";
    var valuesInputs = valuesForm.getInputs();
    valuesInputs.each(function(s) {
        if(s.id.startsWith(readFieldPref)){
            contrIds=contrIds+s.value+",";
        }
    });
    $(targetFieldId).value=contrIds.substring(0,contrIds.length-1);
}
function smallButtonMouseOver(name){
    $(name+'Button').className='smallButtonRollover';
    $(name+'ButtonContent').className='smallButtonContentRollover';
}
function smallButtonMouseOut(name){
    $(name+'Button').className='smallButton';
    $(name+'ButtonContent').className='smallButtonContent';
}
function checkFormEnterKey (key, formSubmitAction) {
    if ((key.keyCode == 13 && formSubmitAction)) { eval(formSubmitAction.value);}
}

var ns=(document.layers);	// netscape browser
var ie=(document.all);
var w3=(document.getElementById && !ie);
var saf = (navigator.userAgent.indexOf('Safari') != -1);

var waitDiv;
var loadInit = false;
function showLoad() {
    if (loadInit==false) {
        initWaitDiv();
    }
    if (ie || w3){
        waitDiv.display="block";
    }else{
        waitDiv.visibility ="visible";
    }
}
function initWaitDiv(){
    loadInit = true;
    if(!ns && !ie && !w3){
      return;  
    } else if(ie){
        waitDiv=eval('document.all.waitDiv.style');
    }else if(ns){
        waitDiv=eval('document.layers["waitDiv"]');
    }else if(w3){
        waitDiv=eval('document.getElementById("waitDiv").style');
		}
		if (ie || w3){
			waitDiv.visibility="visible";
		}else{
			waitDiv.visibility ="show";
		}

		positionWaitDiv();
	}

function positionWaitDiv(){
		var adTime = 2;
		var adCount=0;
		if(adCount<adTime){
			adCount+=1;
			adTime +=1;

			if (ie){
				documentWidth  =document.body.offsetWidth/2;
				var winShowHeight;
				if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
   					 winShowHeight = document.documentElement.clientHeight;
  				} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
					  winShowHeight = document.body.clientHeight;
 				}
				documentHeight =winShowHeight/2+document.documentElement.scrollTop-20;
			}
			else if (ns){
				documentWidth=window.innerWidth/2+window.pageXOffset-20;
				documentHeight=window.innerHeight/2+window.pageYOffset-20;
			}
			else if (w3){
				documentWidth=self.innerWidth/2+window.pageXOffset-20;
				documentHeight=self.innerHeight/2+window.pageYOffset-20;
			}
			if (w3 && !saf) {
				waitDiv.left = eval(documentWidth-100) + "px";
				waitDiv.top =eval(documentHeight-40) + "px";
			}else if(saf){
				waitDiv.setProperty("left", eval(documentWidth-100) + "px");
				waitDiv.setProperty("top",eval(documentHeight-40) + "px");
			} else {
				waitDiv.left =eval(documentWidth-100);
				waitDiv.top =eval(documentHeight-40);
			}

		if (ie || (w3 && !saf)){
			waitDiv.visibility="visible";
		}else if(saf){
			waitDiv.setProperty("visibility", "visible");
		}else{
			waitDiv.visibility ="show";
		}
		setTimeout("positionWaitDiv()",100);
		}else closeAd();
	}
	function closeAd(){
		if (ie ||(w3 && !saf)){
			waitDiv.display="none";
		}else if(saf){
			waitDiv.setProperty("display", "none");
		}else
			waitDiv.visibility ="hide";
	}
