function setPictures() {
	switch(currentPage) {
		case "home":
			document.getElementById("left").src = "images/" + index_fabrics_pic;
			document.getElementById("right").src = "images/" + index_wallcoverings_pic;
			break;
		case "profile":
			document.getElementById("pic").src = "images/" + profile_pic;
			break;
		case "news":
			document.getElementById("pic").src = "images/" + news_pic;
			break;
		case "contact":
			document.getElementById("topPic").src = "images/" + contact_top_pic;
			document.getElementById("bottomPic").src = "images/" + contact_bottom_pic;
			break;
	}
}

function setPictures2() {
	switch(currentPage) {
		case "home":
			document.getElementById("left").src = "../images/" + index_fabrics_pic;
			document.getElementById("right").src = "../images/" + index_wallcoverings_pic;
			break;
		case "profile":
			document.getElementById("pic").src = "../images/" + profile_pic;
			break;
		case "news":
			document.getElementById("pic").src = "../images/" + news_pic;
			break;
		case "contact":
			document.getElementById("topPic").src = "../images/" + contact_top_pic;
			document.getElementById("bottomPic").src = "../images/" + contact_bottom_pic;
			break;
	}
}

function setText(position) {
	switch(position) {
		case "index":
			document.write(index_scrolling_text);
			break;
		case "news":
			document.write(news_scrolling_text);
			break;
	}
}

function setCaption(position) {
	// this will be for the contact page only
	switch(position) {
		case "none":
			switch(currentPage) {
				case "profile":
					document.write(profile_caption);
					break;
				case "news":
					document.write(news_caption);
					break;
			}	
			break;
		case "top":
			document.write(contact_top_caption);
			break;
		case "bottom":
			document.write(contact_bottom_caption);
			break;
	} 	
}

function moveFocus(to){
	var kcode = window.event.keyCode;

	if (kcode == 13){
		window.event.cancelBubble = true;
     		window.event.returnValue = false;
		document.getElementById(to).focus();
		return true;
	}
}

function emailCheck(emailStr) {	
	var emailPat = /^(.+)@(.+)$/;
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) {
		alert("Please enter a valid email address.");
		document.getElementById('email').focus();
		document.getElementById('email').select();
		return false;
	}
}

// used by the page for updateing value
function setValues() {
	
	// the index page
	document.getElementById("Index_Scroll").value = index_scrolling_text;
	document.getElementById("IndexL_Pic").value = index_fabrics_pic;
	document.getElementById("IndexR_Pic").value = index_wallcoverings_pic;
	
	// the profile page
	document.getElementById("Profile_Pic").value = profile_pic;
	document.getElementById("Profile_Cap").value = profile_caption;
	document.getElementById("Profile_Title").value = profile_title;
	
	// the news page
	document.getElementById("News_Scroll").value = news_scrolling_text;
	document.getElementById("News_Pic").value = news_pic;
	document.getElementById("News_Cap").value = news_caption;
	document.getElementById("News_Title").value = news_title;
	
	// the contact page
	document.getElementById("ContactT_Pic").value = contact_top_pic;
	document.getElementById("ContactT_Cap").value = contact_top_caption;
	document.getElementById("ContactB_Pic").value = contact_bottom_pic;
	document.getElementById("ContactB_Cap").value = contact_bottom_caption;
}

function setTitle(position) {
	switch(position) {
		case "profile":
			document.write(profile_title);
			break;
		case "news":
			document.write(news_title);
			break;
	}
}