/* Using to empty text fields with default values assigned e.g. search field */
function empty_field(field, value)
{
	if (field.value == value)
		field.value = '';
}

/* hides the language select form and writes the language bar code to the page if javascript is enabled */
function language_check()
{
	html = '<ul><li id="current_lang">English</li><li id="lang_image"><a href=""><img src="/images/choose_language.gif" width="67" height="8" alt="Choose your language" /></a></li></ul>';
	document.write(html);
}

/* displays the lightbox enabled accessories link if javascript is enabled */
function accessories_check(id)
{
	html = '<p class="accessories"><a href="accessorise_lb.asp?id=' + id + '" class="lbOn"><img src="../images/buy_accessories.gif" alt="Buy accessories for this phone" /></a></p>';
	document.write(html);
}

function load_price_plans()
{
	document.getElementById('bill_pay_price_plans').style.display = 'none';
	a = new Array('payg_plans_second', 'bill_pay_plans_first');
	for(x = 0; x < a.length; x++)
	{
		document.getElementById(a[x]).style.display = 'block';
	}
	if (/MSIE 6/.test(navigator.userAgent)) {pos = '93px'} else {pos = '101px'}
	document.getElementById('bill_pay_plans_second').style.left = pos;
}

active_plan = 'payg_price_plans';

function switch_price_plan(div)
{
	if (active_plan != div)
	{
		document.getElementById(div).style.display = 'block';
		document.getElementById(active_plan).style.display = 'none';
		active_plan = div;
	}
}

function validate_fields(fields)
{
	for(x = 0; x < fields.length; x++)
	{
		fields[x].value = fields[x].value.replace(/[^0-9]/g, '');
	}
}

/* Mobile Email */
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
	return false;
}

/* Site Search */
$(document).ready(function() {
	$('#site_search_query_field').focus(function() {
		$(this).css('background-image', 'url(/images/search_form_bg.gif)');
	}).blur(function() {
		$field = $(this);
		if ($field.val() == "") {
			$field.css('background-image', 'url(/images/search_form_bg_google.gif)');
		}
	})
});