//0: box invisible; 1: box visible; 2: box transitioning
var State = 0;
var currentTag = '';
var theInterval;
var op = 0;
var headers = new Array();
headers[0] = "No Power Source Required";
headers[1] = "Install and Forget";
headers[2] = "Constant Supply of Water";
headers[3] = "Treated Water Safe To Drink";
headers[4] = "How it Works";
headers[5] = "Descale Existing System";
headers[6] = "1 Year Money Back Guarantee";
var paras = new Array();
paras[0] = "As the housetron works in the same way as a battery it requires no power source, that means no electrician to install a power line, no recharging batteries, no electrical faults leading to halt in treatment.";
paras[1] = "Housetron is an in-line conditioner and takes about 15 minutes to install. Once installed the Housetron will need no further maintenance that's right there is no service cost, no salt refilling, just let the Housetron look after itself and it's guaranteed for 3 years!";
paras[2] = "No backwashing means a constant supply of water, there is also no need for a separate drainage system.";
paras[3] = "Softened water is not fit for human consumption. Our catalytic treated water is certified safe for human consumption.";
paras[4] = "Houstron works like a battery, generating a very small electrical current as water passes through it. This electrical current  has the effect of neutralising the particles of calcium carbonate in water that would otherwise  cause scaling. These particles  just stay in the water and instead of sticking to pipework and hot water cylinders just pass harmlessly through the system and down the drain.";
paras[5] = "A side effect of Housetron is to gradually remove existing deposits. Do not expect this to happen overnight this process can take several weeks or months depending on how bad the build up has been. The size of the unit required depends on the pipe it is plumbed into e.g. if a rising mains is 3/4\" (22mm) a 22mm Housetron will be required.";
paras[6] = "An unconditional guarantee. If you are not happy any time within one year of buying your housetron return it to us for a full refund or free replacement.";


function displ(tag)
{
 
    if(State == 0)
    {
    	State = 2;
    	currentTag = tag;
    	if(tag == 6 || tag == 4)
    	{
    	    /*if(document.all && document.getElementById("benefitBoxIEbg").currentStyle.display == "block")
	    {
		document.getElementById("benefitBox").style.filters = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/redbenefitbg.png",sizingMethod="image")';
	    }
	    else
	    {*/
	    
	    document.getElementById("benefitBox").style.backgroundImage = (document.all) ? 'url("images/IEredbenefitbg.png")' : 'url("images/redbenefitbg.png")';
    	    
    	}
    	else 
    	{
    	    /*if(document.all && document.getElementById("benefitBoxIEbg").currentStyle.display == "block")
	    {
	    	document.getElementById("benefitBoxIEbg").style.filters = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/benefitbg.png",sizingMethod="image")';
	    }
	    else
	    {
	    	document.getElementById("benefitBox").style.backgroundImage = 'url("images/benefitbg.png")';
    	    }*/
    	    document.getElementById("benefitBox").style.backgroundImage = (document.all) ? 'url("images/IEbenefitbg.png")' : 'url("images/benefitbg.png")';
    	}
    	document.getElementById("benefitBox").style.display = "block";
    	fadeup();
    }
    return false;
}
/*    clearInterval(servp[pres]);
    var hold = new String;

    hold = "fadeout(" + pres + "," + tag + ")";
    
    servp[pres] = setInterval(hold,10);
    
    

    hold = "ser" + tag;
    document.getElementById(hold).style.display = "block";
    
    return false;
}
*/

function hide()
{
    if(State == 1)
    {
    	State = 2;
    	fadedown();
    }
    return false;
}

function fadeup()
{
    document.getElementById("benefitBox").firstChild.firstChild.nodeValue = headers[currentTag];
    document.getElementById("benefitBox").lastChild.firstChild.nodeValue = paras[currentTag];
    clearInterval(theInterval);
    theInterval = setInterval("fadein()",20);
}

function fadedown()
{
    clearInterval(theInterval);
    theInterval = setInterval("fadeout()",30);
}

function fadeout()
{
    if(op > 0)
    {
    	op -= 10;
    	changeops();
    }
    else
    {
    	State = 0;
    	clearInterval(theInterval);
    	document.getElementById("benefitBox").style.display = "none";
    }
}

function fadein(id)
{
    if(op < 100)
    {
    	op += 10;
    	changeops();
    }
    else
    {
    	State = 1;
    	clearInterval(theInterval);
    }
}

function changeops()
{
	if(document.all)
	{
	    document.getElementById("benefitBox").filters[0].opacity = op;
	}
	else
	{
	    document.getElementById("benefitBox").style.opacity = op / 100;
	    document.getElementById("benefitBox").style.MozOpacity = op / 100;
	    document.getElementById("benefitBox").style.KhtmlOpacity = (op / 100);
    	}
}
