function popPdfwin(){

form

window.open('section05/pdfdownload.html','downloads','width=500,height=500');
}

function createCookie(name, value)
{
	document.cookie = name + "=" + escape(value);
}


function itemschosen(){
	var error_string ="";
	var itemselected=false;
	for (var loop=0; loop < window.document.pdfform.information.length; loop++) 
	{
			if (window.document.pdfform.information[loop].checked) 
			{
				itemselected=true;
			}
		}
			if (itemselected==false) 
			{
				error_string+= "You have not chosen any items";
				}
var typeofitem = "";
var count_items = 0;
for (var indexa = 0; indexa < window.document.pdfform.information.length; indexa++)
   		{
       		 if (window.document.pdfform.information[indexa].checked == true) 	
			{
        		typeofitem += "=" + "item" + indexa;
				count_items++;
      		  	}
		}
		//writing cookie with "=" split
		
		alert(window.document.pdfform.information[0].value)
		alert(window.document.pdfform.information[1].value)
		alert(window.document.pdfform.information[1].checked)
				if (error_string=="")
				{
				
				createCookie("pdfcookie", typeofitem);
				popPdfwin();
							
				}
				else
				{
				alert(error_string);
				return false;
			}
			}
function readCookie(cookiename)
	{	if(document.cookie == '') 
			{	// there's no cookie, so go no further
				return false;
			}
		else
			{	var firstChar, lastChar;
				var theWholeCookie = document.cookie;
				firstChar = theWholeCookie.indexOf(cookiename);		// find the start of 'cookiename'
				firstChar += cookiename.length + 1;					// skip 'name' and '='
				lastChar = theWholeCookie.indexOf(";",firstChar);			// Find the end of the value string (i.e. the next ';')
				if(lastChar == -1)
					{	lastChar = theWholeCookie.length;
					}
				return unescape(theWholeCookie.substring(firstChar, lastChar));
			}
	}


// function to split a whole info cookie (using "|" as the delimeter
var wholeinfos = new Array;
function splitWholePdfCookie(cookieName)
	{	
		// load the cookie into a variable
		var the_info_cookie = readCookie(cookieName);
		if (the_info_cookie.indexOf("=") == -1)
			{	wholeinfos[0] = the_info_cookie;
			}
		else 
			{	
				wholeinfos = the_info_cookie.split("=");
			}
	}
function checkStuff() { 

thisform = document.getElementById("pdfform"); 

    if (window.document.pdfform.information[1].checked||window.document.pdfform.information[0].checked) 
	   {     
	   		 window.document.pdfform.action = "section05/pdfdownload.html";
			 window.document.pdfform.target="breakout";
			 window.open('','breakout','width=500,height=500');
			 
			 return true; 
        } 
     
    else {
		 alert("Choose Individual or Company please!");
		 return false;
		 }

}

function validateForm(member)
{

	// check to see if first name field is blank
	if (member.Account.value == "")
	{
	alert("You must enter your account.");
	member.Account.focus();
	return (false);
	}
        
        if (member.FirstName.value == "")
	{
	alert("Please enter your first name.");
	member.FirstName.focus();
	return (false);
	}
	
	if (member.LastName.value == "")
	{
	alert("Please enter your last name.");
	member.LastName.focus();
	return (false);
	}

        if (member.AccountName.value == "")
	{
	alert("Please enter your Account Name.");
	member.AccountName.focus();
	return (false);
	}
        if (member.StreetAddress.value == "")
	{
	alert("Please enter your Account Street Address.");
	member.StreetAddress.focus();
	return (false);
	}
        if (member.City.value == "")
	{
	alert("Please enter your  City.");
	member.City.focus();
	return (false);
	}
        if (member.FirstPhone.value == "")
                {
                alert("Please enter your Home phone number.");
                member.FirstPhone.focus();
                return (false);
                }
// worked to here

var Email = member.email.value;

	if (Email == "")
	{	alert("Please enter a value for the \"email\" field.");
		member.email.focus();
		return (false);
	}
	else
	{	var AtSym  = member.email.value.indexOf('@');
		var Dot    = member.email.value.lastIndexOf('.');
		var Space  = member.email.value.indexOf(' ');
		var Length = member.email.value.length - 2;   // Array is from 0 to length-2

		if ((AtSym < 1) ||                     // '@' cannot be in first position
			(Dot <= AtSym+1) ||                // Must be at least one valid char btwn '@' and '.'
			(Dot == Length ) ||                // Must be at least two valid chars after '.'
			(Space  != -1))                    // No empty spaces permitted
			{		alert("Your e-mail address is not valid. Please re-enter it.");
					member.email.focus();
					return (false);
			}
		
		var illegal_string = "/*+,/<>?;':[]{}\|`~!#$%^&*()=";
		// keep a count of how many illegal characters appear in the fields
		var illegal_count=0;
		// next loop to run as many times as there are illegal characters to check against
		for (var loop=0; loop < illegal_string.length; loop++)
		{	// next bit assigns each consecutive illegal character into variable: "the_char" 
			the_char = illegal_string.charAt(loop);
			// next if statement means if illegal character appears in email number, increment count of illegal characters
			if (Email.indexOf(the_char) != -1)	// actually says: if illegal character does not NOT appear
			{	illegal_count++;	
			}
		}
		// next if statement prints error message only once if multiple illegal characters appear
		if (illegal_count > 0)
		{		alert("your email address contains invalid characters.Please Re-enter it.");
				member.email.focus();
				return (false);
		}
	
	}
        
        
         if (member.Elec.value == "")
                {
                alert("Please decide if you'd like Electronic Delivery of information (recommended!!).");
                member.Elec.focus();
                return (false);
                }
		// check if email field is blank
				
	
}