function wait(millis) {
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); } 
	while(curDate-date < millis);
} 



function changeButton(b,p){
	var button="button".concat(b);
	button_over=button.concat("_over.jpg");
	document.images[button].src= p.concat(button_over);
	
			
	return true;
}

function changeButtonBack(b,p){
	var button="button".concat(b);
	button_back=button.concat(".jpg");
	document.images[button].src= p.concat(button_back);
			
	return true;
}

var tipobj;

function initial(){
	if (!tipobj) tipobj = getElem("dhtmltooltip");
}

//functii folosite la efectul hiver asupra panoului
/////////////////////////////////////////////////////////////////
function getElem(elemID){
	var obj;
	if (document.all){
		obj = document.all(elemID)
	}else if (document.getElementById){
		obj = document.getElementById(elemID)
	}else if (document.layers){
		obj = document.layers[elemID]
	}
	return obj;
}



var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip=false;

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


var panou;
	
/////////////////////////////////////////////////////////////
function ddrivetip(panel, title){
	p=panel;
	panou=panel;
	panou="panel".concat(panou);
	initial();
	thetext = '<img src=../utils/panels/panel'+panel+'.jpg />';
	if (ns6||ie){
		
		tipobj.innerHTML=thetext+'<div id="title_panel"><span class="text_alb">'+title+'</span></div>';
		
		enabletip=true;
		
		
		
		
		return false;
	}
}
var p=0;
function ddrivetipavailable(panel, title){
	p=panel;
	panou=panel;
	panou="panel".concat(panou);
	initial();
	thetext = '<img src=../utils/samplepictures/available.jpg />';
	if (ns6||ie){
		tipobj.innerHTML=thetext+'<div id="title_panel"><span class="text_alb">'+title+'</span></div>';
		enabletip=true;
		return false;
	}
}

function ddrivetipreserved(panel, title){
	p=panel;
	panou=panel;
	panou="panel".concat(panou);
	initial();
	thetext = '<img src=../utils/samplepictures/reserved.jpg />';
	if (ns6||ie){
		tipobj.innerHTML=thetext+'<div id="title_panel"><span class="text_alb">'+title+'</span></div>';
		enabletip=true;
		return false;
	}
}


/////////////////////////////////////////////////////////////
function positiontip(e){
	if (enabletip){
		
   		var IE = document.all?true:false;
		var event = e? e:window.event;
       
		if(IE){
			//pos_x=event.clientX-document.getElementById(panou).offsetLeft;
			//pos_y=event.clientY-document.getElementById(panou).offsetTop;
			pos_x=event.clientX+document.documentElement.scrollLeft;
			pos_y=event.clientY+document.documentElement.scrollTop;
		}
		else{
			pos_x=e.pageX;
			pos_y=e.pageY;
		}
		
		if (p<=50){
			var x=-220;
			var y=-55;
		}
		else{
			var x=-220;
			var y=-220;
		}
		//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=pos_x+x+"px";
		
		//same concept with the vertical position
			tipobj.style.top=pos_y+y+"px";
		tipobj.style.visibility="visible";
	}
}

/////////////////////////////////////////////////////////////
function hideddrivetip(){
	if (ns6||ie){
		enabletip=false;
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
//		tipobj.style.backgroundColor='';
		tipobj.style.width='';
		}
}

document.onmousemove=positiontip