// JavaScript Document
function show_specification_layer(title, subtitle, innerText){ //********************************************************************************** FUNCTIONS FOR THE SPECIFICATION TOP LAYER

//get window size
/******************************************** NOT WORKING WITH EXPLORER 6
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth-16;
  winH = window.innerHeight-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth-20;
  winH = document.body.offsetHeight-20;
 }
}
**************************************************************************/

var windowWidth=0;
var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
		windowWidth=window.innerWidth-18;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
			windowWidth=document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
				windowWidth=document.body.clientWidth;
			}
		}
	}
	

//set the transparent layer to visible
document.getElementById('coverLayer').style.width = windowWidth +"px";
document.getElementById('coverLayer').style.height = windowHeight +"px";
document.getElementById('coverLayer').style.visibility = "visible";

//display the top layer
document.getElementById('top_specs_layer').style.left = (windowWidth/2)-210+"px";
document.getElementById('top_specs_layer').style.visibility = "visible";
//document.getElementById('top_specs_layer').innerHTML="<div class=\"hd\"><!--Feature header--></div><div class=\"close\"><a href=\"javascript:hide_specification_layer();\">Close [x]</a></div><div style=\"padding: 10px; margin-top: 20px;\">" + innerText + "</div>";
document.getElementById('top_specs_layer').innerHTML="<div class=\"hd\">" + title +"</div><div class=\"close\"><a href=\"javascript:hide_specification_layer();\">Close [x]</a></div><div style=\"padding: 10px; margin-top: 20px;\">" + subtitle + "<br /><br />" + innerText + "</div>";
}


function hide_specification_layer(){
//set the transparent layer to invisible
document.getElementById('coverLayer').style.width = "1px";
document.getElementById('coverLayer').style.height = "1px";
document.getElementById('coverLayer').style.visibility = "hidden";

//hide the top layer
document.getElementById('top_specs_layer').style.left = "0px";
document.getElementById('top_specs_layer').style.visibility = "hidden";
}

//******************************************************************************************************************** END FUNCTIONS FOR THE SPECIFICATION TOP LAYER



function show_video_layer(title, video){ //********************************************************************************** FUNCTIONS FOR THE VIDEO TOP LAYER


var windowWidth=0;
var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
		windowWidth=window.innerWidth-18;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
			windowWidth=document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
				windowWidth=document.body.clientWidth;
			}
		}
	}
	

//set the transparent layer to visible
document.getElementById('coverLayer').style.width = windowWidth +"px";
document.getElementById('coverLayer').style.height = windowHeight +"px";
document.getElementById('coverLayer').style.visibility = "visible";

//display the top layer
document.getElementById('top_video_layer').style.width = "750px";
document.getElementById('top_video_layer').style.height = "602px";
document.getElementById('top_video_layer').style.left = (windowWidth/2)-375+"px";
document.getElementById('top_video_layer').style.top = (windowHeight/2)-400+"px";
document.getElementById('top_video_layer').style.visibility = "visible";
//document.getElementById('top_specs_layer').innerHTML="<div class=\"hd\"><!--Feature header--></div><div class=\"close\"><a href=\"javascript:hide_specification_layer();\">Close [x]</a></div><div style=\"padding: 10px; margin-top: 20px;\">" + innerText + "</div>";
document.getElementById('top_video_layer').innerHTML="<div class=\"hd\">" + title +"</div><div class=\"close\"><a href=\"javascript:hide_video_layer();\">Close [x]</a></div><div style=\"padding: 0px; margin-top: 20px;\">" + video + "</div>";
}


function hide_video_layer(){
//set the transparent layer to invisible
document.getElementById('coverLayer').style.width = "1px";
document.getElementById('coverLayer').style.height = "1px";
document.getElementById('coverLayer').style.visibility = "hidden";

//hide the top layer
document.getElementById('top_video_layer').style.left = "0px";
document.getElementById('top_video_layer').style.visibility = "hidden";
document.getElementById('top_video_layer').innerHTML="";
document.getElementById('top_video_layer').style.width = "0px";
document.getElementById('top_video_layer').style.height = "0px";
}

