$(document).ready(function(){


	currentitem=0;
	$("ul.cycler").after('<a href="." class="previtem disabled">&#9668;</a> <a href="." class="nextitem">&#9658;</a>');
	$("a.previtem").click(function(){
		activateitem(currentitem-1);
		return false;
	});
	$("a.nextitem").click(function(){
		activateitem(currentitem+1);
		return false;
	});
	function activateitem(theitem){
		$("a.previtem").removeClass("disabled");
		$("a.nextitem").removeClass("disabled");
		if(theitem>=$("a.previtem").parent().find("li").size()-1){
			$("a.nextitem").addClass("disabled");
			currentitem=$("a.previtem").parent().find("li").size()-1;
		}
		else if(theitem<=0){
			$("a.previtem").addClass("disabled");
			currentitem=0;
		}
		else{
			currentitem=theitem;
		}
		$("a.previtem").parent().find("li").hide();
		$("a.previtem").parent().find("li").eq(currentitem).show();
	}
	
	

	$("body.homepage a[href$='jpg']").attr("rel","lightbox[f]");
	$("body.homepage a[href$='gif']").attr("rel","lightbox[m]");	
	$("a[rel*='lightbox']").lightBox();
	
	$("a[href$='jpg'].sample").lightBox();
	$("a[href$='gif'].sample").lightBox();	
	
	
	$("form.join").submit(function(){
	x=$("form.join input[name=email]").val();
	if(x=="E-mail Address" || x.replace(/ /g,'')==""){
			alert("Please enter your e-mail address.");
			return false;
			}
	else{
		return true;
		}
});

$("div.logoholder").hide();
$("div.logoholder").eq(0).show();
$("input.joinbutton")
	.mousedown(function(){ 
	$(this).removeClass("off");
	$(this).addClass("on");
	})
	.mouseup(function(){
	$(this).removeClass("on");
	$(this).addClass("off");
	});

	max=$("ul.thumbnails li").length;
	curr=0; 
	showfig(0);
	function showfig(x){
		if (x<0){x=max-1;}
		if (x==max){x=0;}
		$("ul.thumbnails li").removeClass("active");
		$("ul.thumbnails li").eq(x).addClass("active");
		$("ul.details li").hide();
		$("ul.details li").eq(x).fadeIn();
		curr=x;
	}
	
	$("ul.thumbnails a").click(function(){
		whichthumb=$("ul.thumbnails a").index(this); 
		showfig(whichthumb);
		return false;
	});
	
	$("a.prev").click(function(){
		showfig(curr-1);
		return false;
	});
	
	$("a.next").click(function(){
		showfig(curr+1);
		return false;
	});

	
	
$("a#shownews").click(function(){
	$("div#bodycopy").show();
	});
		
		
		
		
	
});


function makeAllInvisible() {
        var ids = new Array("COMMISSION", "PURCHASE", "Logo", "Painting","Ambigram");
            
        for(var i=0; i<ids.length; i++) {
            document.getElementById(ids[i]).style.display = "none";
        }
    }
    function setVisibility(inputElement) {
        var value = inputElement.value;
        
        makeAllInvisible();
        document.getElementById(value).style.display = "block";
    }
    makeAllInvisible();
    function makeMainInvisible() {
        var ids = new Array("PURCHASE","Ambigram","Painting","Logo");
            
        for(var i=0; i<ids.length; i++) {
            document.getElementById(ids[i]).style.display = "none";
        }
    }
    function setVisibility2(inputElement) {
        var value = inputElement.value;
        makeMainInvisible();
        document.getElementById(value).style.display = "block";
    }
    makeMainInvisible();

function checkform ( form )
{

if ((form.requesttype2[0].checked && form.ambigramtobedesigned.value=="") || (form.requesttype2[1].checked && form.logotobedesigned.value==""))
{

	    alert( "Please enter the word or phrase to be designed.");
	    form.email.focus();
	    return false ;
	}

  if (form.email.value == "") {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  }
  if (form.message.value == "") {
    alert( "Please enter your comment." );
    form.email.focus();
    return false ;
  }
  if (form.subject.value == "") {
    alert( "Please enter your name." );
    form.email.focus();
    return false ;
  }
  return true ;
}



