<!-- for order scriptd -->
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

<!-- today orders ajax-->
function createAjaxObj()
	{
	var httprequest=false
	if (window.XMLHttpRequest)
		{ // if Mozilla, Safari etc
		httprequest=new XMLHttpRequest()
		if (httprequest.overrideMimeType)
		httprequest.overrideMimeType('text/xml')
		}
	else if (window.ActiveXObject)
		{ // if IE
		try {
			httprequest=new ActiveXObject("Msxml2.XMLHTTP");
			}
		catch (e)
			{
			try{
			httprequest=new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch (e){}
			}
		}
	return httprequest
	}
	


function confirmSubmit()
	{
		var agree=confirm("Please be Aware!\nYour IP address, computer connection port\n<?php echo $_SERVER[REMOTE_ADDR].' : '.$_SERVER[REMOTE_PORT] ?>\nand your host name\n<?php echo gethostbyaddr( $_SERVER[REMOTE_ADDR] ) ?>\nhas heen recorded. \nAre you sure you wish to continue?");
		if (agree)
			return true ;
		else
			return false ;
	}

			
function ClearPostBox()
	{	
		var post_fild = document.getElementById('post_field').value;
		if( post_fild=='Type your postcode' )
		{
		document.getElementById('post_field').value='';
		}
	}
<!-- end for order scripts-->

function check_and_send()
	{
	if ( document.getElementById('ad1').value.length>3 && document.getElementById('ad2').value.length>3  && document.getElementById('ad3').value.length>3  && document.getElementById('ad4').value.length>3  )
		{
		document.getElementById('button1').disabled=false;
		document.getElementById('button2').disabled=false;
		}
	else
		{
		document.getElementById('button1').disabled=true;
		document.getElementById('button2').disabled=true;			
		}
	
	}

function passGen(len,target)
	{


	ranNum =  (Math.floor(Math.random() * (100000 - 99999999)) + 99999999);

	document.getElementById(target).value=ranNum;
	}

function rewrite_add(to_revrite0 , to_revrite1, to_revrite2, to_revrite3, to_revrite4, to_revrite5, to_revrite6 , change_id)
	{
	document.getElementById('ad0').value=to_revrite0;
	document.getElementById('ad1').value=to_revrite1;
	document.getElementById('ad2').value=to_revrite2;	
	document.getElementById('ad3').value=to_revrite3;
	document.getElementById('ad4').value=to_revrite4;
	document.getElementById('ad5').value=to_revrite5;
	document.getElementById('ad6').value=to_revrite6;	
	if (change_id==1)
		{
		document.getElementById('abslist2').style.display='block';
		document.getElementById('abslist').style.display='none';
		}
	else
		{
		change('abslist');
		change('abslist2');			
		}
	}

function change(id) {

var identity=document.getElementById(id);

$( identity ).slideToggle('');


}

function change2(id,id2,admin_top) {
	
var identity;
var identity2;

identity=document.getElementById(id);
identity2=document.getElementById(id2);

if(admin_top=='1')
	{
	if(document.getElementById('p0') ) document.getElementById('p0').className='hide';
	if(document.getElementById('p2')) document.getElementById('p2').className='hide';
	if(document.getElementById('p3')) document.getElementById('p3').className='hide';
	if(document.getElementById('p7')) document.getElementById('p7').className='hide';
	if(document.getElementById('p1')) document.getElementById('p1').className='hide';
	if(document.getElementById('p12')) document.getElementById('p12').className='hide';
	
	if(document.getElementById('p0h')) document.getElementById('p0h').className='plus';
	if(document.getElementById('p2h')) document.getElementById('p2h').className='plus';
	if(document.getElementById('p3h')) document.getElementById('p3h').className='plus';
	if(document.getElementById('p7h')) document.getElementById('p7h').className='plus';
	if(document.getElementById('p1h')) document.getElementById('p1h').className='plus';
	if(document.getElementById('p12h')) document.getElementById('p12h').className='plus';
	}

if (identity.className=='hide')
	{
	identity.className='show';
	identity2.className='minus';	
	}
else
	{
	identity.className='hide';	
	identity2.className='plus';		
	}
}

function loadImages() 
	{
	if (document.getElementById) 
		{ 
		document.getElementById('hidepage').style.visibility = 'hidden';
		}
	else 
		{
		if (document.layers) 
			{ // Fox
			document.hidepage.visibility = 'hidden';
			}
		else 
			{ // IE 
			document.all.hidepage.style.visibility = 'hidden';
			}
		}
	}
	
function check (object,message)
	{
	if( message==undefined )
		{
			message='Please type full UK postcode.';
			}
		
	if ( document.getElementById(object).value.length<2 )
		{
		alert(message);
		return false;
		}
	return true;
	}
	
function checkentry (id,type)
	{
	var error =0;
	var show ='';
	var tel_num;
	
	if (document.getElementById( "ad1" ).value.length<1 )
		{
		error=1
		show =show + "  - House number or name.\n";
		}
	if (document.getElementById( "ad2" ).value.length<3 )
		{
		error=1
		show =show + "  - Street name\n";
		}		
	if (document.getElementById( "ad3" ).value.length<3 )
		{
		error=1
		show =show +  "  - City.\n";
		}		
	if (document.getElementById( "ad4" ).value.length<9 || document.getElementById( "ad4" ).value.length>12 || document.getElementById( "ad4" ).value.charAt(0)!='0' )
		{
		error=1
		show = show +  "  - Telephone number. eg. 01211234567\n";
		}	
	if (document.getElementById( "ad6" ).value.length<5)
		{
		error=1
		show =show +  "  - Post code.\n";
		}	
			
	if (error==1)
		{
		alert ( "Please fill all fields marked with star:\n" + show + '\n\n' );
		return false;
		}
	else
		{
		tel_num = document.getElementById("ad4").value;
		confirm_action = confirm("Your order will be not delivered or not ready for collection\nif your telephone number is not correct\nand you can't answer the phone.\n\n\ "+tel_num+" \n\nPlease confirm your telephone number.\n\nOK to continue. Cancel to change number.");	
		if (confirm_action==true)
			{
			return true;	
			}
		else
			{
			return false;	
			}
		
		}
	}
	
	
function startLiveSearch() {
var identity;

identity=document.getElementById('liveSearchBox');

if (identity.className=='hide')
	{
	identity.className='show';
	identity.innerHTML  ='<div>'+'<div style="margin-bottom:0px; padding:8px; background:#660000 url(/new/grayTr.png); color:#fff; border-bottom:1px solid #630">'+
	'<a style="float:right; color:#FFF" href="javascript:startLiveSearch()" >'+
	'<img src="/new/tango/16/emblems/emblem-unreadable.png" />'+
	'</a>'+
	'<b>LiveMeal&trade;</b>'+
	'</div>'+
	'<iframe  src="live.php"  style="width:510px; height:380px; margin:0px" name="livesearch" frameborder="0" id="live" marginwidth="0"></iframe>'+
	'</div>';
	}
else
	{
	identity.className='hide';
	identity.innerHTML  ='';
	}
}

function checkRevForm(box_id)
	{
	var str = document.getElementById(box_id).value;
		if( str.length >4 )
			{
			return true;
			}
		else
			{
			alert('You can not send empty reviews. \nThe review box should be completed before sending your comment.');
			return false;
			}
		}

<!-- add job form functions -->

  function checkuser(hoos)
  	{
  	var object = document.getElementById(hoos).value;
	if( object!='0' )
		{
		return true;
		}
	else
		{
		alert ('Please choose recipient first.');
		return false;
		}
  	}
	
	
	function moreemails()
		{
		var topass =new Array();
		var putnext = document.getElementById('more_emails_help').value 
		putnext = parseInt(putnext) + 1;
		
		document.getElementById('more_emails_help').value = putnext;	
		
		for (var si=1;si<putnext;si++)
			{
			var user_var = 'user_'+si;

			if( document.getElementById(user_var) )
				{
				topass[si] = document.getElementById(user_var).value;
				}				
			}
		
		var str = document.getElementById('more_emails_extra').value
		
		document.getElementById('more_emails').innerHTML= document.getElementById('more_emails').innerHTML + str.replace( /nextJavaUser/g,putnext );
		
		
		for (var si=1;si<putnext;si++)
			{
			var user_var = 'user_'+si;
			if( document.getElementById(user_var) )
				{
				document.getElementById(user_var).value=topass[si];
				}				
			}
			
		}	
	function removeemail(id,id2)
		{
		document.getElementById(id).value='0';
		document.getElementById(id2).className='hide';
		}
<!-- end add job form functions -->

function OnlyNumbers(id_name)	
	{
	var field = document.getElementById(id_name).value;
	field = field.replace(/[^0-9]/g,'');
	document.getElementById(id_name).value=field;
	return field
	}

<!-- print_div -->
function Print1Div(divid)
{
	var a = window.open('','','width=1,height=1,scrollbars=no');
	a.blur();
	a.document.open("text/html");
	a.document.write(document.getElementById(divid).innerHTML);
	a.print();
	a.close();
}	

function show1Div(divid)
{
	var a = window.open('','','width=1,height=1,scrollbars=no');
	a.blur();
	a.document.open("text/html");
	a.document.write(document.getElementById(divid).innerHTML);
}	



//check and redraw costomer format
function cleanString (str) {
	return str.replace(/[\(\)\.\-\s,]/g, "");
    }

function postit( field , result ){ //check postcode format is valid

 test = document.getElementById(field).value; 
 size = test.length
 test = test.toUpperCase(); //Change to uppercase
 if( size>3 )
 	{
	test=cleanString( test );
	test = test.substr( 0 , (size-4) )+' '+test.substr( (size-4) ,size );
	}
  	
 	document.getElementById(field).value = test; //write back to form field
 
 if (size < 5 || size > 8){ //Code length rule
  document.getElementById(result).innerHTML = ('<img src="/new/no.png" title="Not a valid postcode - wrong length" >');
  return false;
  }
 if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
   document.getElementById(result).innerHTML =('<img src="/new/no.png" title="Not a valid postcode - cannot start with a number" >');
   return false;
  }
 if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
   document.getElementById(result).innerHTML =('<img src="/new/no.png" title="Not a valid postcode - alpha character in wrong position" >');
   return false;
  }
 if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
   document.getElementById(result).innerHTML =('<img src="/new/no.png" title="Not a valid postcode - number in wrong position" >');
   return false;
  }
 if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
   document.getElementById(result).innerHTML =('<img src="/new/no.png" title="Not a valid postcode - number in wrong position" >');
   return false;
  }
 if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
   document.getElementById(result).innerHTML =('<img src="/new/no.png" title="Not a valid postcode - no space or space in wrong position" >');
   return false;
   }
 count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
 if (count1 != count2){//only one space rule
   document.getElementById(result).innerHTML = ('<img src="/new/no.png" title="Not a valid postcode - only one space allowed" >');
   return false;
  }
