﻿// JScript File

/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
  
var fadebgcolor="White"
 
////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=obj.degree/100
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

function ShowMap(id)
{
    document.getElementById("frQuestion").src = "map.aspx?id="+id;
    document.getElementById("frQuestion").style.height = "auto";
    
    ShowOverlay();
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
    
    document.getElementById("enquiry_panel").style.height = "auto";
    document.getElementById("enquiry_panel").style.backgroundImage = "none";
    document.getElementById("frQuestion").style.display = "";
        
    docWidth = document.documentElement.clientWidth;
    panelWidth = 600;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
	    yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.width = "600px";
    document.getElementById("enquiry_panel").style.display = "";    
    document.getElementById("enquiry_panel").style.left = ((parseInt(docWidth) - parseInt(panelWidth))/2)+"px";
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
        yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.top = yScroll+((parseInt(docHeight) - parseInt(panelHeight))/2)+"px";

} // end function ShowMap

function ShowQuestion(id)
{
    document.getElementById("frQuestion").src = "question.aspx?id="+id;
    document.getElementById("frQuestion").style.height = "320px";
    
    ShowOverlay();
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
    
    document.getElementById("enquiry_panel").style.height = "auto";
    document.getElementById("enquiry_panel").style.backgroundImage = "none";
    document.getElementById("frQuestion").style.display = "";
        
    docWidth = document.documentElement.clientWidth;
    panelWidth = 600;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
	    yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.width = "600px";
    document.getElementById("enquiry_panel").style.display = "";    
    document.getElementById("enquiry_panel").style.left = ((parseInt(docWidth) - parseInt(panelWidth))/2)+"px";
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
        yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.top = yScroll+((parseInt(docHeight) - parseInt(panelHeight))/2)+"px";
    
    //window.open("question.aspx?id="+id,"","status=no,width=420,height=550,scrollbars=no");

} // end function ShowMap

function Enlarge(index)
{
    document.getElementById("enquiry_panel").style.backgroundImage = "url(image.ashx?id="+index+"&t=l)";

    ShowOverlay();

    docHeight = document.documentElement.clientHeight;
    document.getElementById("enquiry_panel").style.height = "500px";
    document.getElementById("frQuestion").style.display = "none";
    
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    docWidth = document.documentElement.clientWidth;
    panelWidth = 500;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
	    yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.width = "500px";
    document.getElementById("enquiry_panel").style.display = "";    
    document.getElementById("enquiry_panel").style.left = ((parseInt(docWidth) - parseInt(panelWidth))/2)+"px";
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
        yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    //document.getElementById("frQuestion").src = "image.ashx?id="+index+"&t=l";
    //document.getElementById("frQuestion").style.height = "500px";
    
    document.getElementById("enquiry_panel").style.top = yScroll+((parseInt(docHeight) - parseInt(panelHeight))/2)+"px";
    
} // end function Enlarge

function EnlargeD(image)
{
    document.getElementById("enquiry_panel").style.backgroundImage = "url(/images/diamonds/"+image+")";

    ShowOverlay();

    docHeight = document.documentElement.clientHeight;
    document.getElementById("enquiry_panel").style.height = "131px";
    document.getElementById("frQuestion").style.display = "none";
    
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    docWidth = document.documentElement.clientWidth;
    panelWidth = 684;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
	    yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.width = "684px";
    document.getElementById("enquiry_panel").style.display = "";    
    document.getElementById("enquiry_panel").style.left = ((parseInt(docWidth) - parseInt(panelWidth))/2)+"px";
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
        yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    //document.getElementById("frQuestion").src = "image.ashx?id="+index+"&t=l";
    //document.getElementById("frQuestion").style.height = "500px";
    
    document.getElementById("enquiry_panel").style.top = yScroll+((parseInt(docHeight) - parseInt(panelHeight))/2)+"px";
    
} // end function EnlargeD
                        
function ShowExtra()
{
    document.getElementById("frQuestion").src = "extra_charges.htm";

    ShowOverlay();
    
    document.getElementById("enquiry_panel").style.height = "auto";
    document.getElementById("enquiry_panel").style.backgroundImage = "none";
    document.getElementById("frQuestion").style.display = "";
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    docWidth = document.documentElement.clientWidth;
    panelWidth = 300;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
	    yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("enquiry_panel").style.width = "320px";
    document.getElementById("enquiry_panel").style.display = "";    
    document.getElementById("enquiry_panel").style.left = ((parseInt(docWidth) - parseInt(panelWidth))/2)+"px";
    
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("enquiry_panel").clientHeight;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
        yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("frQuestion").style.height = "400px";
    
    document.getElementById("enquiry_panel").style.top = yScroll+((parseInt(docHeight) - parseInt(panelHeight))/2)+"px";

} // end functin ShowExtra

