Pageitemmax = 9;


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 clearproductno(){
ele = document.getElementById('In2_Productno');
if(!ele) return;
ele.value = "";
}

function getrange(id){
searchignore();
document.formName.action = 'items.php';
document.formName.In2_rangeid.value=id;
document.formName.In2_nav.value = 0;
document.formName.submit()
}

function getrangeanditem(id1,id2){
searchignore();
document.formName.action = 'product.php';
document.formName.In2_rangeid.value=id1;
document.formName.In2_itemid.value=id2;
document.formName.submit()
}

function getitemonly(id1,id2){
searchignore();
document.formName.action = 'product.php';
document.formName.In2_itemid.value=id2;
document.formName.In2_rangeid.value=id1;
document.formName.finditem.value=id2;
document.formName.In2_hero.value=id2;
document.formName.submit()
}

function finditems(id){
searchclear();
document.formName.action = 'items.php';

aDiv = document.getElementById('finditem');
if(aDiv) aDiv.value = id;

document.formName.In2_rangeid.value='0';
document.formName.In2_nav.value = 0;

document.formName.submit()
}

function findroomitems(id){
searchclear();
document.formName.action = 'ranges.php';

aDiv = document.getElementById('finditem');
if(aDiv) aDiv.value = '';

document.formName.roomchoice.value=id;
document.formName.In2_rangeid.value='0';
document.formName.In2_nav.value = 0;
document.formName.submit()
}

function search(){
searchignore();
document.formName.finditem.value='';
document.formName.roomchoice.value='0';
document.formName.In2_rangeid.value='0';

document.formName.In2_nav.value = 0;
document.formName.action = 'items.php';

document.formName.submit()
}


function searchignore(){
document.formName.In2_hero.value='';

ele = document.getElementById('In2_Productno');
if(ele && ele.value=='product number') ele.value = '';

ele = document.getElementById('In2_Search');
if(ele && ele.value=='Description  e.g. ‘table wood’') ele.value = '';

ele = document.getElementById('In2_Maxwidth');
if(ele && ele.value=='Max Width') ele.value = '';

ele = document.getElementById('In2_Maxheight');
if(ele && ele.value=='Max Height') ele.value = '';

ele = document.getElementById('In2_Maxdepth');
if(ele && ele.value=='Max Depth') ele.value = '';
}

function searchclear(){
ele = document.getElementById('In2_Productno');
if(ele) ele.value = '';

ele = document.getElementById('In2_Search');
if(ele) ele.value = '';

ele = document.getElementById('In2_Maxwidth');
if(ele) ele.value = '';

ele = document.getElementById('In2_Maxheight');
if(ele) ele.value = '';

ele = document.getElementById('In2_Maxdepth');
if(ele) ele.value = '';
}


function getimage(n){
path = In2ItemImagelist[n]
return (path);
aDiv = document.getElementById('IM1');
if(aDiv) aDiv.innerHTML =  path;
}

function In2_setmouseovermenu(obj){
obj.className = 'in2_menu_over';
}

function In2_setmouseoutmenu(obj){
obj.className = 'in2_menu_out';
}

function In2_navn(){

searchignore()
var v = 0;
var recs = 0;
v = parseFloat(document.formName.In2_nav.value);
recs = parseFloat(document.formName.In2_navtotal.value);
v = v + parseFloat(Pageitemmax);
if(v>=recs){
	return;
	}

document.formName.In2_nav.value = v;
document.formName.In2_jump.value = 'navjump';

document.formName.submit()
}

function In2_navprev(){

searchignore()
var v = 0;
v = parseFloat(document.formName.In2_nav.value);
if(v==0) return;
v = v - parseFloat(Pageitemmax);

if(v<0) v=0;
document.formName.In2_nav.value = v;
document.formName.In2_jump.value = 'navjump';

document.formName.submit()
}

function linkpage(page){
if(page==1) alert('This could link to the home page of your existing web site\nwhich might be on a totally different server to your X-Margin            \nand this web catalogue\n\n\nPlease phone Jez for more details on 0116 2664464\nor email jez@in2retail.com');

if(page==2) alert('This could link to the about-us page of your existing web site\nwhich might be on a totally different server to your X-Margin            \nand this web catalogue\n\n\nPlease phone Jez for more details on 0116 2664464\nor email jez@in2retail.com');

if(page==3) alert('This could link to the contact page of your existing web site\nwhich might be on a totally different server to your X-Margin            \nand this web catalogue\n\n\nPlease phone Jez for more details on 0116 2664464\nor email jez@in2retail.com');
}


function usesearchboxes(){
document.formName.In2_rangeid.value='';
document.formName.In2_itemid.value='';
document.formName.In2_nav.value='';
document.formName.finditem.value='';
document.formName.roomchoice.value='';
document.formName.submit()
}

function init(){
aDiv = document.getElementById('In2_navmax');
if(aDiv) aDiv.value = Pageitemmax;

s = document.forms[0].In2_search_desc.value;
if(s){
	ele = document.getElementById('In2_Search');
	if(ele) ele.value = s;
     }


s = document.forms[0].In2_search_prodnumber.value;
if(s){
	ele = document.getElementById('In2_Productno');
	if(ele && ele.value=='product number') ele.value = s;
     }
}


function getcustom(n){
if(n==1){
	document.formName.action = 'http://www.olympianliving.net/contact_us.php';
	document.formName.submit()
	}
}

window.onload = init;
