// JavaScript Document


// Check for valid email address: look for @ and .
function isEmail(elm) {
    if (elm.value.indexOf("@") != "-1" &&
        elm.value.indexOf(".") != "-1") {
        return true;
    }
    else {
        return false;
    }
}

// Check for blank fields
function isFilled(elm) {
    if (elm.value == "" || elm.value == null) {
        return false;
    }
    else {
        return true;
    }
}

//check entire form
function isReady(form) {
	if (isFilled(form.name) == false) {        // A name?
        alert("Please enter your name.");
        form.name.focus();
        return false;
    	}

	if (isEmail(form.email) == false) {          // A real email address?
        alert("Please enter a valid email address.");
        form.email.focus();
        return false;
	}

	if (isEmail(form.company) == false) {          // Company Name?
        alert("Please enter your company name.");
        form.company.focus();
        return false;
	}

	if (isFilled(form.street) == false) {        // street address?
        alert("Please enter your company street address.");
        form.street.focus();
        return false;
    	}

	if (isFilled(form.city) == false) {        // city?
        alert("Please enter your company's city.");
        form.city.focus();
        return false;
    	}

	if (isFilled(form.country) == false) {        // Country?
        alert("Please enter your company's country.");
        form.country.focus();
        return false;
    	}

	if (isFilled(form.phone) == false) {        // Phone?
        alert("Please enter your company's phone number.");
        form.phone.focus();
        return false;
    	}

	if (isFilled(form.process_point) == false) {        // process point?
        alert("Please enter your company's process point.");
        form.process_point.focus();
        return false;
    	}
}

//Flyouts
myWindow = null;
function loadFlyout(img,imgTitle)
{
	//img = "http://www.isystems.com/new/images/" + img; 
	//adding path to test remotely REMOVE THIS LINE FOR LOCAL VERSION
	img = "../images/" + img; //adding path FOR LOCAL VERSION
	html = '<html><head><title>' + imgTitle + '</title></head><body><div align="center">';
	html += '<img src="' + img + '" alt="' + imgTitle + '" /></div>';
	html += '<div align="center"><strong><font color="#ffffff">' + imgTitle + '</font></strong><br />';
	html += '<input type="button" style="font-family:Verdana, Arial, Helvetica, sans-serif;" onclick="self.close();" value="Close"></div>';
	html += '</body></html>';
	
	//if(myWindow == null || myWindow.document == null)
	if(document.all || myWindow == null || myWindow.document == null)
	{
		var w = 1200, h = 800;
		if (document.all || document.layers) {
		   w = screen.availWidth;
		   h = screen.availHeight;
		}
		var popW = 660, popH = 700;// was 500
		var leftPos = (w-popW)/2, topPos = (h-popH)/2;
		topPos *= 1.8; //adjust down the screen a bit:
		topPos = Math.round(topPos);
		myWindow = window.open("", "theWindow", 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=no,resize=no');
		myWindow.document.write(html);
		myWindow.document.bgColor="#000000";
		myWindow.focus();
		myWindow.document.close();
	}else{
		//window exists already!
		myWindow.document.write(html);
		myWindow.document.bgColor="lightblue";
		myWindow.focus();
		myWindow.document.close();	
	}
}