var catArray = new Array();
        catArray[0] = new Array();
        catArray[1] = new Array();
        catArray[2] = new Array();
        catArray[3] = new Array();
        catArray[4] = new Array();
        catArray[5] = new Array();
        catArray[6] = new Array();
        catArray[7] = new Array();
        catArray[8] = new Array();
        catArray[9] = new Array();
        catArray[10] = new Array();
        catArray[11] = new Array();
        
        catArray[0][0] = new Array();
        catArray[0][0][0] = "Purity";
        catArray[0][0][1] = "g_purity.html";
        catArray[0][0][2] = "g_purity.jpg";
        
        catArray[0][1] = new Array();
        catArray[0][1][0] = "Colour";
        catArray[0][1][1] = "g_colour.html";
        catArray[0][1][2] = "g_colour.jpg";
        
        catArray[1][0] = new Array();
        catArray[1][0][0] = "Sterling Silver 925";
        catArray[1][0][1] = "silver.html";
        catArray[1][0][2] = "silver.jpg";
        
        catArray[2][0] = new Array();
        catArray[2][0][0] = "Platinum";
        catArray[2][0][1] = "pt.html";
        catArray[2][0][2] = "pt.jpg";
        
        catArray[3][0] = new Array();
        catArray[3][0][0] = "Titanium";
        catArray[3][0][1] = "tt.html";
        catArray[3][0][2] = "tt.jpg";
        
        catArray[4][0] = new Array();
        catArray[4][0][0] = "Stainless Steel";
        catArray[4][0][1] = "ss.html";
        catArray[4][0][2] = "ss.jpg";
        
        catArray[5][0] = new Array();
        catArray[5][0][0] = "Gold Filled";
        catArray[5][0][1] = "gf.html";
        catArray[5][0][2] = "gf.jpg";
        
        catArray[6][0] = new Array();
        catArray[6][0][0] = "About&nbsp;Diamonds";
        catArray[6][0][1] = "diamond.html";
        catArray[6][0][2] = "diamond.jpg";
        
//        catArray[6][1] = new Array();
//        catArray[6][1][0] = "Colour";
//        catArray[6][1][1] = "colour.html";
//        catArray[6][1][2] = "colour.jpg";
//        
//        catArray[6][1] = new Array();
//        catArray[6][1][0] = "Cut";
//        catArray[6][1][1] = "cut.html";
//        catArray[6][1][2] = "cut.jpg";
//        
//        catArray[6][2] = new Array();
//        catArray[6][2][0] = "Carat";
//        catArray[6][2][1] = "carat.html";
//        catArray[6][2][2] = "carat.jpg";
//        
//        catArray[6][3] = new Array();
//        catArray[6][3][0] = "Clarity";
//        catArray[6][3][1] = "clarity.html";
//        catArray[6][3][2] = "clarity.jpg";
        
        catArray[7][0] = new Array();
        catArray[7][0][0] = "Emerald";
        catArray[7][0][1] = "emerald.html";
        catArray[7][0][2] = "emerald.jpg";
        
        catArray[8][0] = new Array();
        catArray[8][0][0] = "Ruby";
        catArray[8][0][1] = "ruby.html";
        catArray[8][0][2] = "ruby.jpg";
        
        catArray[9][0] = new Array();
        catArray[9][0][0] = "Sapphire";
        catArray[9][0][1] = "sapphire.html";
        catArray[9][0][2] = "sapphire.jpg";
        
        catArray[10][0] = new Array();
        catArray[10][0][0] = "Aquamarine";
        catArray[10][0][1] = "aqua.html";
        catArray[10][0][2] = "aqua.jpg";
        
        catArray[11][0] = new Array();
        catArray[11][0][0] = "Garnet";
        catArray[11][0][1] = "garnet.html";
        catArray[11][0][2] = "garnet.jpg";
        
        catArray[11][1] = new Array();
        catArray[11][1][0] = "Amethyst Quartz";
        catArray[11][1][1] = "aquartz.html";
        catArray[11][1][2] = "amethyst.jpg";
        
        catArray[11][2] = new Array();
        catArray[11][2][0] = "Topaz";
        catArray[11][2][1] = "topaz.html";
        catArray[11][2][2] = "bluetopaz.jpg";
        
        catArray[11][3] = new Array();
        catArray[11][3][0] = "Citrine Quartz";
        catArray[11][3][1] = "cquartz.html";
        catArray[11][3][2] = "citrine.jpg";
        
