//   Detect Browser 
function sniff() {if (document.layers) {navigator.family = "nn4"};
if (document.all) {navigator.family = "ie4"};
if (window.navigator.userAgent.toLowerCase().match("gecko")) {navigator.family = "gecko"};
}

// adjust main table for Netscape

function tableTweak () 
	{
		if (navigator.family == "nn4")
			{
				document.writeln("<div align='left'><img src='images/spacer.gif' border='0' width='1' height='46'></div>");
			}
	}

//set up popups
	function popup(url,h,w,scroll,resize) { 
	var p = "height=" + h + ",width=" + w + ",scrollbars=" + scroll + ",resizable=" + resize;
	window.open(url,"",p);
	}

//  description text 
linkDescribe = new Array(
"<a href='consult.html'>Free Consultation</a><br><a href='graphic.html'>Graphic Design</a><br><a href='construct.html'>Website Construction</a><br><a href='submission.html'>Search Engine Submission</a><br><a href='multimedia.html'>Multimedia</a><br><a href='ecommerce.html'>E-Commerce</a><br><a href='banners.html'>Ad Banners</a><br><a href='maintenance.html'>Site Maintenance</a><br><a href='redesign.html'>Site Redesign</a><br>","a"
);

overdiv="0";
//  layer popups 
function popLayer(a){ var y = 100;
	switch (a)
	{
		case 0:
			x = 350;
			break;
		
		case 1: 
			x = 475;
			break; 
			
	}

if (navigator.family == "gecko") {pad="0";}
else {pad="1";}
desc = 	  "<table width=155 height=40 cellspacing=0 cellpadding="+pad+" style='border:2 outset #999999;background-color:#E9E9E9'><tr><td>\n"
	+"<table cellspacing=0 cellpadding=2 border=0><tr><td bgcolor=#E9E9E9 valign=top><FONT FACE=Tahoma,Arial,Helvetica,non-serif COLOR=#000000 SIZE=1><p ALIGN='left' STYLE='font-family:Arial,Helvetica,non-serif;font-weight:bold;font-size:9px;line-height:13px;margin-left:6px;margin-top: 8px;margin-bottom:8px;margin-right:8px;background-color:#FFFFFF;padding:4px;border 1px outset #999999'>\n"
	+linkDescribe[a]
	+"\n</td></tr></table>\n"
	+"</td></tr></table>";
if(navigator.family =="nn4") {
	document.object1.document.write(desc);
	document.object1.document.close();
	document.object1.left=x+15;
	document.object1.top=y-5;
	}
else if(navigator.family =="ie4"){
	object1.innerHTML=desc;
	object1.style.pixelLeft=x+15;
	object1.style.pixelTop=y-5;
	}
else if(navigator.family =="gecko"){
	document.getElementById("object1").innerHTML=desc;
	document.getElementById("object1").style.left=x+15;
	document.getElementById("object1").style.top=y-5;
	}
}
function hideLayer(){
if (overdiv == "0") {
	if(navigator.family =="nn4") {eval(document.object1.top="-500");}
	else if(navigator.family =="ie4"){object1.innerHTML="";}
	else if(navigator.family =="gecko") {document.getElementById("object1").style.top="-500";}
	}
}

// email validator
	function checkEmail(mailform) {
		if (mailform.name.value=="") {
		alert ("Don't forget your name");
		document.mailform.name.focus();
		return false;
		}
  else
  if (mailform.email.value.length <= 6 ||
      mailform.email.value.indexOf ('@', 0) == -1 ||
      mailform.email.value.indexOf ('.', 0) == -1)
	{
      alert(mailform.email.value + " isn't a valid email address.\nPlease check and re-enter it.");
      document.mailform.email.focus();
      return false;
 }

  else
	 if (mailform.query.value=="") {
		alert ("Don't forget to include a query or comments!");
		document.mailform.query.focus();
		return false;}  

else 
	{
	var nameString = mailform.name.value;
	if (nameString.indexOf(" ") != -1)
	{
	var firstname = nameString.substring(0, nameString.indexOf(" "));
	alert ("Thanks for your query, " + firstname + ".\nI will respond as soon as possible.\nClick OK in the next prompt to confirm your email." + "\nYou'll then be returned to the Bluesmoke homepage");
	 	
	return true;
	}
 else {alert ("Thankyou for your query, " + mailform.name.value + ".\nI will respond as soon as possible.\nClick OK in the next prompt to confirm your email." + "\nYou'll then be returned to the Bluesmoke homepage");
	 	
	return true;
  }
  		}
  		}

// set up autopopup and cookies for index.html

function getCookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function startPopup(){
if (getCookie('popped')==''){
popup('testimonial.html',205,380,'no','no');
document.cookie="popped=yes";
}
}