function show_cms(){

	document.getElementById("dms_rocovery_container").style.visibility = "hidden";
	document.getElementById("dms_rocovery_container").style.display = "none";
	document.getElementById("tint_box").style.display = "block";
	document.getElementById("login_container").style.display = "block";
	document.getElementById("cms_login").style.display = "block";

}

function close_cms(){	

	document.getElementById("tint_box").style.display = "none";
	document.getElementById("login_container").style.display = "none";
	document.getElementById("cms_login").style.display = "none";
	document.getElementById("dms_login").style.display = "none";


}

function show_dms(){

	document.getElementById("tint_box").style.display = "block";
	document.getElementById("login_container").style.display = "block";
	document.getElementById("dms_login").style.display = "block";
	document.getElementById("dms_login").style.visibility = "visible";

}

function close_dms(){	

	document.getElementById("tint_box").style.display = "none";
	document.getElementById("login_container").style.display = "none";
	document.getElementById("dms_login").style.display = "none";
	document.getElementById("cms_login").style.display = "none";
	document.getElementById("dms_rocovery_container").style.display = "none";
	document.getElementById("dms_login").style.visibility = "hidden";

}

function show_detail_recovery(){

	document.getElementById("dms_rocovery_container").style.display = "block";
	document.getElementById("dms_rocovery_container").style.visibility = "visible";


}

function close_dms_rcovery(){

	document.getElementById("dms_rocovery_container").style.display = "none";
	document.getElementById("dms_rocovery_container").style.visibility = "hidden";


}

function show_dms_stall(){

	setTimeout( "show_dms()", 500);

}

function show_dms_recover_stall(){

	setTimeout( "show_dms()", 500);
	setTimeout( "show_detail_recovery()", 500);

}

function view_manual(){

	window.location = "../downloads/manuals.php";

}
function view_brochure(){

	window.location = "../downloads/brochures.php";

}
function view_drawings(){

	window.location = "../downloads/drawings.php";

}
function view_regs(){

	window.location = "../downloads/regulations.php";

}
function view_cert(){

	window.location = "../downloads/certificates.php";

}

function validate_data(){

	var contact_n = document.getElementById("c_name").value;
	
	var contact_e = document.getElementById("c_email").value;
	
	var contact_s = document.getElementById("c_subject").value;
	
	var contact_m = document.getElementById("c_message").value;
	
	var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
			
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	
	var status = 0;
	
	if (!contact_n || contact_n == " "){
	
		document.getElementById("c_name").style.border = "2px solid #B30000";
		
		document.getElementById('c_name_img').src = "../images/cross.png";
		
		status = 1;
	
	}
	else if (contact_n != "" || contact_n != " "){
	
		document.getElementById("c_name").style.border = "2px solid #00CC00";
		
		document.getElementById('c_name_img').src = "../images/tick.gif";
		
	
	}
	if (!contact_e || contact_e == " "){
	
		document.getElementById("c_email").style.border = "2px solid #B30000";
		
		document.getElementById('c_email_img').src = "../images/cross.png";
		
		status = 1;
	
	}
	
	else if (contact_e != "" || contact_e != " "){
	
		document.getElementById("c_email").style.border = "2px solid #00CC00";
		
		document.getElementById('c_email_img').src = "../images/tick.gif";
		
	
	}
	
	if (!(emailFilter.test(contact_e))) { 
					
		document.getElementById("c_email").style.border = "2px solid #BF0000";
				
		document.getElementById('c_email_img').src = "../images/cross.png";
				
		document.getElementById('c_name_img').alt = "Invalid Email";  
							
	}
	
	if (contact_e.match(illegalChars)) {
	
		document.getElementById("c_email").style.border = "2px solid #BF0000";
				
		document.getElementById('c_email_img').src = "../images/cross.png";
				
		document.getElementById('c_name_img').alt = "Invalid Email";  
					
	}
	
	if (!contact_s || contact_s == " "){
	
		document.getElementById("c_subject").style.border = "2px solid #B30000";
		
		document.getElementById('c_subject_img').src = "../images/cross.png";
		
		status = 1;
	
	}
	
	else if (contact_s != "" || contact_s != " "){
	
		document.getElementById("c_subject").style.border = "2px solid #00CC00";
		
		document.getElementById('c_subject_img').src = "../images/tick.gif";
		
	
	}
	
	if (!contact_m || contact_m == " "){
	
		document.getElementById("c_message").style.border = "2px solid #B30000";
		
		document.getElementById('c_message_img').src = "../images/cross.png";
		
		status = 1;
	
	}
	
	else if (contact_m != "" || contact_m != " "){
	
		document.getElementById("c_message").style.border = "2px solid #00CC00";
		
		document.getElementById('c_message_img').src = "../images/tick.gif";
		
	
	}
	
	if (status == 1){
	
		alert("Error! A field is empty or you have used an incorrect email. Please Try Again");
	
	
	}
	else if (status == 0){
	
		document.send_msg.submit(); 
	
	}
}

function show_map() {

	browser_version= parseInt(navigator.appVersion);
	browser_type = navigator.appName;

	if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
	
			var load = window.open('../contact/location_map.php','','scrollbars=no,menubar=no,height=385,width=440,resizable=no,toolbar=no,location=no,status=no');
			
		}
		else{
		
			var load = window.open('../contact/location_map.php','','scrollbars=no,menubar=no,height=385,width=440,resizable=no,toolbar=no,location=no,status=no');

		}
}

function show_chart_finder(){

	browser_version= parseInt(navigator.appVersion);
	browser_type = navigator.appName;

	if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
	
			var load = window.open('../paper_products/chart_search.php','','scrollbars=yes,menubar=no,height=750,width=730,resizable=yes,toolbar=no,location=no,status=no');
			
		}
		else{
		
			var load = window.open('../paper_products/chart_search.php','','scrollbars=yes,menubar=no,height=780,width=730,resizable=yes,toolbar=no,location=no,status=no');

		}

}
function show_disclaimer(){

	var load = window.open('../home/disclaimer.php','','scrollbars=yes,menubar=no,height=585,width=640,resizable=yes,toolbar=no,location=no,status=no');

}

function show_legal_info(){

	var load = window.open('../home/legal_info.php','','scrollbars=yes,menubar=no,height=445,width=390,resizable=yes,toolbar=no,location=no,status=no');

}

function access_tec_centre(){

	window.location = '../technical_centre/tec_centre_1.php';


}

function access_adp(){

	window.location = '../digital_products/adp.php';

}

function access_mfds(){

	window.location = '../equipment/product.php?id=mfds';

}

function access_mag_compass(){

	window.location = '../equipment/product.php?id=Mk2000';

}

function modify_img_box(){

 var myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientHeight ) ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	  }

	var image_width = document.getElementById("large_img").width;
	
	var image_height = document.getElementById("large_img").height;
	
	var box_width = image_width + 63;
	
	var box_height = image_height + 64;
	
	var space_height = myHeight - box_height;
	
	var set_top = space_height / 2;
	
	
	document.getElementById("prod_img_box").style.width = box_width + "px";
	
	document.getElementById("prod_img_box").style.height = box_height + "px";

	document.getElementById("prod_img_container").style.top = set_top + "px";


}
