
var Timer;
var text_length = 60
var max_length = 50;
var cur_length = 0;
var rate = 60;
var paused = false;

if( text_length > max_length ) { var required_length=text_length+max_length; }
else { var required_length=max_length+max_length; }
 
function ticker() {

  var tObj = document.getElementById("ticker"); 

  if( !paused ) { 

    cur_length+= 1;
    if( cur_length > required_length ) { cur_length = -max_length; }
  
    tObj.style.top = -cur_length;

  }

  Timer = setTimeout("ticker()",rate); 
}
function copyaddress(obj){
  var theForm = document.forms.theform;
  if(theForm.sameas.checked == true){
    theForm.clientbfname.value = theForm.clientfname.value;
    theForm.clientbsname.value = theForm.clientsname.value;
    theForm.clientbaddress1.value = theForm.clientaddress1.value;
    theForm.clientbaddress2.value = theForm.clientaddress2.value;
    theForm.clientbtown.value = theForm.clienttown.value;
    theForm.clientbcounty.value = theForm.clientcounty.value;
    theForm.clientbpostcode.value = theForm.clientpostcode.value;
  }
}
function open_window_centred(win_url, win_name, win_w, win_h, styles)
{
  var win_left = (screen.width - win_w) / 2;
  var win_top = (screen.height - win_h) / 2;
  
  var win_style = (styles == undefined)? '' : styles + ', ';
  
  win_style += 'width=' + win_w;
  win_style += ',height=' + win_h;
  win_style += ',left=' + win_left;
  win_style += ',top=' + win_top;

  var newwin = window.open(win_url, win_name, win_style);
  newwin.focus();
  return;
}
function removefrombasket(basketid)
{
window.location.href='ecom/ecom_data.php?dw=removefrombasket&basketid=' + basketid;
}


var _w = null;
function createNew(thispic) {
mypic = thispic;
  _w = window.open();
  _w.document.open();
_w.document.write('<html><head><title>Full Image Preview</title></head><body><a href="javascript:window.close();">Close Window</a><br>');
  _w.document.write('<img src = "');
  _w.document.write (mypic);
  _w.document.write ('">');
  
  _w.document.write('</body></html>');
  _w.document.close();
}

function LargePic(pic, x, y, prodid) {
  if (!x) x=800;
  if (!y) y=600;
  var settings="location=no,scrollbars=no,status=no,resizeable=no,top=30,left=100,width="+x+",height="+y;
  window.open("/eshop/ecom_largepic.php?pic="+pic+"&productid="+prodid, "", settings);
}


function chkcheckout1()
{
fieldlist=new Array();
fielderrorlist=new Array();

fieldlist = ["clientfname","clientsname","clientaddress1","clienttown","clientpostcode","clientemail"];
fielderrorlist = ["First Name","Surname","Address","Town","Postcode","Email"];

for (i=0; i < fieldlist.length; i++){
formitem=fieldlist[i];
if (document.forms.theform[formitem].value.length<3){
alert("Please ensure " + fielderrorlist[i] + " is entered!");
document.forms.theform[formitem].focus();
return false;
break;
}
}
}
function countryselect(thisone)
{
  var inc=document.searchbox.searchcountry.selectedIndex;
  var itemc=document.searchbox.searchcountry.options[inc].value;
parent.location.href=("index.php?p=<?php echo $p?>&opt=getcountys&searchcountry=" + itemc);
}
function countyselect(thisone)
{
  var inc=document.searchbox.searchcountry.selectedIndex;
  var itemc=document.searchbox.searchcountry.options[inc].value;
  var ind=document.searchbox.searchcounty.selectedIndex;
  var item=document.searchbox.searchcounty.options[ind].value;
if(item != ''){
parent.location.href=("index.php?p=<?php echo $p?>&op=gettowns&searchcounty=" + item + "&searchcountry=" + itemc );
}
}
