function mOn(item, which) {
	if(which == 0) {
		item.style.background = 'url(images/content_side_on.jpg) top left no-repeat';
	} else if(which == 1) {
		item.style.background = 'url(images/content_sub_side_on.jpg) top left repeat-y';
	} else if(which == 2) {
		item.style.background = 'url(images/content_contact_submit_on.jpg) top left no-repeat';
	}
}

function mOff(item, which) {
	if(which == 2) {
		item.style.background = 'url(images/content_contact_submit.jpg) top left no-repeat';
	} else {
		item.style.background = 'url(images/pixel.gif) top left';
	}
}

function preloadImages() {
	var temp = new Image();
	temp.src = 'images/content_side_on.jpg';
	temp.src = 'images/anion.gif';
	temp.src = 'images/content_contact_submit_on.jpg';
}

function popupMedia(image, imageTitle, width, height) {
     var mediaURL = "media_popup.php?image="+escape(image)+"&title="+escape(imageTitle); 
     // give the initial dimensions a little padding 
     width += 50; 
     height += 110; 
 
     // make sure the dimensions are a decent size for us - don't want it too small 
     if (width < 400){ 
          width = 400; 
     }
     var newWindow = open(mediaURL, "MediaPopup", "width="+width+",height="+height+",scrollbars=no,resizable=yes,toolbar=no,menubar=no,titlebar=no,status=no,screenX=0,screenY=0"); 
}

function validateForm(theForm) {
	theForm.submitted.value = 'wasSubmitted';
	theForm.action = 'contactus.php';
	theForm.submit();
}

function loadPrintDiv(fromID, toID) {
	var htmlContents = document.getElementById(fromID).innerHTML.replace(/contactForm/, "replacedForm");
	document.getElementById(toID).innerHTML = htmlContents;
}

window.onbeforeprint = beforePrint;

function beforePrint() {
	loadPrintDiv('contentPrintFrom', 'contentPrintTo');
}

function toggleJTechComments() {
	var jtechComments = document.getElementById('jtechCommentsContainer');
	
	if(jtechComments) {	
		jtechComments.style.display = jtechComments.style.display == 'block' ? 'none' : 'block';
	}
}