//        catArray[11][4] = new Array();
//        catArray[11][4][0] = "Peridot";
//        catArray[11][4][1] = "peridot.html";
//        catArray[11][4][2] = "peridot.jpg";
//        
//        catArray[11][5] = new Array();
//        catArray[11][5][0] = "Iolite";
//        catArray[11][5][1] = "iolite.html";
//        catArray[11][5][2] = "iolite.jpg";
        
        catArray[11][5] = new Array();
        catArray[11][5][0] = "Smokey Quartz";
        catArray[11][5][1] = "squartz.html";
        catArray[11][5][2] = "squartz.jpg";
        
        catArray[11][7] = new Array();
        catArray[11][7][0] = "Opal";
        catArray[11][7][1] = "opal.html";
        catArray[11][7][2] = "opal.jpg";
        
        catArray[11][8] = new Array();
        catArray[11][8][0] = "Jade";
        catArray[11][8][1] = "jade.html";
        catArray[11][8][2] = "jade.jpg";
        
        catArray[11][6] = new Array();
        catArray[11][6][0] = "Turquoise";
        catArray[11][6][1] = "turquoise.html";
        catArray[11][6][2] = "turquoise.jpg";
        
        catArray[11][4] = new Array();
        catArray[11][4][0] = "Rose/Cherry Quartz";
        catArray[11][4][1] = "rcquartz.html";
        catArray[11][4][2] = "rcquartz.jpg";
        
//        catArray[11][12] = new Array();
//        catArray[11][12][0] = "Amber";
//        catArray[11][12][1] = "amber.html";
//        catArray[11][12][2] = "amber.jpg";
        
        function LoadCategories(catid)
        {
            document.getElementById("subcategories").innerHTML = "";
            
            //alert(catArray[catid].length);
            
            for(i=0;i<catArray[catid].length;i++)
            {                
                text = catArray[catid][i][0];
                
                document.getElementById("subcategories").innerHTML +=
                "<a id=\"lnkCat"+catid+"_"+i+"\" href=\"javascript:LoadContents("+catid+","+i+",true)\">"+text+"</a><br />";
            
            } // end for
            
            LoadContents(catid,0,false);
        
        } // end function LoadCategories     
        
var xmlHttp;
        
function LoadContents(catid, i, load)
{
    if(load)
        LoadCategories(catid);
        
    url = catArray[catid][i][1];
    img = catArray[catid][i][2];
    
    document.getElementById("subcategories").innerHTML = "";
            
    for(j=0;j<catArray[catid].length;j++)
    {                
        text = catArray[catid][j][0];
        
        document.getElementById("subcategories").innerHTML +=
        "<a id=\"lnkCat"+catid+"_"+j+"\" href=\"javascript:LoadContents("+catid+","+j+",true)\">"+text+"</a><br />";
    
    } // end for
    
    document.getElementById("lnkCat"+catid+"_"+i).style.fontWeight = "bold";
    document.getElementById("image").style.backgroundImage = "url(images/metals_stones/"+img+")";
                
    xmlHttp=GetXmlHttpObject();

    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    }
    
    var url="data/"+url;
    xmlHttp.onreadystatechange=contentsLoad;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

} // end function LoadContents

function contentsLoad() 
{ 
    if (xmlHttp.readyState==4)
    {
        document.getElementById("contents").innerHTML=xmlHttp.responseText;
    
    } // end if

} // end function

function GetXmlHttpObject()
{
    var xmlHttp=null;
    
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;

} // end function GetXmlHttpObject

function ShowOverlay()
{   
    document.getElementById("overlay").style.width = parent.document.body.clientWidth+"px";
    
    if(document.documentElement.clientHeight > parent.document.body.clientHeight)
        document.getElementById("overlay").style.height = document.documentElement.clientHeight+"px";
    else
        document.getElementById("overlay").style.height = parent.document.body.clientHeight+"px";
    
    document.getElementById("overlay").style.display = "";
       
} // end function ShowOverlay

