function selectNav(){
	if(document.getElementById){
		var currentSection = getFileName(location.href);
		if(currentSection != ""){
			if(currentSection == "merchant"){currentSection = "shop"};
			var navObj = document.getElementById(currentSection + "-td");
			if(currentSection != "index" && currentSection != "send"){
				navObj.style.backgroundColor = "#cee243";
				navObj.style.border = "1px #fff solid";
			}
		}
	}
	return true;
}

function getFileName(vpath){
	var filePathArray = vpath.split("/");
	var fileName = filePathArray[filePathArray.length-1];
	var fileNameSeperated = fileName.split(".");
	fileName = fileNameSeperated[0];
	fileName = fileName.split("_")[0];
	return fileName;
}

function hpTextRotation(objID){
	var HPTextArray = new Array();
			HPTextArray[0] = '<a href="Merchant2/merchant.mvc" class="rotation-link">"Motherhood Does Not Define Us, We Define  it"</a>';
			HPTextArray[1] = '<a href="Merchant2/merchant.mvc" class="rotation-link">Don\'t Forget about Mothers Day, Sunday, May 14</a>';
			HPTextArray[2] = '<a href="Merchant2/merchant.mvc" class="rotation-link">It is never too early to shop....Mother\'s Day,  Sunday, May 14</a>';
			HPTextArray[3] = '<a href="show.html" class="rotation-link">promom couture featured at EXTRA Oscar Awards Lounge!</a>';

	var randomItem = 5;
	while(randomItem > 3){
		randomItem= Math.round(Math.random() * HPTextArray.length);
	}

	if(document.getElementById){
		obj = document.getElementById(objID);
		obj.innerHTML = HPTextArray[randomItem];
	}
}


function validateRegForm(formObj){
	errorItems = "";
	for(i=0;(i<formObj.length-1);i++){
		formObj[i].style.backgroundColor = "#ffffff";
		if(formObj[i].value == ""){
			if(isRequiredItem(formObj[i].name)){
				errorItems = addToError(errorItems,formObj[i].id);
				formObj[i].style.backgroundColor = "#ffeeee";
			}
		}
	}

	if(errorItems == ""){
		return true;
	}
	else{
		alert("Please fill in the following fields\n" + errorItems);
		return false;
	}
}

function addToError(currentErrors,itemID){
	return currentErrors + itemID + "\n";
}

function isRequiredItem(itemName){
	notRequiredArray = new Array();
	notRequiredArray[0] = "fax";
	notRequiredArray[1] = "email";
	notRequiredArray[2] = "website";
	notRequiredArray[3] = "taxid";

	for(x=0;(x<notRequiredArray.length);x++){
		if(itemName == notRequiredArray[x]){
			return false;
		}
	}
	return true;
}
