/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=4000; //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1; //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1; //Pause marquee onMousever (0=no. 1=yes)?
var wrapit=1;	// Scroll top text onto bottom of panel rather than show full blank page
var stepsize=8;
////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function writetostatus(input){
    //window.status=input;
	//document.getElementById("debug").innerHTML = input;
    return true;
}

function scrollmarquee(){
	if (cross_marquee)
	{	
		writetostatus ( "top=" +  cross_marquee.style.top + ' ' + (actualheight*(-1)+stepsize)+ ' ' + (actualheight+"px") + ' ' + (parseInt(marqueeheight)+stepsize+"px") );
		if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+stepsize))
			cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px";
		else {
			//alert(parseInt(cross_marquee.style.top));
			if (wrapit)
			{
				cross_marquee.style.top= stepsize + "px"; 
			}
				else
			{
				cross_marquee.style.top=parseInt(marqueeheight)+stepsize+"px";
			}
		}
	}
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee");
	offset = 0;
	if (wrapit)
	{
		offset = 10;
	} 
	if (cross_marquee)
	{	
	cross_marquee.style.top=0;
	marqueeheight=document.getElementById("marqueecontainer").offsetHeight+offset;
	actualheight=cross_marquee.offsetHeight+offset;
	if (wrapit)
	{
		cross_marquee.innerHTML = cross_marquee.innerHTML + '<div style="height:' + offset + 'px;">&nbsp;</div>'+ cross_marquee.innerHTML;
	}
	//document.getElementById("marqueecontainer").innerHTML = document.getElementById("marqueecontainer").innerHTML + document.getElementById("marqueecontainer").innerHTML;
	if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
	cross_marquee.style.height=marqueeheight+"px";
	cross_marquee.style.overflow="scroll";
	return;
	}
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


sfHover = function() { 
	var sfEls = document.getElementById("nav").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"), ""); 
		} 
	} 
} 

if (window.attachEvent) window.attachEvent("onload", sfHover);


function xmlcombo_list(select, target, control) {

// Prepare the XMLHTTP object for a HTTP POST to our validation ASP page
//document.getElementById("divProgressI").style.display = "block";
//document.getElementById("divProgressH").style.display = "block";

selectname = select.name;
selectval = select.options[select.selectedIndex]['value'].replace('&','%26amp;');
targetDiv = target;

//var sURL = "http://www.nufocus.biz/~ffeuk/" + control  + selectname+"="+selectval;
var sURL =  control  + selectname+"="+selectval;

alert(sURL);
oXMLHTTP.open( "POST", sURL, true );
	
// Define an event handler for processing
oXMLHTTP.onreadystatechange = managestatechange;
	
// Execute the request
try {
	oXMLHTTP.send(null);
}
catch (e) {
	alert(e);
	alert("Could not get list data at this time.");
	//document.getElementById("FirstName").focus;
}

}


// XmlHttp factory
function XmlHttp() {}

XmlHttp.create = function () {
   try {
      if (window.XMLHttpRequest) {
         var req = new XMLHttpRequest();
         
         // some older versions of Moz did not support the readyState property
         // and the onreadystate event so we patch it!
         if (req.readyState == null) {
            req.readyState = 1;
            req.addEventListener("load", function () {
               req.readyState = 4;
               if (typeof req.onreadystatechange == "function")
                  req.onreadystatechange();
            }, false);
         }
         
         return req;
      }
      if (window.ActiveXObject) {
         return new ActiveXObject(getControlPrefix() + ".XmlHttp");
	  }
   }
   catch (ex) {}
   // fell through
   //throw new Error("Your browser does not support XmlHttp objects");
};

function getControlPrefix() {
   if (getControlPrefix.prefix)
      return getControlPrefix.prefix;
   
   var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
   var o, o2;
   for (var i = 0; i < prefixes.length; i++) {
      try {
         // try to create the objects
         o = new ActiveXObject(prefixes[i] + ".XmlHttp");
         o2 = new ActiveXObject(prefixes[i] + ".XmlDom");
         return getControlPrefix.prefix = prefixes[i];
      }
      catch (ex) {};
   }
   
   throw new Error("Could not find an installed XML parser");
}

function getHTTPObject() { 
	var xmlhttp; 
/*@cc_on 
	@if (@_jscript_version >= 5) 
		try { 
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		} 
		catch (e) 
		{ 
			try 
			{ 
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
			} 
			catch (E) 
			{ 
				xmlhttp = false; 
			} 
		} 
	@else xmlhttp = false; 
@end @*/ 
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{ 
		try 
		{ 
			xmlhttp = new XMLHttpRequest(); 
		} 
		catch (e) 
		{ 
			xmlhttp = false; 
		} 
	} 

	return xmlhttp; 
}

