
function agreedisclaimer(){
if(document.cookie.indexOf('agree=1')>-1){
        return true;
}else{
    if(confirm(unescape('')+'\n\nThis will set a cookie on your browser.\nA cookie is a small piece of text stored only in your browser to say you have already seen and agreed to these terms.')){
      var today = new Date();
      var expiry = new Date(today.getTime() + (365 * 24 * 60 * 60 * 1000));
        document.cookie='agree=1; expires=' + expiry.toGMTString();

        }else{
        alert('sorry\nyou cannot shop without agreeing to the disclaimer\nplease email us if you want further information');
        return false;
        }
 }
}




function multiprice(theform,sign){
var tform=MM_findObjPlus(theform)
var thereturn=0
var thenum=0
if(sign==1){
thereturn =(parseInt(tform.quantity.value)+1);
}else{
if(sign==-1){
thereturn=(parseInt(tform.quantity.value)-1);
}
}

tform.quantity.value=(thereturn>=0)? thereturn:0;
thenum=(tform.amount.value* tform.quantity.value)*100;
thenum=Math.round(thenum);
thenum=thenum/100
tform.multiple_amount.value=thenum;
}

function addtocart(theform){
var tform=MM_findObjPlus(theform);
if(parseInt(tform.quantity.value)==0){
tform.quantity.value=1
}
return agreedisclaimer();

}

function view_cart(theform){
var tform=MM_findObjPlus(theform);
//tform.add.value=0;
//tform.display.value=1;
tform.submit();
}

function preloadims(){
var imarray=document.images
    for(i=0;i<imarray.length;i++){
        if(imarray[i].src.indexOf("_off")>-1){
        var obname=imarray[i].src.replace(/.*\/(.*)/gi,"$1")
        var suff=obname.substr(obname.length-4)
        obname=obname.substr(0, obname.length-8)
        eval(obname+"=new Image()")
        eval(obname).src=imarray[i].src.replace(/(.*\/).*/gi,"$1")+obname+"_on"+suff
        //alert("mm "+eval(obname).src)
        }
    }
}

function MM_findObjPlus(n, d) { //v4.01
//souped up by matt@kitsch22.net 
var p,i,x; 
if(typeof n !="string"){
return n;
}
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 swapim(im){
var origsrc= MM_findObjPlus(im).src
var imob=origsrc.replace(/(.*\/)(.*)/gi,"$2")

if(imob.indexOf("_off")>-1){
imob=imob.substr(0,imob.length-8)
}else{
imob=imob.substr(0,imob.length-7)
}
MM_findObjPlus(im).src=eval(imob).src
eval(imob).src= origsrc
}


function dropform(element){
//dropdown search forms submission
    var thisval='noprocess';
    var thisdefault='noprocessdefault';
        if(element[element.selectedIndex].value==false){
                        if(element[element.selectedIndex].text==false){
                             alert('ERROR: this browser will not submit forms. Please contact errorlog@kitsch22.net Thank You.');
                        }else{
                                thisdefault=element.form.default_txt.text;
                                thisval=element[element.selectedIndex].text;
                        };
        }else{
                thisdefault=element.form.default_txt.value;
                thisval=element[element.selectedIndex].value;
        };
    if(thisdefault!==thisval){
    element.form.submit();
    }
}


function submitform(str_formname){
var theform=document.getElementById(str_formname);
if((typeof theform.submit).toLowerCase()!='undefined' && (typeof theform.submit).toLowerCase()!='null'){
        theform.submit();
    }else{
    theform=document.forms[str_formname];
        if((typeof theform.submit).toLowerCase()=='undefined' || (typeof theform.submit).toLowerCase()=='null'){
            alert('This browser does not allow this functionality');
        }else{
        theform.submit();
        }
    }
}
