function print_application (formName)
{
	var myForm    = eval('document.'+formName);
	
	var str = 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=600,height=500'
	var html ='<html>\n<head>\n<link href="styles/common.css" rel="stylesheet" type="text/css">\n<title>Preview Application</title></head>\n';
	html += '<body bgcolor="white" onload="self.print();"> \n';
	
	html += '<table border=0 cellpadding=15 cellspacing=0>\n';
	html += '<tr><td class="body_text2">\n';
	html += '<p><strong>1.	How did you find out about this job opportunity?</strong><br>';
	if (myForm["q0"].value == 'other')
		html += "Other: "+ myForm["q0_other"].value;	
	else
		html += myForm["q0"].value;
	
	if (myForm["referred_by"].value)
	{
		html += "<br>If you were referred by a PTI Employee, please provide their name below.<br>";
		html += myForm["referred_by"].value;
	}
	html += '</p>';
	
	html += '<p><strong>2.	Applicant Information</strong><br>';
	html += 'First Name: '+ myForm["first_name"].value+"<br>";
	html += 'Last Name: '+ myForm["last_name"].value+"<br>";
	html += 'Email: '+ myForm["email"].value+"<br>";
	html += 'Address Line 1: '+	 myForm["address"].value+"<br>";
	html += 'Address Line 2: '+ myForm["address2"].value+"<br>";
	html += 'City: '+ myForm["city"].value+"<br>";
	html += 'Province / State: '+ myForm["province"].value+"<br>";
	html += 'Country: '+ myForm["country"].value+"<br>";
	html += 'Postal / Zip Code: '+ myForm["postalcode"].value+"<br>";
	html += 'Home Phone: '+ myForm["home_phone"].value+"<br>";
	html += 'Daytime Phone: '+ myForm["work_phone"].value+"<br>";
	html += 'Cell Phone: '+myForm["cell_phone"].value+"<br>";
	html += 'Fax: '+ myForm["fax_phone"].value;
	html += '</p>';	
	
	html += '<p><strong>3.	Have you ever worked for PTI Group or any of its divisions in the past?</strong><br>';
	html += myForm["q1"].value;
	html += '</p>';
	
	html += '<p><strong>4.	If you qualify for a particular position of interest, when would you be available to start?</strong><br>';
	html += '(MM/DD/YY)' +myForm["q2"].value;
	html += '</p>';	
	
	html += '<p><strong>5.	Do you have access to reliable transportation? </strong><br>';
	html += myForm["q3"].value;
	html += '</p>';		
	
	html += '<p><strong>6.	Do you have a valid driver\'s license?</strong><br>';
	html += myForm["q4"].value;
	if (myForm["q4"].value == "Yes")
	{
		html += "<br>If yes, please check all that apply: " + myForm["q4_addon"].value;
	}
	html += '</p>';			
	
	html += '<p><strong>7.	Do you have a criminal record, including any and all major and minor offences for which you have not been pardoned?  </strong><br>';
	html += myForm["q5"].value;
	if (myForm["q5"].value == "Yes")
	{
		html += "<br>If yes, please provide details. " + myForm["q5_addon"].value;
	}
	html += '</p>';			
	
	html += '<p><strong>8.	Please check the level of education that you have completed.  You may be required to provide proof of your educational achievement.    </strong><br>';
	html += myForm["q6"].value;
	if ((myForm["q6"].value).indexOf ("Apprentice") != "-1")
	{
		html += "("+myForm["q6_addon"].value+")"
	}
	html += '</p>';				
	
	html += '<p><strong>9.	Please copy and paste your resume into the box below or click here to upload an electronic* copy.   </strong><br>';
	html += (myForm["q7"].value).replace(/\n/g, "<br>");
	html += '</p>';			
	
	html += '\n</td></tr></table></body>\n</html>';

	var win = window.open("","_blank", str);
	win.document.open("text/html", "replace");	
	win.document.write(html);
	win.document.close();	
}

function viewImage (filename, width, height)
{
	var tmp = filename.split ("/");
	var str = 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height
	var html ='<html>\n<head>\n<title>Preview - '+ tmp[2] +'</title></head>\n';
	html += '<body bgcolor="white" leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0 marginwidth=0 marginheight=0>\n';
	html += '<table border=0 cellpadding=0 cellspacing=0 width="100%" height="100%"><tr><td align=center id="s"><a href="javascript:window.close();"><img src="'+filename+'" width="'+width+'" height="'+height+'" border=0 alt="Click to Close Window"></a></td></tr></table>';
	html += '\n</body>\n</html>';

	var win = window.open("","_blank", str);
	win.document.open("text/html", "replace");	
	win.document.write(html);
	win.document.close();
	win.window.focus();	
}

var myDomain = '';

function setDomain (domain)
{
	myDomain = strrev(domain);
}

function buildLink (username)
{
	var tmp  = strrev(username);
	var html = '';
	html     = '<a href="';
	html    += 'mailto:';
	html    += tmp;
	html    += '@';
	html    += myDomain;
	html    += '">';
	html    += tmp;
	html    += '@';
	html    += myDomain;
	html    += '</a>';
	document.write (html);
}

function strrev(str) {
   if (!str) return '';
   var revstr='';
   for (i = str.length-1; i>=0; i--)
       revstr+=str.charAt(i)
   return revstr;
}

//Random flash loader
function randomFlash() {
	
var ran_unrounded=Math.random()*3; //Set the number of flash files, starting at "0"
var ran_number=Math.round(ran_unrounded); 
var myflash = "";
var html = " ";

if (ran_number == 0){
			myflash = "flash/intro1.swf" ;
		}
	
if (ran_number == 1){
			myflash = "flash/intro2.swf" ;
		}
		
if (ran_number == 2){
			myflash = "flash/intro3.swf" ;
		}		

if (ran_number == 3){
			myflash = "flash/intro4.swf" ;
		}
		
html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="583" height="278">';
html += '<param name="movie" value="'+myflash+'"><param name="wmode" value="transparent"><param name="quality" value="high"><param name="SCALE" value="exactfit">';
html += '<embed src="flash/intro1.swf" wmode="transparent" width="583" height="278" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit"></embed></object>';
		document.write(html);
}


//Validate contact form
function validateContactForm(){
   if(document.forms['contact'].elements['first_name'].value == ""){
     document.getElementById('first_name_img').src = "images/required_field.gif";
      }
  else if(document.forms['contact'].elements['last_name'].value == ""){
     document.getElementById('last_name_img').src = "images/required_field.gif";
     }
  else if(document.forms['contact'].elements['email_address'].value.indexOf('@',0) < 0  || document.forms['contact'].elements['email_address'].value == '' ){
    document.getElementById('email_address_img').src = "images/required_field.gif";
    }
  else if(document.forms['contact'].elements['subject'].value == ""){
     document.getElementById('subject_img').src = "images/required_field.gif";
    }
  else if(document.forms['contact'].elements['message'].value == '' ){
    document.getElementById('message_img').src = "images/required_field.gif";
    }	
 else
 document.forms['contact'].submit();
}


//Open Camp flash pop up
function detailMapPopup(mapName){
// define function vars
var top  = "";
var left = "";
var id = "mapDetail";
var URL = "mapDetail.php?mapName="+mapName;

// set window width
var width = "660";
// set window height
var height = "415";

// set window top position (center)
var top  = (screen.Height - eval(height) )/2; 	
// set window left position (center)
var left = (screen.Width - eval(width) )/2;

//combine properties to open window with window.open	
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "');");
}