// JavaScript Document

	
	function passwordVal() {
	
	var pass1 = document.login.password;
	var pass2 = document.login.password2;
	var p1 = pass1.value;
	var p2 = pass2.value;
		
		if(p1 != p2){
			alert("The passwords you entered do not match!!");
			return false;
		}
	}
	
	function validatePost(){
var reqFields = new Array("title", "author", "post");
	for(i = 0; i<reqFields.length; i++){
	if(document.getElementById(reqFields[i]).value == ""){
			var emTags = document.getElementsByTagName("em");
			for(j = 0; j < emTags.length; j++){
			emTags[j].style.color = "#FF0000";
			}
		return false;
		}
	}
}

function validateBulletin(){
var reqFields = new Array("title", "body");
	for(i = 0; i<reqFields.length; i++){
	if(document.getElementById(reqFields[i]).value == ""){
			var emTags = document.getElementsByTagName("em");
			for(j = 0; j < emTags.length; j++){
			emTags[j].style.color = "#FF0000";
			}
		return false;
		}
	}
}

function validateUser(){
var reqFields = new Array("username", "password", "email", "firstname", "lastname");
	for(i = 0; i<reqFields.length; i++){
	if(document.getElementById(reqFields[i]).value == ""){
			var emTags = document.getElementsByTagName("em");
			for(j = 0; j < emTags.length; j++){
			emTags[j].style.color = "#FF0000";
			}
		return false;
		}
	}
}



var Slides = new Array('slide1', 'slide2', 'slide3');
	var currPic=0;
	
function slidesGo(){
	Effect.Fade(Slides[currPic]);
	currPic++;
	if(currPic == Slides.length){currPic = 0};	
	Effect.Appear(Slides[currPic]);
	}

function startSlides(){
	setInterval("slidesGo()", 4000);
}

function confirmDelete(id){
	if(confirm('you sure you want like to delete this post?')){
		window.location = "delete.cfm?postid=" + id
	}
}

function confirmDeleteUser(id){
	if(confirm('you sure you want like to delete this user?')){
		window.location = "delete.cfm?userid=" + id
	}
}

function showProduct(prod){
	var page = $$('html')[0];
	var pageHeight = page.getHeight();
	var pageWidth = page.getWidth();
	var overlay = new Element('div', {'id': 'overlay'});
	
	overlay.style.height = pageHeight + 'px';
	overlay.setOpacity(0.8);
	$('shop').insert( overlay); 
	$(prod).blindDown();
}

function hideProduct(prod){
	var overlay = $('overlay');

	$(prod).fade({duration:0.4});
	
	$('overlay').remove();
}
