	//upload.js
	function Uploader() 
	{
		if (window.Newwin != undefined)
		{
			if (Newwin.isPopup = true) {
			Newwin.focus();
			} else {
				Newwin=window.open('application/upload.html','NewWin','toolbar=no,status=no,width=400,height=230,top=400,left=300');	
			}
		} else {
			Newwin=window.open('application/upload.html','NewWin','toolbar=no,status=no,width=400,height=230,top=400,left=300');
		}

	}
	
	//Function to determine when the process_upload.php file has finished executing.
	function doneloading(theFile,uid)
	{
		
		obj = window.parent.document.getElementById('setform');
		
		obj.innerHTML = "Thank you. <em>"+theFile+"</em>&nbsp;has been uploaded.<p><input type=\"button\" value=\"Close\" onclick=\"uploadsuccess('"+theFile+"','"+uid+"'); return false;\" />";
	}
	
	function test() 
	{
		var test1 = window.opener.document.getElementById('cv').value;
		alert(test1);
	
	}
	
	function uploadsuccess(theFile,uid) {
	
	window.opener.document.getElementById('guid').value = uid;
	
	window.opener.document.getElementById('cv').value = theFile
		
	window.close();
	}
	
	function uploadimg (theform)
	{
		//Submit the form.
		theform.submit();
		//Then display a loading message to the user.
		setStatus ("Loading...","showimg");
	}
	
	//Function to set a loading status.
	function setStatus (theStatus, theObj)
	{
		obj = document.getElementById(theObj);
		if (obj){
			obj.innerHTML = "<div class=\"bold\">" + theStatus + "</div>";
		}
	}
	
	function changesize (img, sml)
	{
		//The display a loading message to the user.
		theobj = document.getElementById("showimg");
		if (theobj){
			setStatus ("Loading...","showimg");
			var loc = "thumb.php?img=" + img + "&sml=" + sml;
			processajax ("showimg",loc);
		}
	}
	
	function processajax(id,TheUrl)
	{
	$.get(TheUrl, function(data){
 		 //alert(data);
		 	$('#'+id).empty().append(data);

		});	
	}