// prevent cross browser event bubbling

/* error catch
try{ 
  allert( 'this is a code example' ); 
} 
catch( exceptionObject ) { 
  var errorString = ''; 
  for( i in exceptionObject ) { 
    errorString += i + ':' + exceptionObject[i] + '\n'; 
  } 
  alert( errorString );
}
*/

//  alert(navigator.userAgent);
  
if (navigator.userAgent.indexOf("Firefox")!=-1){
	document.write("<link rel='stylesheet' href='css1/wd33FF.css' media='screen' type='text/css'>")//Firefox
}else
if (navigator.userAgent.indexOf("MSIE")!=-1){
	//document.write("<link rel='stylesheet' href='css1/wd33IE.css' media='screen' type='text/css'>")//IE
	alert("Under Development for Internet Explorer - Better viewed in Firefox or Safari");
}else
if (navigator.userAgent.indexOf("Opera")!=-1){
	document.write("<link rel='stylesheet' href='css1/wd33FF.css' media='screen' type='text/css'>")//Firefox//Opera
}else
if (navigator.userAgent.indexOf("Mozilla")!=-1){
	document.write("<link rel='stylesheet' href='css1/wd33FF.css' media='screen' type='text/css'>")//Mozilla Safari
}

window.onload=function(){
//Nifty("div#selectDetails","big");
//Nifty("div#selectContents","big");
//Nifty("div#header-r-image","big");
//header-r-image
}

function stopEvent(e) {
	if(!e) var e = window.event;
	alert('errol - stop event');
	//e.cancelBubble is supported by IE - this will kill the bubbling process.
	e.cancelBubble = true;
	e.returnValue = false;

	//e.stopPropagation works only in Firefox.
	if (e.stopPropagation) {
		e.stopPropagation();
		e.preventDefault();
	}
	return false;
}

var sUserAgent = navigator.userAgent;
var fAppVersion = parseFloat(navigator.appVersion);

//alert(sUserAgent);
//alert(fAppVersion);

 //alert ("Window height", window.screen.height);

function About_txt_display(disp){
	var eAtxt = document.getElementById("About_nav_display");
	var eCtxt = document.getElementById("Contact_nav_display");
//	alert("About display" + etxt);
//	alert("About display" + disp);
	if(eAtxt.style.visibility == "hidden"){
//		alert("message will now be visible");
		eCtxt.style.visibility = "hidden"
		eAtxt.style.visibility = disp;
	}
}

function Contact_txt_display(disp){
	var eCtxt = document.getElementById("Contact_nav_display");
	var eAtxt = document.getElementById("About_nav_display");
//	alert("About display" + etxt);
//	alert("About display" + disp);
	if(eCtxt.style.visibility == "hidden"){
//		alert("contact message will now be visible");
		eAtxt.style.visibility = "hidden"
		eCtxt.style.visibility = disp;
	}
}


//VALIDATION SCRIPTS

//HIDE LABELS AND POSITION IN INPUT ELEMENTS
$(document).ready(function() {
			
		$("div.content p.para0:visible").slideUp("slow");
		$("div.content p.para1:visible").slideUp("slow");
		$("div.content p.para2:visible").slideUp("slow");
	
	var aLinks = ['whoweare', 'whatwedo', 'whowework']; /* P Elements to traverse */
	
	var labelEmail = $('#iQuery').remove().text();
	var labelComment = $('#iHeadquery').remove().text();
/*
	$('#query').addClass('placeholder').val(labelEmail);
	$('#headquery').addClass('placeholder').val(labelComment);
*/

	$.each(aLinks,function(aLinks) {
		$("#" + this).mouseover(function(){
//			console.log($.inArray(i, aLinks));
			console.log(aLinks);
			$("div.content p.para"+ aLinks + ":hidden").slideDown("fast");
			$("div.content p.para:visible").slideUp("slow");
      return (this !=  aLinks); // will stop running to skip "five"
		 });								 
	});
	
	$.each(aLinks,function(aLinks) {
		$("#" + this).mouseout(function(){
//			console.log($.inArray("whatwedo", aLinks));
//			console.log(aLinks);
			$("div.content p.para"+ aLinks + ":visible").slideUp("slow");
			$("div.content p.para:hidden").slideDown("fast");
      return (this != aLinks); // will stop running to skip "five"
		 });								 
	});
});