document.getElementById(result).innerHTML = ('<img src="/new/yes.png" >');

return test;
}

function findStreet(field,result,rtyp)
	{
	rtyp = typeof(rtyp) != 'undefined' ? rtyp : false;		
		
	var machvalue = document.getElementById('postID').value;
	var machto = machvalue.length ;
	var number = document.getElementById('numberIDpost').value;

	response = postit( field , result );
	
	if ( response )	
		{
		//document.getElementById('postID').value='OK';
		var pagelink= 'branch/pos/get_street_name.php' + '?post=' + machvalue + '&numb='+ number+'&number='+number+'&liveWebsite='+rtyp ;
		loadFragmentInToElement( pagelink , 'addressHolderList');		
		}
	}


	function loadFragmentInToElement(fragment_url, element_id, second_id) 
			{

			second_id = typeof(second_id) != 'undefined' ? second_id : false;
			
			var element = document.getElementById(element_id);
			var element2 = document.getElementById(second_id);
			element.innerHTML = element.innerHTML+'<div onclick="window.location.reload()" style="position:absolute; right:10px; top:10px;  padding-right:5px;"><img src="/new/jq/wait.gif" /></div>';
			xmlhttp.open("GET", fragment_url);
			xmlhttp.onreadystatechange = function() {
						if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
							{															
						 	var toPut = xmlhttp.responseText.split('[separator]');
						 	element.innerHTML = toPut[0];
							if( second_id!=false  ) { 
													var secParts = toPut[1].split('[secPart]');
													if( secParts[1]=='registering' ) { submitRegForm( secParts[2] ); };
													element2.innerHTML = secParts[0]; 
													};
								$('a.basic').cluetip( {sticky: true , width:490,activation:'click',closePosition:'title',dropShadowSteps:4 } );
								
								
								
								
								redrowForm('custFormId','ajaxdeataUser');
							} 
						}
			 xmlhttp.send(null);
			}
