if (window != top) {
  isGoogle=document.location.href.indexOf('google.com');
  if (isGoogle == '-1') {
	  //document.location.href = 'http://www.a1comms.co.uk/gotoa1comms.html';
  }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function callBackWin(numEntered) {
  if (numEntered.length <=10) {
    alert('The number you entered is too short.\nPlease check that it is correct and try again.');
    return false;
  }
  var notNumber = /\D/;
  var telNum = '';
  var tempArray = numEntered.split(notNumber);
  for ( q=0; q<tempArray.length; q++ ) {
    telNum += tempArray[q];
  }
  if (((telNum.charAt(0) == '0') && (telNum.charAt(1) == '7')) || ((telNum.charAt(0) == '4') && (telNum.charAt(1) == '4') && (telNum.charAt(2) == '7'))) {
    alert('This appears to be a mobile phone number.\nPlease enter a land line number.');
  return false;
  } else {
    MM_openBrWindow('','cb','width=300,height=250')
    return true;
  }
}
function writeInput(type, size, maxlength, name, clas) {
  if (browser == 'Internet Explorer') {
    document.write('<input class=' + clas + ' type=' + type + ' size=' + size + ' maxlength=' + maxlength + ' name=' + name + '>')
  } else {
    document.write('<input class=' + clas + ' type=' + type + ' size=' + Math.round(size/5 * 2.5) + ' maxlength=' + maxlength + ' name=' + name + '>')
  }
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror')) {
  browser = "Konqueror";
  OS = "Linux";
}
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')) {
  browser = "Netscape Navigator"
  version = detect.charAt(8);
} else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS) {
  if (checkIt('linux')) OS = "Linux";
  else if (checkIt('x11')) OS = "Unix";
  else if (checkIt('mac')) OS = "Mac"
  else if (checkIt('win')) OS = "Windows"
  else OS = "an unknown operating system";
}
function checkIt(string) {
  place = detect.indexOf(string) + 1;
  thestring = string;
  return place;
}
function showfg(ids) {
  window.open ('/info_freegifts.php?ids=' + ids, 'freegifts', 'width=450,height=420,status=yes,scrollbars=yes,resizable=yes');
  return false;
}
function sshowfg(ids) {
  window.open ('/info_freegifts.php?ids=' + ids, 'freegifts', 'width=450,height=420,status=yes,scrollbars=yes,resizable=yes');
  return false;
}
function showsecnum() {
  window.open ('s/ecurity_number.ihtml', 'securitynumber', 'width=380,height=320,status=yes,scrollbars=auto,resizable=yes');
}
function extrasCheck(ftype,ecount,optional,thefield,exceptids,enames) {
	//alert(ftype+'\n'+ecount+'\n'+optional+'\n'+thefield);
	switch (ftype) {
		case 1: // Checkboxes
		  if (ecount == 1  && !optional) thefield.checked=true;
		  break;
		case 2: // Radio Buttons
      if (ecount == 1  && !optional) thefield.checked=true;
		  break;
		case 3: // Select
		  break;
	}
	cExceptions(thefield, exceptids, enames);
}
function cExceptions(tparent, exceptids, enames) {
	for (i=0; exceptids.length - 1 >= i; i++) {
		if ((exceptids[i] != 0) && (eval('document.forms.fdaddthis.network' + exceptids[i])) != null) {
			thiscb = eval('document.forms.fdaddthis.network' + exceptids[i]);
			if (thiscb.checked == true) {
				tparent.checked = false;
				alert('This extra can not be selected at the same time as\n - \''+enames[i]+'\'');
				return false;
			}
		}
	}
	return true;
}
function showInfo(r,pge,pid) {
  switch (pge) {
    case 't' :
      var fn='/info_tariff.php';
      break;
    case 'p' :
      var fn='/info_phone.php';
      break;
    case 'a' :
      var fn='/info_accessory.php';
      break;
    case 'd' :
      var fn='/info_delivery.php';
      break;
    case 'da' :
      var fn='/info_delivery_address.php';
      break;
    case 'i' :
      var fn='/info_insurance.php';
      break;
    case 'tc' :
      var fn='/info_terms.php';
      break;
    case 'if' :
      var fn='/info_insurance_faq.php';
      break;
    case 'id' :
      var fn='/info_new_gift_claims.php';
      break;
    case 'tm' :
      var fn='/info_tmob_business_advantages.php';
      break;
    case 'obb' :
      var fn='/orange_homebb_home.html';
      break;
    default :
      var fn=pge;
      break;
	}
	if (r) { fn='store/'+fn; }
	if ((pid.length !=0) && (pid != 0)) { var ps='?id='+pid } else { ps='' }
	if (fn) { window.open (fn+ps, 'a1_information', 'width=500,height=420,status=yes,scrollbars=yes,resizable=yes'); }
  return false;
}
function TROvr(obj) { obj.className = 'rowOver'; }
function TROut(obj) { obj.className = 'rowUp'; }

// TEMP FUNCTIONS
function sshowPhoneDets(ids) {
  window.open ('/layout_phone_details_popup.html', 'phonedetails', 'width=450,height=420,status=yes,scrollbars=yes,resizable=yes');
  return false;
}
function tog(t,ttype,classSwpObj,tClassOne,tClassTwo,htmlSwpObj,htmlOne,htmlTwo) {
  togDiv = document.getElementById(t);
  if (ttype == 'tr') {
    if (togDiv.style['display'] == 'none') {
      try { togDiv.style['display'] = 'table-row'; }
      catch(err) { togDiv.style['display'] = 'block'; }
    }
    else if ((togDiv.style['display'] == 'table-row') || (togDiv.style['display'] == 'block')) { togDiv.style['display'] = 'none'; }
  } else {
    if (togDiv.style['display'] == 'none') { togDiv.style['display'] = 'block'; }
    else if (togDiv.style['display'] == 'block') { togDiv.style['display'] = 'none'; }
  }
  if (classSwpObj && (classSwpObj != '') && ((tClassOne != '') && (tClassTwo != ''))) {
    var swapObj = document.getElementById(classSwpObj);
    if (swapObj.className == tClassOne) { swapObj.className = tClassTwo; }
    else if (swapObj.className == tClassTwo) { swapObj.className = tClassOne; }
  }

  if (htmlSwpObj && (htmlSwpObj != '') && ((htmlOne != '') && (htmlTwo != ''))) {
    var swapObj = document.getElementById(htmlSwpObj);
    if (swapObj.innerHTML == htmlOne) { swapObj.innerHTML = htmlTwo; }
    else if (swapObj.innerHTML == htmlTwo) { swapObj.innerHTML = htmlOne; }
  }
}
function quickFind(obj) {
	url = obj.options[obj.selectedIndex].value;
	if (url.length) {
		if (document.location.href.indexOf('store/') < 1) url = 'store/' + url;
		document.location.href=url;
	}
}