function fb(){
	var A=null;
	try{
		A=new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch(e){
		try{
			A=new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch(oc){
			A=null
		}
	}
	if(!A&&typeof XMLHttpRequest!="undefined"){
		A=new XMLHttpRequest()
	}
	return A
}

function toggleStyle() {
	//toggleVisibility("divProgress","block:none");
	loop++;
	loop = loop % 2;
	if (loop==1) {
	//document.getElementById("divProgress").style.textDecoration = "overline"
	document.getElementById("divProgressH").style.textDecoration = "underline"
	document.getElementById("divProgressI").style.textDecoration = "underline"
	} else {
	document.getElementById("divProgressH").style.textDecoration = "none"
	document.getElementById("divProgressI").style.textDecoration = "none"
	//document.getElementById("divProgress").style.textDecoration = "underline"
	}
	if (toggleloop!=0) {
		window.setTimeout('toggleStyle()',1000);
	}
}

function managestatechange() {
	//alert("waiting");
	switch (oXMLHTTP.readyState) {
		case 1:
			toggleloop = 1;
//		    window.setTimeout('toggleStyle()',1000);
			var d = new Date();
			var t = d.getSeconds();
			//document.getElementById("divProgress").style.textDecoration = "blink";
			break;
		case 2:
			break;
		case 3:
			// Display a progress indicator of some kind, informing the
			// user that you are checking to see if the UserID exists
//			document.getElementById("divProgressI").style.display = "block";
//			document.getElementById("divProgressH").style.display = "block";
			//alert("state3");
			break;
	
		case 4:
			//if (oXMLHTTP.responseText == "exists") 
				toggleloop = 0;
					//alert("Sorry - the User ID " + targetDiv + " already exists.");
//				document.getElementById("divProgressH").style.display = "none";
//				document.getElementById("divProgressI").style.display = "none";
				target = document.getElementById(targetDiv);
				target.innerHTML=oXMLHTTP.responseText;
				// handleresponse(oXMLHTTP.responseText, target.innerHTML);
				//alert(target.innerHTML);
			break;
	}	
}

function xmlcombo_list(select, target, control) {

// Prepare the XMLHTTP object for a HTTP POST to our validation ASP page
//document.getElementById("divProgressI").style.display = "block";
//document.getElementById("divProgressH").style.display = "block";

selectname = select.name;
selectval = select.options[select.selectedIndex]['value'].replace('&','%26amp;');
targetDiv = target;

var sURL = "http://www.ffeuk.com/" + control  + selectname+"="+selectval;

//alert(sURL);
if (!oXMLHTTP)
{
	//alert("XML HTTP not enabled");
	//oXMLHTTP = new XMLHttpRequestX();
	//oXMLHTTP.onreadystatechange = managestatechange;
	//oXMLHTTP.open( "POST", sURL, false );
	rURL =  "http://www.ffeuk.com/approvals/approval_certification.php?action=refresh" + "&"+ selectname+"="+selectval ;
	if (selectname=='productname')
	{
		select2val = document.getElementById('producttype').options[document.getElementById('producttype').selectedIndex]['value'].replace('&','%26amp;');
		rURL = rURL + "&producttype=" + select2val;
	}
	window.location.href = rURL;
	return;
} else {
	oXMLHTTP.open( "POST", sURL, true );
	// Define an event handler for processing
	oXMLHTTP.onreadystatechange = managestatechange;
}

	
// Execute the request
try {
	oXMLHTTP.send(null);
}
catch (e) {
	alert(e);
	alert("Could not get list data at this time.");
	//document.getElementById("FirstName").focus;
}


}

function Trim(s) 
{

// test for empty or undefined string
if (s == undefined) {
	return '';
}

// Remove leading spaces and carriage returns
while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
{ s = s.substring(1,s.length); }

// Remove trailing spaces and carriage returns
while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
{ s = s.substring(0,s.length-1); }

return s;
}



// Create an instance of the XML HTTP Request object
//var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );

//var oXMLHTTP = getHTTPObject();

// these are commented out for now
//var oXMLHTTP = XmlHttp.create();
//var targetDiv;
//var toggleloop = 0;
//var loop = 0;
//var param=0;

