// preload images
// simplePreload( '01.gif', '02.gif' );
function simplePreload(){
  	 var args = simplePreload.arguments;
  	 document.imageArray = new Array(args.length);
  	 for(var i=0; i<args.length; i++)
  	 {
    	 document.imageArray[i] = new Image;
    	 document.imageArray[i].src = args[i];
  	 }
}
	 
// switch images
// switchImage( 'nomeImg', '01.gif' );
function switchImage(imgName, imgSrc){
	if (document.images){
		if (imgSrc != ''){
		 document.images[imgName].src = imgSrc;
		}
	}
}

// validate forms
// check('formName');
function check(frm){
	if(validate(document.forms[frm])){
	  document.forms[frm].submit();
	}
}

function returnSelection(radioButton) {
	var selection=null;
	for(var i=0; i<radioButton.length; i++) {
		 if(radioButton[i].checked) {
		   selection=radioButton[i].value;
		   return selection;
		 }
	}
	return selection; 
} 

// function open pop-up
function openWindow(mypage,myname,w,h){ 
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; 
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition;
	win = window.open(mypage,myname,settings) 
	if(win.window.focus){
		win.window.focus();
	} 
} 

// function show/hidden <P></P>
// blocking('div1');
function blocking(nr){
	if( document.tmp.div.value != '' && document.tmp.div.value != nr ){
		document.getElementById(document.tmp.div.value).style.display = 'none';
	}
	
	view = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
	document.getElementById(nr).style.display = view;

	document.tmp.div.value = nr;
}

