function ShowDatePicker(arg, window, dFormat, dSeparator, templatePath, scriptPath, cssPath, lang)
{
	var argument		= new Object();
	argument.arg		= arg;
	argument._window	= window;
	argument.cssPath	= cssPath;
	window.showModalDialog((templatePath != null ? templatePath : '') + 'DatePicker.aspx?dFormat=' + dFormat + '&dSeparator=' + dSeparator + '&scriptPath=' + scriptPath + '&lang=' + lang + '&GUID=' + (parseInt(Math.random()*10000000000000000).toString()+parseInt(Math.random()*10000000000000000).toString()),argument,'dialogWidth=205px;dialogHeight=220px;center:Yes;edge:Raised;status:No;help:No;unadorned:yes');
}

function ConfirmDialog(msg, subDirPath) 
{
	return window.showModalDialog(subDirPath + 'CommonLibrary/Dialogs/ConfirmDialog.aspx',msg,'dialogWidth:400px;dialogHeight:170px;status:no;help:no') == true ? true : false;
}

function OpenChangePasswordWindow(UserID, SubDirPath) 
{
	window.open(SubDirPath + 'ChangePassword.aspx?UserID=' + UserID,'ChangePassword','width=500,height=200,left=' + ((screen.availWidth-500)/2) + ',top=' + ((screen.availHeight-200)/2) + ',menu=no,status=no');
}

function OpenUserDataWindow(action, UserID) 
{
	window.open('UserData.aspx?Action=' + action + (UserID ? '&UserID=' + UserID : ''),'UserData','width=500,height=300,left=' + ((screen.availWidth-500)/2) + ',top=' + ((screen.availHeight-300)/2) + ',menu=no,status=no');
}

function OpenHelpWin(URL, width, height) 
{
	window.open(URL, 'DataInd_Help', 'width=' + width + ',height=' + height + ',left=' + ((screen.availWidth-width)/2) + ',top=' + ((screen.availHeight-height)/2) + ',menu=no,status=no');
}

function OpenApplicationsWin(ProfileID) 
{
	window.open('PendingApplications.aspx?ProfileID=' + ProfileID,'PendingApp','width=1020,height=600,left=' + ((screen.availWidth-1020)/2) + ',top=' + ((screen.availHeight-600)/2) + ',menu=no,status=no');
}

function OpenProfileDetailsWin(ProfileID) 
{
	window.open('ProfileDetails.aspx?ProfileID=' + ProfileID,'ProfileDetails','width=1020,height=700,left=' + ((screen.availWidth-1020)/2) + ',top=' + ((screen.availHeight-700)/2) + ',menu=no,status=no,scroll=yes');
}

function OpenAFWindow(ProfileID, JobID) 
{
	window.open('ApplicationForm.aspx?ProfileID=' + ProfileID + '&JobID=' + JobID,'AFWin','width=1020,height=700,left=' + ((screen.availWidth-1020)/2) + ',top=' + ((screen.availHeight-700)/2) + ',menu=no,status=no');
}

function OpenIDWindow(ProfileID, JobID) 
{
	window.open('InterviewDate.aspx?ProfileID=' + ProfileID + '&JobID=' + JobID,'IDWin','width=550,height=280,left=' + ((screen.availWidth-550)/2) + ',top=' + ((screen.availHeight-280)/2) + ',menu=no,status=no');
}

function ShowJobDetail(JobID)
{
	if (document.getElementById(JobID).style.display == 'none')
		document.getElementById(JobID).style.display = 'inline';
	else
		document.getElementById(JobID).style.display = 'none';
}

function ShowDIV(DIVID)
{
	if (document.getElementById(DIVID).style.display == 'none')
		document.getElementById(DIVID).style.display = 'inline';
	else
		document.getElementById(DIVID).style.display = 'none';
}

function OpenWindow2(URL, IsModal, WinName, WinWidth, WinHeight, IsCentered, HasMenu, HasStatusBar) 
{
	if (!IsModal)
		window.open(URL, WinName, 'width=' + WinWidth + ',height=' + WinHeight + ',' + (IsCentered ? 'left=' + ((screen.availWidth-WinWidth)/2) + ',top=' + ((screen.availHeight-WinHeight)/2) : '') + ',menu=' + (HasMenu ? 'yes' : 'no') + ',status=' + (HasStatusBar ? 'yes' : 'no'));
}

function DeclineAppConfirmDialog(hc) 
{
	return window.showModalDialog('DeclineApplication.aspx',hc,'dialogWidth:580px;dialogHeight:350px;status:no;help:no') == true ? true : false;
}

function urlEncode(str)
{
	var s = '',c;
	for(var i=0;i<str.length;i++) {
		c = str.substr(i,1);
		switch(c) {
			case '<': s = s + '%3C';break;
			case '>': s = s + '%3E';break;
			case ' ': s = s + '%20';break;
			case '#': s = s + '%23';break;
			case '$': s = s + '%24';break;
			case '?': s = s + '%3F';break;
			case '!': s = s + '%21';break;
			case '.': s = s + '%2E';break;
			case ':': s = s + '%3A';break;
			case ';': s = s + '%3B';break;
			case '-': s = s + '%2D';break;
			case '+': s = s + '%2B';break;
			case '"': s = s + '%22';break;
			case '/': s = s + '%2F';break;
			case '\\': s = s + '%5C';break;
			case '&': s = s + '%26';break;
			case '*': s = s + '%2A';break;
			case '=': s = s + '%3D';break;
			case '(': s = s + '%28';break;
			case ')': s = s + '%29';break;
			default : s = s + encodeURI(c);
		}	
	}
	return s;	
}

function limitImageSize(id, maxWidth, maxHeight) 
{
	if (document.getElementById(id)) 
	{
		if (maxWidth) 
			if (document.getElementById(id).width > maxWidth) 
				document.getElementById(id).width = maxWidth;
		if (maxHeight) 
			if (document.getElementById(id).height > maxHeight) 
				document.getElementById(id).height = maxHeight;
	}	
}

// Macromedia Functions
function MM_swapImgRestore()  //v3.0
{
	var i,x,a=document.MM_sr; 
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
		x.src=x.oSrc;
}

function MM_preloadImages()  //v3.0
{
	var d=document; 
	if(d.images)
	{ 
		if(!d.MM_p) 
		d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0)
			{ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
	}
}

function MM_findObj(n, d)  //v4.01
{
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++)	
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

function MM_swapImage() //v3.0
{
	var i,j=0,x,a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null)
		{
			document.MM_sr[j++]=x; 
				if(!x.oSrc) 
					x.oSrc=x.src; 
				x.src=a[i+2];
		}
}