


var toolTip = new Array();
//rollovers for products
toolTip[0] = 'Our flagship site insurance product for self builders.';
toolTip[1] = 'If you are buying the land but not starting work.';
toolTip[2] = 'Covering you for faulty design, materials and workmanship.';
toolTip[3] = "For when you are building close to other people's properties.";
toolTip[4] = 'To protect against Defective Titles and Restrictive Covenants.';
toolTip[5] = 'In case you fall ill or get injured during the build.';
toolTip[6] = "Protect your dream home once you've finished work.";
toolTip[7] = "Site insurance product for developers.";

toolTip[8] = "Review Self-builder's range of site insurance products.";
toolTip[9] = "All our products for self builders.";
toolTip[10] = "All our products for property developers.";



function startWhatInsurance()
	{
	
	
	hideAllProductGroups();
	hideAllProducts();
	
	
	showProductGroup(0);

	//show javascript only links
    var divWhatInsuranceTabs = document.getElementById('divWhatInsuranceTabs');
    var divIntroGroup1 = document.getElementById('divIntroGroup1');
    var divIntroGroup2 = document.getElementById('divIntroGroup2');
    
	divWhatInsuranceTabs.style.display = 'block';	
	
	}
	
	
function hideAllProducts()
    {

    var i=0;
	while (document.getElementById('product' + i))
		{
        var product = document.getElementById('product' + i);
        product.style.display = 'none';
         i++;
        }
    
    }

function hideAllProductGroups()
    {

	for (var i = 0; i < 3; i++)
		{ 
		//reset all tabs
		var lnkProductGroup = document.getElementById('lnkProductGroup' + i);
		lnkProductGroup.className = 'inactive';

		//var divIntroGroup = document.getElementById('divIntroGroup' + i);
		//divIntroGroup.style.display = 'none';
		} 
    
    }



function showProductGroup(groupID)
	{
	
	hideAllProductGroups()
	
	
        //declare 3 key products so we can size them
        var strNarrowWidth = '187px';    
        var strWideWidth = '292px';

        
        var product0 = document.getElementById('product0');
        var product7 = document.getElementById('product7');
        var product1 = document.getElementById('product1');
        var divWhatInsuranceKeyProducts = document.getElementById('divWhatInsuranceKeyProducts');
        var divWhatInsuranceKeyProductsBottom = document.getElementById('divWhatInsuranceKeyProductsBottom');
	
	    var lnkProductGroupCurrent = document.getElementById('lnkProductGroup' + groupID);
			
		//show current options		
		var lnkProductGroupCurrent = document.getElementById('lnkProductGroup' + groupID);
		lnkProductGroupCurrent.className = 'active';
			
	 switch (groupID)
					{
					case 1:
						showProduct('0 1 2 3 4 5 6');
						product0.style.width = strWideWidth;
						product7.style.width = strWideWidth;
						product1.style.width = strWideWidth;
						divWhatInsuranceKeyProducts.style.backgroundImage = "url('../images/bg_keyproduct_sb.gif')"; 
						divWhatInsuranceKeyProductsBottom.style.backgroundImage = "url('../images/bg_keyproduct_sb_bottom.gif')"; 
						break
						
						
					case 2:
						showProduct('7 1 3 4 5');
						product0.style.width = strWideWidth;
						product7.style.width = strWideWidth;
						product1.style.width = strWideWidth;						
						divWhatInsuranceKeyProducts.style.backgroundImage = "url('../images/bg_keyproduct_pd.gif')"; 
						divWhatInsuranceKeyProductsBottom.style.backgroundImage = "url('../images/bg_keyproduct_pd_bottom.gif')"; 						
						break

					default: //	0
						showProduct('0 7 1 2 3 4 5 6');
						product0.style.width = strNarrowWidth;
						product7.style.width = strNarrowWidth;
						product1.style.width = strNarrowWidth;
						divWhatInsuranceKeyProducts.style.backgroundImage = "url('../images/bg_keyproduct.gif')"; 
						divWhatInsuranceKeyProductsBottom.style.backgroundImage = "url('../images/bg_keyproduct_bottom.gif')"; 
						break
						
					}
					
	}


function showProduct(productIDs)
    {
    
    //alert('productIDs' + productIDs);
	hideAllProducts();
	
	productIDs += ''; //make sure it's a string
	
	if (productIDs != '')
		{
		productIDs = productIDs + '';	
		var myArray = productIDs.split(' ');
		
		//alert('myArray.length' + myArray.length);
				
		for (var i = 0; i < myArray.length; i++)
			{ 
			var currentProduct = document.getElementById('product' + myArray[i]);
			currentProduct.style.display = 'block';
			} 
	      
//		var rolloverText = document.getElementById('rolloverText');
//		rolloverText.className = 'downArrow';
//		rolloverText.innerHTML = '';

		}

	
    
    }
        
//    
//function rollText(intProductID)
//	{
//	//alert('rollText' + intProductID);
//	var rolloverText = document.getElementById('rolloverText');
//	rolloverText.innerHTML = '<p>' + toolTip[intProductID] + '</p><p class="callToAction">Click now for more information.</p>';
//	rolloverText.className = 'rollText';
//	

//	
//	
//	}

//function clearText()
//	{
//	var rolloverText = document.getElementById('rolloverText');
//	rolloverText.innerHTML = '';
//	rolloverText.className = '';
//	
//	}


	
			
			
