// JavaScript Document

if (location.host=='localhost') 
{
	currentPath = document.location.href.split('/');
	var HttpPath = 'http://'+location.host+'/'+currentPath[3]+'/';
}
else 
{
	var HttpPath = 'http://'+location.host+'/';
}


function getRand() {
	return randomnumber=Math.floor(Math.random()*10000001);
}

function resizewin(thediv,wt) {
	document.getElementById(thediv).style.width = wt+'px';
}

function goModal(thisAction) {
	if(thisAction) {
		$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); 
		//Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies 
	}
	if (thisAction==0) {
		$('#fade').fadeOut();
	}
}
function openPopup(thediv) {
	resizewin('popupbox',450);
//	$.blockUI({ message: null });
	document.getElementById(thediv).style.visibility = 'visible';
if (document.getElementById('needhiding')) {
	document.getElementById('needhiding').style.visibility = 'hidden';
}
	document.getElementById(thediv).style.left = '0px';
	document.getElementById(thediv).style.top = '-60px';
//	document.getElementById('blanket').style.visibility = 'visible';
	goModal(1);
}



function closePopup(thediv) {
//	document.getElementById(thediv).innerHTML= '';//
if (document.getElementById('popupboxContent')) {
	document.getElementById('popupboxContent').innerHTML= '';
}
	document.getElementById(thediv).style.visibility = 'hidden';
//	document.getElementById('blanket').style.visibility = 'hidden';
//	$.unblockUI();
	goModal(0);

	resizewin('popupbox',450);
if (document.getElementById('needhiding')) {
	document.getElementById('needhiding').style.visibility = 'visible';
}
}

function timesheet_updateTimesheet(timesheetID,we) {
    $("#popupboxContent").load('../candidate/updateTimesheet.cfm?timesheetID='+escape(timesheetID)+'&we='+escape(we)+'&pid='+getRand())
//	alert(HttpPath);
	openPopup('popupbox');
	resizewin('popupbox',950);
}

function timesheet_editNote(noteID) {
    $("#popupboxContent").load('../candidate/editNote.cfm?noteId='+escape(noteID)+'&pid='+getRand())
//	alert(HttpPath);
	openPopup('popupbox');
	resizewin('popupbox',550);
}


