// Copyright 2000-2004, DataCom of Duluth
        
// Setup
aboutUs_g=new Image(62,14);
aboutUs_g.src="/images/menu/aboutUs_g.gif";
aboutUs_on=new Image(62,14);
aboutUs_on.src="/images/menu/aboutUs_on.gif";
aboutUs_off=new Image(62,14);
aboutUs_off.src="/images/menu/aboutUs_off.gif";

gallery_g=new Image(48,18);
gallery_g.src="/images/menu/gallery_g.gif";
gallery_on=new Image(48,18);
gallery_on.src="/images/menu/gallery_on.gif";
gallery_off=new Image(48,18);
gallery_off.src="/images/menu/gallery_off.gif";

ourDiamonds_g=new Image(102,14);
ourDiamonds_g.src="/images/menu/ourDiamonds_g.gif";
ourDiamonds_on=new Image(102,14);
ourDiamonds_on.src="/images/menu/ourDiamonds_on.gif";
ourDiamonds_off=new Image(102,14);
ourDiamonds_off.src="/images/menu/ourDiamonds_off.gif";

contactUs_g=new Image(78,12);
contactUs_g.src="/images/menu/contactUs_g.gif";
contactUs_on=new Image(78,12);
contactUs_on.src="/images/menu/contactUs_on.gif";
contactUs_off=new Image(78,12);
contactUs_off.src="/images/menu/contactUs_off.gif";

whatsNew_g=new Image(79,13);
whatsNew_g.src="/images/menu/whatsNew_g.gif";
whatsNew_on=new Image(79,13);
whatsNew_on.src="/images/menu/whatsNew_on.gif";
whatsNew_off=new Image(79,13);
whatsNew_off.src="/images/menu/whatsNew_off.gif";

tellFriend_on=new Image(76,12);
tellFriend_on.src="/images/menu/tellFriend_on.gif";
tellFriend_off=new Image(76,12);
tellFriend_off.src="/images/menu/tellFriend_off.gif";

// Roll Over Buttons
function turnOn(imgName) {
	if(document.cookie.split("=")[1]!=document[imgName].name) {
		document[imgName].src=eval(imgName + "_on.src");
	}
}

function turnOff(imgName) {
	if(document.cookie.split("=")[1]!=document[imgName].name) {
		document[imgName].src=eval(imgName + "_off.src");
	}
}

//Open Files
function openFileA(theFile, theWindow, theBar, theSize, theWidth, theHeight) {
    window.open (theFile, theWindow,"status=no,location=no,toolbars="+theBar+",menubar="+theBar+",directories=no,scrollbars=yes,resizable="+theSize+",width="+theWidth+",height="+theHeight);
}

// Open The Picture File
function openPic(iFile) {
	jmjPic=new Image();
	jmjPic.src=iFile;
	checkSize(iFile);
}

// Checks The Size - Because It Matters
function checkSize(iFile) {
	if((jmjPic.width!=0)&&(jmjPic.height!=0)) {
		displayPic(iFile);
	} else {
		reTest="checkSize('"+iFile+"')";
		doAgain=setTimeout(reTest,50);
	}
}

// Write The Image File
function displayPic(iFile) {
	iFw=jmjPic.width+20;
	iFh=jmjPic.height+60;
	nwSetup="width="+iFw+"px,height="+iFh+"px";
	newWindow=window.open(iFile, "picWin", "toolbar=no,location=no,scrollbars=no,resizable=no,"+nwSetup);
   	if (newWindow && !newWindow.closed) {
	newWindow.resizeTo(iFw+20,iFh+100);
	}
	newWindow.document.open();
	newWindow.document.write("<html>");
	newWindow.document.write("<head>");
	newWindow.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
	newWindow.document.write("<!-- Copyright 2000-2007, DataCom/OTA, Inc. -->");
	newWindow.document.write("<title>John Marxhausen Jewelry - Our Diamonds</title>");
	newWindow.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/jmj-gallery.css\">");
	newWindow.document.write("</head>");
	newWindow.document.write("<body oncontextmenu=\"return false;\">");
	newWindow.document.write("<center>");
	newWindow.document.write("<h1>Ideal Cut Diamond Proportions<br /><br /></h1>");
	newWindow.document.write("<img src=\""+iFile+"\"><br /><br />");
	newWindow.document.write("<p style=\"text-align:center; font-size:8pt;\"><a href=\"javascript:window.close()\">[CLOSE WINDOW]</a>");
	newWindow.document.write("</center>");
	newWindow.document.write("</body>");
	newWindow.document.write("</html>");
	newWindow.document.close();
	newWindow.focus();
}

//Show hide form
function formSwitch(onoff, theFile, theDiv) {
	if (onoff == "on") {
		document.getElementById(theDiv).style.visibility='visible';
		getFile(theFile, theDiv);
	} else {
		document.getElementById(theDiv).style.visibility='hidden';
	}
}

function postFile(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
	document.getElementById("formLayer").innerHTML = "<p><br/>Sending . . . </p>";
}

function getquerystring() {
    var form = document.forms['tafform'];
    var yn = form.YourName.value;
    var fn = form.FriendsName.value;
    var em = form.Email.value;
    qstr = 'YourName=' + escape(yn) + '&FriendsName=' + escape(fn) + '&Email=' + escape(em);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str){
    document.getElementById("formLayer").innerHTML = str;
}

function getFile(theFile, theDiv) {
	var pageRequest = false;
	
	if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
    else if (window.ActiveXObject)pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
    else return false;
	
    pageRequest.open('GET', theFile, true);
    pageRequest.onreadystatechange = function() {
        if (pageRequest.readyState == 4) {
			document.getElementById(theDiv).innerHTML = pageRequest.responseText;
		}
    }
    pageRequest.send(null);
}