

//this will be highly Javascript dependent, so make sure they have
//a recent version of Javascript running...
if (document.getElementById == null) {
	window.location.replace('no_script.php');
}




function rowBGColor(row, color) {
	if (document.getElementById) {
		row.style.backgroundColor = color;
	}
}




function btnOn(btn)
{
	btn.className = "submtOn";
}


function btnOff(btn)
{
	btn.className = "submt";
}


function stripSpaces(mystr)
{
	var newstring = "";
	if (mystr.indexOf(' ') != -1) {
		string = mystr.split(' ');
		for (i=0; i < mystr.length; i++) {
		newstring += string[i];
	}
	return newstring;
	} else { return mystr; }
}//stripSpaces

function validEmail(str) {
	emailEXP = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2}[mtgvu]?$/;

	if (!emailEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}

function wholeNumber(str) {
	numEXP = /^\d{1,4}$/;

	if (!numEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}

function validZipCode(str) {
	numEXP = /^\d{5}$/;

	if (!numEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}

function validPhoneNumber(str) {
	phoneEXP = /^(1-)?(\d{3}\-\d{3}\-\d{4}$|\d{3}\.\d{3}\.\d{4}$|\d{3}\ \d{3}\ \d{4}$|\d{10})$/

	if (!phoneEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}


function validURL(str) {
	urlEXP = /^http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?$/
	if (!urlEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}



function objBg(obj, color) {
	if (document.getElementById) {
		if (color == '#000000') { color = '#cccccc'; }
		obj.style.backgroundColor = color;
	}
}






function adminJewelryImageWindow(product_id) {
	var jewelryWin

	if (jewelryWin && !jewelryWin.closed) {
		jewelryWin	.focus();
	}
	else {
		var w = 200;
		var h = 100;
		var params = "scrollbars=1,resizable=1,status=0,location=0,width="+ w +",height="+ h ;

	if (document.all) {
			var top = (screen.height - h)/2;
			var left = (screen.width- w)/2;
			params += ",left="+ left +",top="+ top ;
		}

		jewelryWin = window.open(
			"/jewelry_window.php?product_id="+ product_id,
			"jewelry_window",
			params
		);
	}
}
