
var ALERTSOFF = 0
var ALERTSON = 1

function openw(plik,s,w)
{
  config='top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,width='+s+',height='+w;
  config += 'scrollbars=no,resizable=no';
  pop=window.open(plik,'pop',config);
  
}

//WALIDACJA FORMULARZA 
function walidacja_career()
	{
	//FIRST NAME
	if (document.career_form.firstname.value == "")
		{
		alert("Please enter your First Name.");
		return false;
		} 
	
	//LAST NAME
	if (document.career_form.lastname.value == "")
		{
		alert("Please enter your Last Name.");
		return false;
		}
	
	//ADDRESS
	if (document.career_form.address.value == "")
		{
		alert("Please enter your Address.");
		return false;
		}
		
	//City
	if (document.career_form.city.value == "")
		{
		alert("Please enter your City.");
		return false;
		}	
		
	//State
	if (document.career_form.state.value == "")
		{
		alert("Please enter your State.");
		return false;
		}
	
	//zip
	if (document.career_form.zip.value == "")
		{
		alert("Please enter your five digit Zip Code.");
		return false;
		}
	//phone
	if (document.career_form.phone.value == "")
		{
		alert("Please enter your Daytime Phone number.");
		return false;
		}	
	//contacttime
	if (document.career_form.contacttime.value == "")
		{
		alert("Please fill in the best time to contact you.");
		return false;
		}
		
	//Location Desired
	if (document.career_form.location_desired.value == "")
		{
		alert("Please fill the Location Desired.");
		return false;
		}

	//Part time or Full time
	if (document.career_form.part_time_or_full_time.value == "")
		{
		alert("Please fill the Part time or Full time.");
		return false;
		}
						
	//email
	if (document.career_form.email.value != "")
		{
		if (!validate_email(document.career_form.email,ALERTSOFF))
			{
			//alert("Please enter your valid E-Mail Address.");
			return false;
			}
		}		
	}
	
function validate_email(email, usealerts) 
	{
	var str = email.value; // email string
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,10}|[0-9]{1,10})(\]?)$/; // valid
	if (!(!reg1.test(str) && reg2.test(str))) 
		{ // if syntax is valid
	    if(usealerts && str.length != 0)
	    	{
			alert("\"" + str + "\" is an invalid e-mail address."); // this is also optional
			email.focus();
			}
		return false;
		}
    
    // define a list of invalid characters
    invalidCharsList = " /:,;~#'%&*$()[]{}<>!\|=?`";
	
	if (email.value=="" && usealerts == 1)
		{
		return true;
		} 		
	predot = email.value.indexOf('.',0);	
   	at=email.value.indexOf('@',0);
   	dot=email.value.indexOf('.',at);
   	afterdot=email.value.length-dot;
    if (at==-1 ||
       at==0 ||
       dot==-1 ||
       dot-at<2 ||
       afterdot<3 ||
       (at-predot<2 && at-predot>0)) 
		{
       	if(usealerts == 1)
       		{ 
	        alert("The e-mail address appears to be invalid!");      
		    //email.value = "";
			email.focus();
			}
			return false;
   		}
    	for (i = 0; i < invalidCharsList.length; i++) 
    		{
        	errorChar = invalidCharsList.charAt(i);
        	if (email.value.indexOf(errorChar,0) != -1) 
        		{
				if(usealerts == 1)
					{
	            	alert("The e-mail address appears to be invalid!");
	            	//email.value = "";
	            	email.focus();
	        	}
            	return false;
        		}
    		}
    	return true;
	}