function ShowInfo(catid, i)
{           
	ShowOverlay();
    docHeight = document.documentElement.clientHeight;
    panelHeight = document.getElementById("info_panel").clientHeight;
        
    docWidth = document.documentElement.clientWidth;
    panelWidth = 600;
        
    yScroll = 0;
        
    if (document.body.scrollHeight > document.body.offsetHeight)
	    yScroll = document.body.scrollHeight-document.body.offsetHeight;
    
    document.getElementById("info_panel").style.display = "";    
    document.getElementById("info_panel").style.left = ((parseInt(docWidth) - parseInt(panelWidth))/2)+"px";
    
    url = catArray[catid][i][1];
    img = catArray[catid][i][2];
    
    //document.getElementById("info_image").style.backgroundImage = "url(images/metals_stones/"+img+")";
                
    xmlHttp=GetXmlHttpObject();

    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    }
    
    var url="data/"+url;
    xmlHttp.onreadystatechange=infoLoad;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
       
} // end function ShowInfo

function infoLoad() 
{ 
    if (xmlHttp.readyState==4)
    {
        document.getElementById("info").innerHTML=xmlHttp.responseText;
        
        docHeight = document.documentElement.clientHeight;
        panelHeight = document.getElementById("info_panel").clientHeight;
            
        yScroll = 0;
            
        if (document.body.scrollHeight > document.body.offsetHeight)
	        yScroll = document.body.scrollHeight-document.body.offsetHeight;
	    
        document.getElementById("info_panel").style.top = yScroll+((parseInt(docHeight) - parseInt(panelHeight))/2)+"px";
       
    
    } // end if

} // end function

function CloseInfo()
{
    document.getElementById("overlay").style.display = "none";
    document.getElementById("info_panel").style.display = "none";
    
} // end function CloseEmail

function CloseEnquiry()
{
    document.getElementById("overlay").style.display = "none";
    document.getElementById("enquiry_panel").style.display = "none";
    
} // end function CloseEnquiry

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return "$"+s;
}
// end of function CurrencyFormatted()

function numbersonly(e)
{
    var unicode=e.charCode? e.charCode : e.keyCode
    if (unicode!=8)
    {
        if (unicode<48||unicode>57)
        return false;
    }
}

function CheckSame()
{
    UpdateFields();
    
    if(document.getElementById("ctl00_ContentPlaceHolder1_chkSame").checked)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddress1_Delivery").disabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddress2_Delivery").disabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_txtSuburb_Delivery").disabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_txtState_Delivery").disabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_txtPostcode_Delivery").disabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry_Delivery").disabled = true;
        
        ValidatorEnable(ctl00_ContentPlaceHolder1_reqAddress,false);
        ValidatorEnable(ctl00_ContentPlaceHolder1_reqSuburb,false);
        ValidatorEnable(ctl00_ContentPlaceHolder1_reqCountry,false);
    
    } // end if
    else
    {
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddress1_Delivery").disabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddress2_Delivery").disabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_txtSuburb_Delivery").disabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_txtState_Delivery").disabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_txtPostcode_Delivery").disabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry_Delivery").disabled = false;
        
        ValidatorEnable(ctl00_ContentPlaceHolder1_reqAddress,true);
        ValidatorEnable(ctl00_ContentPlaceHolder1_reqSuburb,true);
        ValidatorEnable(ctl00_ContentPlaceHolder1_reqCountry,true);
        
    } // end else

} // end function CheckSame

function UpdateFields()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_chkSame").checked)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddress1_Delivery").value 
                = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress1_Postal").value;
                
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddress2_Delivery").value 
            = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress2_Postal").value;
            
        document.getElementById("ctl00_ContentPlaceHolder1_txtSuburb_Delivery").value 
            = document.getElementById("ctl00_ContentPlaceHolder1_txtSuburb_Postal").value;
            
        document.getElementById("ctl00_ContentPlaceHolder1_txtState_Delivery").value 
            = document.getElementById("ctl00_ContentPlaceHolder1_txtState_Postal").value;
            
        document.getElementById("ctl00_ContentPlaceHolder1_txtPostcode_Delivery").value 
            = document.getElementById("ctl00_ContentPlaceHolder1_txtPostcode_Postal").value;
            
        document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry_Delivery").value 
            = document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry_Postal").value;
    
    } // end if
    
} // end function UpdateFields