/* end customer related*/
//saba's code for filling the found address in the buxes on register page.
function addressFiller(){

	  var brokenstring=document.getElementById('adressDrop').value.split('|'); 
	   //house number
	 if( brokenstring[3] ) 	{
	   document.getElementById('numberIDpost').value = brokenstring[0];
	   //street name
	   document.getElementById('ADDRESS').value = brokenstring[1];
	   //city name
	   document.getElementById('City').value = brokenstring[2];
	   //postcode
	   document.getElementById('postID').value = brokenstring[3];
	
	   document.getElementById('addressHolderList').className = 'hide';
	   document.getElementById('addressHolderLisTxt').className = 'block';
	}
}			      

function redrowForm(id,result)
{
	$('#'+id).ajaxForm({ 
		target: '#'+result, 
		success: function() { $('#'+result).fadeIn('slow'); } 
	}); 
}

function clearBox(id)
	{
	if( document.getElementById(id) )	
		{
		document.getElementById(id).innerHTML='';
		}
	}

/*
Created: 20060120
Author:  Steve Moitozo <god at zilla dot us> -- geekwisdom.com
Description: This is a quick and dirty password quality meter 
		 written in JavaScript so that the password does 
		 not pass over the network.
License: MIT License (see below)
Modified: 20060620 - added MIT License
Modified: 20061111 - corrected regex for letters and numbers
                     Thanks to Zack Smith -- zacksmithdesign.com 
*/
function testPassword(passwd, target)
{
		var intScore   = 0
		var strVerdict = "weak"
		var strLog     = ""
		
		passwd=document.getElementById(passwd).value;
		
		// PASSWORD LENGTH
		if (passwd.length<5)                         // length 4 or less
		{
			intScore = (intScore+3)
			strLog   = strLog + "3 points for length (" + passwd.length + ")\n"
		}
		else if (passwd.length>4 && passwd.length<8) // length between 5 and 7
		{
			intScore = (intScore+6)
			strLog   = strLog + "6 points for length (" + passwd.length + ")\n"
		}
		else if (passwd.length>7 && passwd.length<16)// length between 8 and 15
		{
			intScore = (intScore+12)
			strLog   = strLog + "12 points for length (" + passwd.length + ")\n"
		}
		else if (passwd.length>15)                    // length 16 or more
		{
			intScore = (intScore+18)
			strLog   = strLog + "18 point for length (" + passwd.length + ")\n"
		}
		
		
		// LETTERS (Not exactly implemented as dictacted above because of my limited understanding of Regex)
		if (passwd.match(/[a-z]/))                              // [verified] at least one lower case letter
		{
			intScore = (intScore+1)
			strLog   = strLog + "1 point for at least one lower case char\n"
		}
		
		if (passwd.match(/[A-Z]/))                              // [verified] at least one upper case letter
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least one upper case char\n"
		}
		
		// NUMBERS
		if (passwd.match(/\d+/))                                 // [verified] at least one number
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least one number\n"
		}
		
		if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/))             // [verified] at least three numbers
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least three numbers\n"
		}
		
		
		// SPECIAL CHAR
		if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/))            // [verified] at least one special character
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least one special char\n"
		}
		
									 // [verified] at least two special characters
		if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/))
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least two special chars\n"
		}
	
		
		// COMBOS
		if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))        // [verified] both upper and lower case
		{
			intScore = (intScore+2)
			strLog   = strLog + "2 combo points for upper and lower letters\n"
		}

		if (passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/)) // [verified] both letters and numbers
		{
			intScore = (intScore+2)
			strLog   = strLog + "2 combo points for letters and numbers\n"
		}
 
									// [verified] letters, numbers, and special characters
		if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/))
		{
			intScore = (intScore+2)
			strLog   = strLog + "2 combo points for letters, numbers and special chars\n"
		}
	
	
		if(intScore < 6)
		{
		   strVerdict = '<span style="color:#990000">Weak</span>'
		}
		else if (intScore > 5 && intScore < 14)
		{
		   strVerdict = '<span style="color:#666600">Good</span>'
		}
		else if (intScore > 13 )
		{
		   strVerdict = '<span style="color:#006600">Strong</span>'
		}
	
	document.getElementById(target).innerHTML= (strVerdict);
	//document.forms.passwordForm.score.value = (intScore)
	//document.forms.passwordForm.verdict.value = (strVerdict)
	//document.forms.passwordForm.matchlog.value = (strLog)
	
}

/*check password field*/
function PassCheck(first, second)
	{

  	 if (document.getElementById( first ).value.length<4 )
		{
		document.getElementById( 'pass_confirm' ).className='hide';

		document.getElementById( first ).className='falseField';
		}
	else
		{
		document.getElementById( 'pass_confirm' ).className='block';

		document.getElementById( first ).className='trueField';

			if (document.getElementById( first ).value!= document.getElementById( second ).value)
				{
				document.getElementById( second ).className='falseField';
				}
			else
				{
				document.getElementById( second ).className='trueField';
				}
		}
}

function clearField(field)
	{
	document.getElementById( field ).value='';
	}
	
	
	/* jq slideshow*/
	
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 4000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 4000 );
});	

function showAddExtraInfo()
	{
	if( document.getElementById('addrExtra1').checked==true )
		{
		document.getElementById('addrExtraInfo').style.display='block';
		document.getElementById('addrBuildDesc').innerHTML='Building No./Name*';
		}
	else
		{
		document.getElementById('addrExtraInfo').style.display='none';
		document.getElementById('addrBuildDesc').innerHTML='House No.*';
		}
	}