address1="..";

var Cookie = { pref:'',last:null, cnfg:function(a1) { var Bool={secure:1}, text=''; if (''+a1!==a1) for (var k in a1) if (a1[k]) text += '; '+( Bool[k] ? k : k+'='+( k!='expires'||isNaN(a1[k]) ? a1[k] : this.date(a1[k]) ) ); return this.pref = text||a1||text; }, make:function(a1,a2,a3) { document.cookie = this.last=escape(a1)+'='+escape(a2)+this.cnfg(a3); return this.read(a1) == a2; }, date:function(a1) { var D = new Date(); D.setTime(D.getTime()+(a1||0)*86400000); return D.toGMTString(); }, read:function(a1) { var F=' '+document.cookie+';', S=F.indexOf(' '+(a1=escape(a1))); return S==-1 ? null : unescape( F.substring(a1=S+a1.length+2,F.indexOf(';',a1)) ); } } 

function cookiedone(cookie_done){
if (!cookie_done) {
alert('Cookies are required for this operation. Please check the settings in your browser!');
}
return;
}

function referrer(){
ret=document.referrer;
if ((ret!=ret)||(ret=="")) { // null is never equal to itself
	ret=":";
}
if ((ret.indexOf("jewellerycatalogue")==-1)&&(ret.indexOf("www")!=-1)){
	//setCookie("ref",ret,exp);
	Cookie.make('ref', ret, { expires:28 });
}
}

function browsertest(){
bName=navigator.appName;
bVer=parseInt(navigator.appVersion);
if (bName=="Netscape" && bVer<5 ) { //ver is one behind
	parent.location='netscape.htm' ;
	}
}
function afterload(){
version();referrer();
window.status=" ";
}

function version(){
currentver=1.52;
field="ver" ;value=getCookie(field);
ret=value;

	if (isNaN(ret)||(ret!=ret)) { // null is never equal to itself
	setCookie("ver",currentver,exp);
	ret=currentver-1;
	}
	if (ret<currentver){
	setCookie("tagged",":",exp);
	setCookie("taggeda",":",exp);
	setCookie("taggedd",":",exp);
	setCookie("taggedds",":",exp);
	setCookie("ver",currentver,exp);
	}
}

function nullcookie(field,value){
	if ((value==null)||(value!=value)){
		value=":" ;
		setCookie(field,value,exp);
	}
	if (value.substring(0,1)==":"){
		value=value.substring(1,value.length); // remove :
	}
ret=value;
return (ret);
}

function caps(ret){
	if (ret.length>0){
		ret=ret.substring(0,1).toUpperCase()+ret.substring(1,ret.length);
	}
	return (ret);
}
	
   
// Use this function to save a cookie.
var exp = new Date();                                   // make new date object
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 31)); // set it 31 days ahead/
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" + expires.toGMTString());
};
// Use this function to retrieve a cookie.
function getCookie(name){;
var cname = name + "=";               
var dc = document.cookie;             
    if (dc.length > 0) {              
    begin = dc.indexOf(cname);       
        if (begin != -1) {           
        begin += cname.length;       
        end = dc.indexOf(";", begin);
            if (end == -1) end = dc.length;
            return unescape(dc.substring(begin, end));
        } 
    }
return null;
}

function formatcomma(number){
	if (number.length>=8) { //this one first
	number=number.substring(0,2)+","+number.substring(2,number.length);
	return (number);
	}
	if (number.length>=7) { // this second
	number=number.substring(0,1)+","+number.substring(1,number.length);
	return (number);
	}
return (number);
}

function twodp(number,X) {
X = (!X ? 2 : X);
zeronum= Math.round(number*Math.pow(10,X))/Math.pow(10,X);
zeronum=zeronum.toString();
	if (zeronum.substring(0,1)=="."){ // adds a 0. two 2dps if starts with "."
	zeronum="0"+zeronum ;
	}
	if (X==2 && (zeronum.indexOf(".")==-1)){ // adds a 0 two 2dps but not if its not 2 dp
	zeronum=zeronum+".00";
	return (zeronum)
	}
	if (X==2 && (zeronum.indexOf(".")==(zeronum.length-2))){ 
	zeronum=zeronum+"0";
	}
	if (X==1 && (zeronum.indexOf(".")==(-1))){ // adds decimal if just a number and no "."
	zeronum=zeronum+".0" ;
	}
	if (X==1 && (zeronum.indexOf(".")!=(zeronum.length-2))){ // adds a 0 two 1dps but not if its not 1 dp
	zeronum=zeronum+"0";
	}
return (zeronum);
}
function fourdigit(fourdigitcount1){ ;// adds index to front end of value field as 4 digits ;
fourdigitcount1=fourdigitcount1+"" ; // converts number to a string ;
if (fourdigitcount1.length==1){ ;
fourdigitcount1="000"+fourdigitcount1 };
if (fourdigitcount1.length==2){ ;
fourdigitcount1="00"+fourdigitcount1 } ;
if (fourdigitcount1.length==3){ ;
fourdigitcount1="0"+fourdigitcount1 } ;
return (fourdigitcount1)} ; // end of four function ;