// THE MAIN SUCKERFISH NAV SCRIPT //
sfHover = function() {
	// The globalnav LI elements
	var sfEls = document.getElementById("globalnav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

// This one we use for making target="_blank" links, using <a href="#" rel="external"> instead
function relTags() {
	if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName( "a" );
		for (var loop = 0; loop < anchors.length; loop++) {
			var anchor = anchors[loop];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
				anchor.target = "_blank";
			}
		}
	}
}


function cl(t){	
	if (t.defaultValue==t.value) t.value = '';
}

function insertFlash() {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="730" height="365">');
      document.write('<param name="allowScriptAccess" value="sameDomain" />');
      document.write('<param name="movie" value="_flash/homepage_feb2011.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
      document.write('<param name="quality" value="high" />');
      document.write('<param name="bgcolor" value="#ffffff" />');
      document.write('<embed src="_flash/homepage_feb2011.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="730" height="365" wmode="transparent" />');
	document.write('</object>');
} 
function insertDesignFlash() {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="730" height="365">');
      document.write('<param name="allowScriptAccess" value="sameDomain" />');
      document.write('<param name="movie" value="../_flash/interiorspage.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
      document.write('<param name="quality" value="high" />');
      document.write('<param name="bgcolor" value="#ffffff" />');
      document.write('<embed src="../_flash/interiorspage.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="730" height="365" wmode="transparent" />');
	document.write('</object>');
}
function insertm2mFlash() {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="730" height="365">');
      document.write('<param name="allowScriptAccess" value="sameDomain" />');
      document.write('<param name="movie" value="../../_flash/made_to_measure.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
      document.write('<param name="quality" value="high" />');
      document.write('<param name="bgcolor" value="#ffffff" />');
      document.write('<embed src="../../_flash/made_to_measure.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="730" height="365" wmode="transparent" />');
	document.write('</object>');
}
function insertzincFlash() {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="730" height="365">');
      document.write('<param name="allowScriptAccess" value="sameDomain" />');
      document.write('<param name="movie" value="../../_flash/zinc.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
      document.write('<param name="quality" value="high" />');
      document.write('<param name="bgcolor" value="#ffffff" />');
      document.write('<embed src="../../_flash/zinc.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="730" height="365" wmode="transparent" />');
	document.write('</object>');
}

function showPic (whichpic) {
	document.getElementById('bigpic').style.visibility = "hidden";
	document.getElementById('bigpic').src = whichpic.href;
 	return false;
}
function visPic() {
	document.getElementById('bigpic').style.visibility = "visible";
}



function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

//   The following function obtains two variables from your form (email and message) 
//   and builds a string that gets sent to your PHP script.  Change this function to
//   obtain whatever fields you want from your form.

function getquerystring() {
    var form  = document.forms['newsletter'];
    var user_Email = form.user_Email.value;
    qstr = 'user_Email=' + escape(user_Email); 
    return qstr;
}

function updatepage(str){
	if (str == "yes") {
		//new Effect.Fade(document.getElementById('newsletter'));
		//new Effect.Appear(document.getElementById('thanks'));
		$("#newsletter").hide();
		$("#thanks").fadeIn(2000);
	}
}

function enquiryForm(itemname) {
	
	url = "http://www.blacksofsopwell.com/furniture/ranges/enquiry.php?item=" + itemname;
	//alert (url);
	newwindow=window.open(url,'profile','height=515,width=450,top=15,left=15,scrollbars=yes');
	newwindow.focus();
}


// DO STUFF ONLOAD

window.onload=function(){
	relTags();
}





if (window.attachEvent) window.attachEvent("onload", sfHover);

