// JavaScript Document
function showhelp(s1,s2,s3,s4,s5,s6)
{
  s1.style.display ='inline';
  s2.style.display ='none';
  s3.style.display ='none';
  s4.style.display ='none';
  s5.style.display ='none';
  s6.style.display ='none';
}

function FP_popUpMsg(msg) {//v1.0
 alert(msg);
}

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_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_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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert(errors);
  document.MM_returnValue = (errors == '');
}

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 YY_checkform() { //v4.06
//copyright (c)1998,2001 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        if (!(myV/1)||myV<args[i+1].split('_')[0]/1||myV > args[i+1].split('_')[1]/1){addErr=true}
      }
      if ((myV.length>0)&&(args[i+2]==2)&&!myV.match("^[\\w\\.=-_]+@[\\w\\.-_]+\\.[a-z]{2,4}$")){addErr=true}// email
      if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      }
      if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      }
      if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
      if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      }
      if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    }else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    }else
    if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    }else
    if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else
    if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}
function popitup(url, width, height)
{
	newwindow=window.open(url,'name','height=600,width=600');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popupPicturef(pictureURL, width, height, justPicture) {
  if (justPicture) {
    var frame = window.open('', '', 'width='+width+',height='+height+',scrollbars=0,location=0,menubar=0,resizable=0');
    frame.document.write(
    	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '
      	+'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
      	+'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
      	+'  <head>\n'
      	+'    <title>fromstoneage.com : Product Galery</title>'
  		+'<style type="text/css">body {margin: 0px} </style>\n'
      +'    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n'
      +'  </head>\n'
      +'  <body onclick="self.close( )">\n'
      +'    <div style="margin: 0px; background:url('+pictureURL+')">\n'
      +'      <img src="gallery/blank.gif" width="'+width+'" height="'+height+'" alt="Product Galery [ Click to Close ]" />\n'
      +'    </div>\n'
      +'  </body>\n'
      +'</html>'
    );
    return true;
  } else {
    window.open(pictureURL, '', 'width='+width+',height='+height+',scrollbars=1,location=0,menubar=0,resizable=1');
  }
}
function popupPicture(pictureURL, width, height, justPicture) {
  if (justPicture) {
    var frame = window.open('', '', 'width='+width+',height='+height+',scrollbars=0,location=0,menubar=0,resizable=0');
    frame.document.write(
    	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '
      	+'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
      	+'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
      	+'  <head>\n'
      	+'    <title>fromstoneage.com : Product Galery</title>'
  		+'<style type="text/css">body {margin: 0px} </style>\n'
      +'    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n'
      +'  </head>\n'
      +'  <body onclick="self.close( )">\n'
      +'    <div style="margin: 0px; background:url('+pictureURL+')">\n'
      +'      <img src="../gallery/blank.gif" width="'+width+'" height="'+height+'" alt="Product Galery [ Click to Close ]" />\n'
      +'    </div>\n'
      +'  </body>\n'
      +'</html>'
    );
    return true;
  } else {
    window.open(pictureURL, '', 'width='+width+',height='+height+',scrollbars=1,location=0,menubar=0,resizable=1');
  }
}
function popupPicture2(pictureURL, width, height, justPicture) {
  if (justPicture) {
    var frame = window.open('', '', 'width='+width+',height='+height+',scrollbars=0,location=0,menubar=0,resizable=0');
    frame.document.write(
    	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '
      	+'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
      	+'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
      	+'  <head>\n'
      	+'    <title>fromstoneage.com : Product Galery</title>'
  		+'<style type="text/css">body {margin: 0px} </style>\n'
      +'    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n'
      +'  </head>\n'
      +'  <body onclick="self.close( )">\n'
      +'    <div style="margin: 0px; background:url('+pictureURL+')">\n'
      +'      <img src="gallery/blank.gif" width="'+width+'" height="'+height+'" alt="Product Galery [ Click to Close ]" />\n'
      +'    </div>\n'
      +'  </body>\n'
      +'</html>'
    );
    return true;
  } else {
    window.open(pictureURL, '', 'width='+width+',height='+height+',scrollbars=1,location=0,menubar=0,resizable=1');
  }
}