// Terrestra.com javascript functions

// open a new browser window
function openWindow(url,windowName,features) { 
	window.open(url,windowName,features);
}

// open the Send us an email page
function sendUsAnEmail() {
	openWindow('../email.html','_blank','menubar=no,toolbar=no,locationbar=no,scrollbars=no,resizable=yes,width=400,height=400');
}

// open the 'Join our mailing list' page
function joinMailingList() {
	openWindow('../join.html','_blank','menubar=no,toolbar=no,locationbar=no,scrollbars=no,resizable=yes,width=400,height=400');
}

// open the Promo Code cart window
function promoCode() {
	openWindow('promo-code.php','promo','width=400,height=200,scrollbars=auto,resizable=yes,status=yes');	
}

// redirect the browser
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

// modify an HTML div element's properties
function changeDiv(the_div,the_change) {
	var the_style = getStyleObject(the_div);
	if (the_style != false) {
		the_style.display = the_change;
	}
}

// determine a given style property for an HTML object
function getStyleObject(objectId) {
	if (document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId).style;
	} else {
		return false;
	}
}

// open promo code "How do I get these" pop-up
function displayPromoCodeInquiry() {
	openWindow('promo-codes.html', '_blank','menubar=no,toolbar=no,locationbar=no,scrollbars=no,resizable=yes,width=320,height=180');
}


// open cart guarentee pop-up
function displayGuarantee() {
	openWindow('guarantee.html', '_blank','menubar=no,toolbar=no,locationbar=no,scrollbars=no,resizable=yes,width=320,height=180');
}

// open shop product availability pop-up
function displayAvailability() {
	openWindow('../availability.html', '_blank','menubar=no,toolbar=no,locationbar=no,scrollbars=no,resizable=yes,width=400,height=400');
}

// gift wrapping content
function wrappingInfo() {
	openWindow('wrapping.html', '_blank','menubar=no,toolbar=no,locationbar=no,scrollbars=no,resizable=yes,width=320,height=250');
}

// open the sample registry in a new window
function sampleRegsitry() {
	openWindow('sample-registry.html','_blank','menubar=no,toolbar=no,locationbar=no,width=584,height=500,scrollbars=yes,resizable=yes,status=yes');	
}