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.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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];}
}

function open_win(Dest,features){
        win_features = features +',left=50,top=100,alwaysraised=Yes,alwaysshow=yes';
        window.open(Dest,'',win_features);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

a11 = 'Coated to Defy Nature<br><br><b>Sheffield Metals International - COOLR Metal</b> / Print Ad';
a12 = 'Stocked in 22 Cool Flavors<br><br><b>Sheffield Metals International - COOLR Metal</b> / Print Ad';
a13 = 'A Cooler Way to Handle Mother Nature<br><br><b>Sheffield Metals International - COOLR Metal</b> / Print Ad';
a21 = 'Purity<br>Even in distribution<br><br><b>SCA International</b> / Print Ad';
a31 = 'Your life. Your dream. Your home.<br><br><b>Dream Builders</b> / Print Ad';
a41 = 'What goes into more than 200 years of Italian tradition, craftsmanship and innovation?<br>Keys.<br><br><b>Bianchi USA</b> / Print Ad';
a51 = 'Didn&acute;t think that real estate agents actually cared unless you were on the market?<br>re/think and get to know one who does<br><br><b>Mary Frances Weir - RE/MAX Agent</b> / Autumn Direct Mail';
a52 = 'Didn&acute;t think that real estate agents actually cared unless you were on the market?<br>re/think and get to know one who does<br><br><b>Mary Frances Weir - RE/MAX Agent</b> / Winter Direct Mail';
a51 = 'Didn&acute;t think that real estate agents actually cared unless you were on the market?<br>re/think and get to know one who does<br><br><b>Mary Frances Weir - RE/MAX Agent</b> / Summer Direct Mail';
c11 = 'Specify Resource Title to handle your title work<br>It&acute;s that simple to save money.<br><br><b>Resource Title Agency</b> / Consumer Brochure';
c12 = '<br><br><b>Resource Title Agency</b> / Closing Document CD-Rom Packaging';
c13 = '<br><br><b>Resource Title Agency</b> / National Accounts Brochure';
c21 = 'The Leiden Cabinet Company has taken two huge steps in the right direction.<br><br><b>Leiden Cabinet Company</b> / Move Announcemnt';
c22 = 'What does Leiden&acute;s new building mean to you?<br>We&acute;re all one step closer to that loaf of bread in every arm.<br><br><b>Leiden Cabinet Company</b> / Panera Bread Trade Show Brochure';
c31 = '<br><br><b>Rocky River Dental Associates</b> / New Patient Welcome Kit';
c32 = 'Bring your smile back to white<br><br><b>Rocky River Dental Associates</b> / In-Office Whitening Poster';
c41 = '<b>Dirty Industries</b> / Product Catalog';
c42 = '<b>Dirty Industries</b> / Product Catalog';
c43 = '<b>Dirty Industries</b> / Product Catalog';
c51 = 'Everything in your home relies on a strong foundation<br><br><b>Stablwall</b> / Product Brochure';
c52 = 'Everything in your home relies on a strong foundation<br><br><b>Stablwall</b> / Product Brochure';
c53 = 'Everything in your home relies on a strong foundation<br><br><b>Stablwall</b> / Product Brochure';
i12 = '<br><br><b>Prosalient</b> / Stationery';
i22 = '<br><br><b>Invos</b> / Stationery';
i32 = '<br><br><b>Resource Title</b> / Stationery';
i42 = '<br><br><b>Leiden Cabinet Company</b> / Stationery';
i52 = '<br><br><b>Dirty Industries</b> / Stationery';
w11 = '<br><br><b>Resource Title Agency</b> / Closing Document CD-Rom with Voice Over';
w12 = '<br><br><b>Resource Title Agency</b> / Closing Document CD-Rom with Voice Over';
w13 = '<br><br><b>Resource Title Agency</b> / Closing Document CD-Rom with Voice Over';
w21 = '<a href="http://www.imitalent.com" target="_blank"><font color="#cc6633">www.imitalent.com</font></a><br><br><b>IMI Talent Agency</b> / Porfolio Website with Flash';
w22 = '<a href="http://www.imitalent.com" target="_blank"><font color="#cc6633">www.imitalent.com</font></a><br><br><b>IMI Talent Agency</b> / Porfolio Website with Flash';
w23 = '<a href="http://www.imitalent.com" target="_blank"><font color="#cc6633">www.imitalent.com</font></a><br><br><b>IMI Talent Agency</b> / Porfolio Website with Flash';
w31 = '<br><br><b>Bob Schmitt Homes</b> / Touchscreen Kiosk';
w32 = '<br><br><b>Bob Schmitt Homes</b> / Touchscreen Kiosk';
w33 = '<br><br><b>Bob Schmitt Homes</b> / Touchscreen Kiosk';
w41 = '<a href="http://www.coolrmetal.com" target="_blank"><font color="#cc6633">www.coolrmetal.com</font></a><br><br><b>Sheffield Metals International - COOLR Metal</b> / Website';
w42 = '<a href="http://www.coolrmetal.com" target="_blank"><font color="#cc6633">www.coolrmetal.com</font></a><br><br><b>Sheffield Metals International - COOLR Metal</b> / Website';
w43 = '<a href="http://www.coolrmetal.com" target="_blank"><font color="#cc6633">www.coolrmetal.com</font></a><br><br><b>Sheffield Metals International - COOLR Metal</b> / Website';
w51 = '<br><br><b>St. Vincent Charity Hospital</b> / Bariatric Surgery Flash Animation with Voice Over';
w52 = '<br><br><b>St. Vincent Charity Hospital</b> / Bariatric Surgery Flash Animation with Voice Over';
w53 = '<br><br><b>St. Vincent Charity Hospital</b> / Bariatric Surgery Flash Animation with Voice Over';

function openEnlarge(msg){
	winURL = '/portfolio/enlarge_window.htm';
	picSrc = document.pic.href
	picSrc = picSrc.substr(0,picSrc.length-4) + '_lg.jpg'
	copy = eval(msg)
	/*copy = msg;*/
	enlargeWin = window.open(winURL,'enlarge','width=620,height=480','scrollbars=yes');		
}
 
function validateLogin(){
	e = true;
	alert_str = 'You must enter your username and your password to login.';
	if(document.loginForm.username.value == '') {
		e = false;
	}	
	if(document.loginForm.password.value == '') {
		e = false;
	}
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}

function validatePassword(){
	//companyName, contactName, email, username
	e = true;
	alert_str = 'Your submission had the following errors:';
	if(document.passwordForm.companyName.value == '') {
		alert_str += '\nMISSING Company Name.';
		e = false;
	}	
	if(document.passwordForm.contactName.value == '') {
		alert_str += '\nMISSING Contact Name.';
		e = false;
	}	
	if(document.passwordForm.email.value == '') {
		alert_str += '\nMISSING Email Address.';
		e = false;
	}
	else {
		if(chkEmail(document.passwordForm.email) == false) {
			alert_str += '\nINVALID Email Address.';
			e = false;
		}
	}
	if(document.passwordForm.username.value == '') {
		alert_str += '\nMISSING Username.';
		e = false;
	}	
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}

function validateContact(){
	e = true;
	alert_str = 'Your submission had the following errors:';
	if(document.contactForm.company.value == '') {
		alert_str += '\nMISSING Company Name.';
		e = false;
	}	
	if(document.contactForm.contact.value == '') {
		alert_str += '\nMISSING Contact Name.';
		e = false;
	}	
	if(document.contactForm.city.value == '') {
		alert_str += '\nMISSING City.';
		e = false;
	}
	if(document.contactForm.state.value == '') {
		alert_str += '\nMISSING State.';
		e = false;
	}	
	if(document.contactForm.phone.value == '') {
		alert_str += '\nMISSING Phone.';
		e = false;
	}
	else {
		if(document.contactForm.phone.value.length < 10) {
			alert_str += '\nINVALID Phone.';
			e = false;
		}	
	}	
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}

//validate the email address contains @ and .
function chkEmail(objName){
// Check for @ and .
	var checkStr = objName;
	var hasAt = false;
	var hasDot = false;
	for (i = 0;  i < checkStr.value.length;  i++){
		ch = checkStr.value.charAt(i);
		if (ch == "@")
			hasAt = true;
		if (ch == ".")
			hasDot = true;
	}
	if (!hasAt){	
		return false;
	}
	if (!hasDot){	
		return false;
	}
}

function validateResume(){
	e = true;
	alert_str = 'Your resume submission had the following errors:';
	if(document.submitResume.name.value == '') {
		alert_str += '\nMISSING Name.';
		e = false;
	}
	if(document.submitResume.address.value == '') {
		alert_str += '\nMISSING Address.';
		e = false;
	}
	if(document.submitResume.city.value == '') {
		alert_str += '\nMISSING City.';
		e = false;
	}
	if(document.submitResume.state.value == '') {
		alert_str += '\nMISSING State/Province.';
		e = false;
	}
	if(document.submitResume.zip.value == '') {
		alert_str += '\nMISSING Zip/Postal Code.';
		e = false;
	}				
	if(document.submitResume.phone.value == '') {
		alert_str += '\nMISSING Phone.';
		e = false;
	}
	else {
		if(document.submitResume.phone.value.length < 10) {
			alert_str += '\nINVALID Phone.';
			e = false;
		}	
	}
	if(document.submitResume.email.value == '') {
		alert_str += '\nMISSING Email Address.';
		e = false;
	}
	else {
		if(chkEmail(document.submitResume.email) == false) {
			alert_str += '\nINVALID Email Address.';
			e = false;
		}
	}
	if(document.submitResume.resume.value == '') {
		alert_str += '\nMISSING Resume.';
		e = false;
	}			
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}

function validateRequest() {
	e = true;
	alert_str = 'Your information request had the following errors:';	
	if(document.requestForm.company.value == '') {
		alert_str += '\nMISSING Company Name.';
		e = false;
	}
	if(document.requestForm.contact.value == '') {
		alert_str += '\nMISSING Contact Name.';
		e = false;
	}
	if(document.requestForm.city.value == '') {
		alert_str += '\nMISSING City.';
		e = false;
	}
	if(document.requestForm.state.value == '') {
		alert_str += '\nMISSING State/Province.';
		e = false;
	}				
	if(document.requestForm.phone.value == '') {
		alert_str += '\nMISSING Phone.';
		e = false;
	}
	else {
		if(document.requestForm.phone.value.length < 7) {
			alert_str += '\nINVALID Phone.';
			e = false;
		}	
	}
	if(document.requestForm.type_info.value == 0) {
		alert_str += '\nSELECT Type of Request.';
		e = false;
	}
	if(document.requestForm.hear_about.value == 0) {
		alert_str += '\nSELECT Where did you find us.';
		e = false;
	}		
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}