//******************************************************************************************************************** END FUNCTIONS FOR THE VIDOE TOP LAYER


function show_form_layer(){ //********************************************************************************** FUNCTIONS FOR THE FORMS TOP LAYER


var windowWidth=0;
var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
		windowWidth=window.innerWidth-18;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
			windowWidth=document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
				windowWidth=document.body.clientWidth;
			}
		}
	}
	

//set the transparent layer to visible
document.getElementById('coverLayer').style.width = windowWidth +"px";
document.getElementById('coverLayer').style.height = windowHeight +"px";
document.getElementById('coverLayer').style.visibility = "visible";

//display the top layer
document.getElementById('top_form_layer').style.width = "750px";
document.getElementById('top_form_layer').style.height = "690px";
document.getElementById('top_form_layer').style.left = (windowWidth/2)-375+"px";
document.getElementById('top_form_layer').style.top = (windowHeight/2)-400+"px";
document.getElementById('top_form_layer').style.visibility = "visible";
document.getElementById('top_form_layer').innerHTML="<div class=\"hd\">Brief Forms</div><div class=\"close\"><a href=\"javascript:hide_form_layer();\">Close [x]</a></div><div style=\"padding: 0px; margin-top: 20px;\"><iframe frameborder=\"0\" src=\"pop_advertForm.php\"></iframe></div>";
}


function hide_form_layer(){
//set the transparent layer to invisible
document.getElementById('coverLayer').style.width = "1px";
document.getElementById('coverLayer').style.height = "1px";
document.getElementById('coverLayer').style.visibility = "hidden";

//hide the top layer
document.getElementById('top_form_layer').style.left = "0px";
document.getElementById('top_form_layer').style.visibility = "hidden";
document.getElementById('top_form_layer').style.width = "0px";
document.getElementById('top_form_layer').style.height = "0px";
document.getElementById('top_form_layer').innerHTML="";
}

//******************************************************************************************************************** END FUNCTIONS FOR THE FORMS TOP LAYER





// ***************************** BANNER FORM VALIDATION *******************************************
function sendBannerForm(){
	
var theForm = document.forms.banner_form;
var msg = 'Please correct the followiong errors before the form can be sent:\r\n\r\n';
var errors = 0;


if(theForm.contactName.value == ''){
msg += "Please provide your name\r\n";
//theForm.contactName.borderColor ='red';
errors ++;
}



var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var emailAddress = theForm.email.value;

if(reg.test(emailAddress) == false) {
msg += 'Please provide a valid email address\r\n';
//theForm.email.style.borderColor ='red';
errors ++;
}





if(theForm.sitacode.value == ''){
msg += "Please provide your sitacode\r\n";
//theForm.contactName.borderColor ='red';
errors ++;
}







// Check SIZE Radio buttons
if(theForm.width.value == '' || theForm.height.value == ''){


if(theForm.size.selectedIndex == 0){
msg += "Please select a size or provide custom values\r\n";
	/*for (i = 0; i < theForm.size.length; i++){
	theForm.size[i].style.borderColor ='red';
	}*/
errors ++;
}
}


// Check BACKGROUND Radio buttons
var selectedBackground = 0;
for (i = 0; i < theForm.background.length; i++){
	if(theForm.background[i].checked){
	selectedBackground ++;
	}
}

if(selectedBackground == 0){
msg += "Please select a background\r\n";
	/*for (i = 0; i < theForm.background.length; i++){
	theForm.background[i].style.borderColor ='red';
	}*/
errors ++;
}




if(theForm.theLink.value == ''){
msg += "Please provide a valid link\r\n";
//theForm.contactName.borderColor ='red';
errors ++;
}


if(theForm.hostSite.value == ''){
msg += "Please provide a valid host site name\r\n";
//theForm.contactName.borderColor ='red';
errors ++;
}





if (errors > 0){
alert(msg);
}else{
//alert('Here is sent');
theForm.submit();
}


}
// ***************************** END BANNER FORM VALIDATION *******************************************
