function setSubject()
{
	var qs = window.location.search.substring(1);
	var qsp = qs.split("&");
	if(qsp.length > 0)
	{
		var temp1 = qsp[0].split("=");
		document.getElementById('subject').value = unescape(temp1[1]);
	}
}
function bvOpen()
{
	var d = new Date();
	var hh = d.getHours();
	var mm = d.getMinutes();
	/*d.getDay()=SMTWTFS*/
	
	<!-- special xmas rules	-->
	var dayMonth = d.getDate() + '/' + (d.getMonth() + 1);
	if (dayMonth == '25/12' || (dayMonth == '26/12') || (dayMonth == '28/12') || (dayMonth == '1/1'))
		return false;
	
	if(hh < 9 || hh > 17 || (hh == 17 && mm > 30) || d.getDay() == 0 || d.getDay() == 6)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function CTA(option,size)
{
	CTA(option,size, '')
}


function getText()
{
	if(bvOpen())
	{
		return 'We\'re here now,<br/>so why not call us:';
	}
	else
	{
		return 'Sorry, we\'re out now. Tell us when, and we\'ll <a href="/we\'ll-call-you-back.html?subject=call-me-back"><strong>call you back.</strong></a>';
	}
}

function setCallClass()
{
	var ele = document.getElementById('cta_Right');
	var ele2 = document.getElementById('cta_Right2');

	if(bvOpen())
	{	
		ele.className = 'cta_right_L';
		ele2.className = 'cta_right_L';
	}
	else
	{
		ele.className = 'cta_right_L_Outside';
		ele2.className = 'cta_right_L_Outside';
	}
}

function CTA(option,size,loc)
{
	if(size=='S')
	{
		if(document.getElementById('CTA_LINK'))
		{
			var temp = document.getElementById('CTA_LINK').href;
			//loc = temp;

			var end = temp.indexOf('?');
			loc = temp.substring(0, end);
		}
		
		
	}
	var msg = "Get quote<br/>&amp; buy online";
	if(option==2) msg = "Get price<br/>indication";
	else if(option==3) msg = "Request a<br/>quote now";
	else if(option==4) msg = "Start<br/>claim online";
	
	document.write('<span class="CTA_LINK div_get_quote_'+size+'"><a ');
	document.write('id="CTA_LINK" href="'+ loc + '?occ='+size+'">' + msg + '</a></span>');
	document.write('<div class="div_or_call_us'+size+'">');
	
	if(bvOpen())
	{	
		if(size!='S')
		{
			document.write('We\'re here now, so why not call us: <br />0845 370 9044');
		}
		else
		{
			document.write('<div class="div_or_call_us_numberS">We\'re here now so why<br />not call us: '+getPhoneNo()+'</div>');
			
		}
		
		var arr = document.getElementsByName('cta_L_text');
		
		for(i=0; i<arr.length;i++)
		{
			document.getElementsByName('cta_L_text')[i].innerHTML = 'We\'re here now<br/>so why not call us:';
		}
	}
	else
	{
		if(size!='S')
		{
			document.write('<span style=\"font-size: 10px\">0845 370 9044 Mon-Fri 9am-5:30pm </span><br />Sorry we\'re out now. Tell us when and we\'ll<br /><a href="/we\'ll-call-you-back.html?subject=call-me-back">call you back.</a>');
		}	
		else
		{
			document.write('Sorry, we\'re out now. Tell us<br /> when and we\'ll <a href="/we\'ll-call-you-back.html?subject=call-me-back"><strong>call you back.</strong></a>');
		}	
		
		var arr = document.getElementsByName('cta_L_text');
		for(i=0; i<arr.length;i++)
		{
			document.getElementById('cta_L_text').innerHTML = 'Sorry, we\'re out now. Tell us<br /> when and we\'ll <a href="/we\'ll-call-you-back.html?subject=call-me-back"><strong>call you back.</strong></a>';
		}
	}
	document.write('</div>');
}
function CTA_CLAIM(option)
{
	if(option == 1)
	{
		if(bvOpen())
		{
			document.write('<div class="div_claim_call_'+option+'">');
			document.write('<h2>We\'re here so call us now..</h2>');
			document.write('<p>We find that we can get the best possible claim outcome for our customers when we spend time <b>talking</b>...</p>');
			document.write('<p>So, to claim: call us on <h3>0845 370 9030</h3> 9 to 5.30, Mon to Fri</p>');
			document.write('</div>');
			document.write('<div class="div_claim_online_'+option+'"><h2>..or start online</h2>');
			document.write('<p>Start your claim online with our <a href="Start-Claim-Online.html?subject=claim">simple form</a>.</p><p>We\'ll call you back (you choose when) to get some of the detail. More..</p></div>');
		}
		else
		{
			document.write('<div class="div_claim_call_'+option+'">');
			document.write('<h2>Start online &amp; we\'ll call you back</h2>');
			document.write('<p>We find that we can get the best possible claim outcome for our customers when we spend time <b>talking</b>. But, we have to go home <i>sometimes</i>. Sadly this is one of those times.</p>');
			document.write('<p>So start your claim online with our <a href="Start-Claim-Online.html?subject=claim">simple form</a>. We\'ll call you back (you choose when) to get some of the detail...</p>');
			document.write('</div>');
			document.write('<div class="div_claim_online_'+option+'"><h2>Or call later</h2>');
			document.write('<p>We\'re open from 9am until 5.30pm, Monday to Friday. Uk-based, no queues, no "press 1 for, press 2 for that..."</p><h2>'+getPhoneNo()+'</h2></div>');
		}
	}
	else
	{
		document.write('<div class="div_claim_call_'+option+'">');
		document.write('<h2>We\'re here, so call us now..</h2>');
		document.write('We find that...');
		document.write('</div>');
		document.write('<div class="div_claim_online_'+option+'"></div>');
	}
}
function blocking(nr)
{
	if (document.layers)
	{
		current = (document.layers[nr].display == 'none') ? 'block' : 'none';
		document.layers[nr].display = current;
	}
	else if (document.all)
	{
		current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
		document.all[nr].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
		document.getElementById(nr).style.display = vista;
	}
}

function querySt(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}

function showVariation(variation)
{
	document.getElementById('variation'+variation.toUpperCase()).style.display = '';
	var otherVariant = variation.toUpperCase() == 'A' ? 'B' : 'A';
	//document.getElementById('variation'+otherVariant).style.display = 'none';
	
}

function getProtocol()
{
	if("https:" == document.location.protocol)
		return "https";
	else 
		return "http"
}