var http='http://flbs/';
var https='https://flbs/';
function account_statechange()
{
	
	}
  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
function statechange()
{
if  (document.accountupdate.state.value!='')
{
document.accountupdate.country.value='Australia';
} else { document.accountupdate.country.value='';; }
}
function accountrychange()
{
if  (document.accountupdate.country.value!='Australia')
{
document.accountupdate.state.value='';
document.accountupdate.ausstate.value='';
document.getElementById('ausid').style.display='none';
document.getElementById('intid').style.display='inline';
} else
{
document.accountupdate.ausstate.value='';
document.accountupdate.state.value='';
document.getElementById('ausid').style.display='inline';
document.getElementById('intid').style.display='none';
	
	}
}function icountrychange()
{
if  (document.nameadd.country.value!='AUS')
{
document.getElementById('ausonly').style.display='inline';
document.getElementById('bstate').style.display='inline';
document.getElementById('bstate').value='';
document.getElementById('ausonly').value='';
} else { document.getElementById('bstate').style.display='inline';
document.getElementById('ausonly').style.display='inline';
document.getElementById('bstate').value='';
document.getElementById('ausonly').value='';
}
}
function dcountrychange()
{
if  (document.nameadd.dcountry.value!='AUS')
{
document.getElementById('pobox').style.display='block';
document.nameadd.dstate_code.value='';
document.getElementById('dausonly').style.display='inline';
document.getElementById('sstate').style.display='inline';
document.getElementById('sstate').value='';
document.getElementById('dausonly').value='';
} else { document.getElementById('sstate').style.display='inline';
document.getElementById('pobox').style.display='none';
document.getElementById('dausonly').style.display='inline'; 
document.getElementById('sstate').value='';
document.getElementById('dausonly').value='';
document.nameadd.dstate_code.value='';
}
}
function showbigmenu()
{
createCookie('bigleftmenu',"yes",0.1);
window.location.reload();
}
function showsmallmenu()
{
eraseCookie('bigleftmenu');
window.location.reload();
}
function combosubmit()
{
  	var l=document.getElementById("lang_combo");
	var g=document.getElementById("group_combo");
    var c=document.getElementById("cat_combo");
    var t=document.getElementById("type_combo");
    var f=document.getElementById("format_combo");
f.disabled=false;
t.disabled=false;
c.disabled=false;
g.disabled=false;
l.disabled=false;
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function combo_put()
{
var s=1;
var d=document;
var k='';
var l=''+d.getElementById('lang_combo').value;
var g=''+d.getElementById('group_combo').value;
var c=''+d.getElementById('cat_combo').value;
var t=''+d.getElementById('type_combo').value;
var f=''+d.getElementById('format_combo').value;
var b=''+document.combo.base.value;
var n=''+document.combo.region.value
var y=''+document.combo.country.value;
var o=''+document.combo.sort.value;
//alert('search.php?s=1&l='+l+'&k='+k+'&g='+g+'&c='+c+'&t='+t+'&f='+f+'&b='+b+'&n='+n+'&y='+y+'&o='+o);
window.location='search.php?s=1&l='+l+'&k='+k+'&g='+g+'&c='+c+'&t='+t+'&f='+f+'&b='+b+'&n='+n+'&y='+y+'&o='+o;
	}
function cs(base)
{
var d = document.combo;
d.base.value=base;
combosubmit();
combo_put();
//d.submit();
}
function keywords2()
{
if ((document.getElementById('quick_search').value=='') && (document.getElementById('language_dropdown').value=='')) {  alert ('At least a keyword or a language is required.');   document.getElementById('quick_search').value = 'enter ISBN or keyword(s) of title or author to search' ; return false; } else { 
  var lang
  var keys
  lang=document.getElementById('language_dropdown').value;
  keys=escape(document.getElementById('quick_search').value);
  window.location='testing.php?l='+lang+'&k='+keys;
}
}
function keywords()
{
if ((document.getElementById('quick_search').value=='') && (document.getElementById('language_dropdown').value=='')) {  alert ('At least a keyword or a language is required.');   document.getElementById('quick_search').value = 'enter ISBN or keyword(s) of title or author to search' ; return false; } else { 
  var d=document.searchdata;
  d.action='quicksearch.php';
  d.searchtype.value=0;
  d.lang.value=document.getElementById('language_dropdown').value;
  d.group.value='';
  d.cats.value='';
  d.typ.value='00';
  d.binding.value='';
  d.region.value='';
  d.base.value=0;
  d.country.value='';
  d.keywords.value=document.getElementById('quick_search').value;
  d.submit();
}
}
    function redir(where)
  {
  var ss=https;
  var url='';
  if ((where=='checkout.php') || (where=='checkout2.php') || (where=='placeorder.php')) { url=ss+'' ; }
  
  document.redirect.action=url+where;
  document.redirect.submit();
}
function addcart1(code,qty)
{
document.addcart.action="addcart1.php"
document.addcart.code.value=code
document.addcart.qty.value=qty
document.addcart.submit()
}
function narrow()
{
document.combo.action='search.php';
document.combo.submit();
}

function search(searchtype, lang, group, cat, type, format, base,region,country)
  {
  var d=document.combo;
  d.action='search.php';
  d.searchtype.value=searchtype;
  d.lang.value=lang;
  d.group.value=group;
  d.cats.value=cat;
  d.typ.value=type;
  d.binding.value=format;
  d.base.value=base;
  d.region.value=region;
  d.country.value=country;
 d.submit();
  }
  function search1(searchtype, lang, group, cat, type, format, base,region, country)
  {
  var d=document.searchdata;
  d.action='search.php';
  d.searchtype.value=searchtype;
  d.lang.value=lang;
  d.group.value=group;
  d.cats.value=cat;
  d.typ.value=type;
  d.binding.value=format;
  d.base.value=base;
  d.region.value=region;
  d.country.value=country;
 d.submit();
  }
  function browse(lang,cat,row)
   {
  document.despatcher.action='browse.php'
  document.despatcher.lang.value=lang;
  document.despatcher.cat.value=cat;
  document.despatcher.baserow.value=row;
  //document.despatcher.sessid.value=sesame();
  document.despatcher.submit();
  }
  function depsearch(cat,row)
  {
  document.despatcher.action='depsearch.php'
  document.despatcher.cat.value=cat;
  document.despatcher.baserow.value=row;
  document.despatcher.submit();
 }
 function travel(conty)
 {
  document.despatcher.action='depsearch.php'
  document.despatcher.cat.value=conty;
  document.despatcher.baserow.value=0;
  document.despatcher.submit();

 }
function onsale(code) {
var x=code;
if (window.showModalDialog) {
window.showModalDialog("onsale.php?code="+x,"onsale",
"dialogWidth:400px;dialogHeight:150px;dialogLeft:400px;dialogTop:300px;location:NO;status:NO;");
} else {
var w=window.open('onsale.php?code='+x,'onsale','height=150,width=400,modal=YES,resizable=YES,scrollbars=0,location=no,status=no,menubar=0,toolbar=0,left=400,top=300'); w.focus();
}
} 