	var the_timeout;
	var key = 0;
	var pre = -1;
	var num = 5;

	var tempSSn = 1;
	var ssCn = 1;
	var ssState = true;
	function rotateMainbg(n){
		if(ssState == true || n>0){
			if(ssCn==n) return;

			document.getElementById('btnTwin'+ssCn).src = 'images/pf_slider_dot.png';

			tempSSn = ssCn;
			ssCn++;
			if(ssCn>5) ssCn = 1;
			if(n>0) ssCn = n;

			document.getElementById('btnTwin'+ssCn).src = 'images/pf_slider_dotred.png';

			$('#im'+tempSSn).addClass('last-active');

			$('#im'+ssCn).css({opacity: 0.0})
				.addClass('active')
				.animate({opacity: 1.0}, 500, function() {
					$('#im'+tempSSn).removeClass('active last-active');
				});
		}
	}
	function showImage(index){
		key = index;
		clearTimeout(the_timeout);
		rotateMainbg();
	}

	function isEmailAddr(email) {
		var result = false;
		var theStr = new String(email);
		var index = theStr.indexOf("@");
		if (index > 0) {
			var pindex = theStr.indexOf(".",index);
			if ((pindex > index+1) && (theStr.length > pindex+1))
			result = true;
		}
		return result;
	}
	function formck(f) {
		if (f.Name.value == "") {
			alert("Please enter your name.");
			f.name.focus();
			return false;
		}
		if (!isEmailAddr(f.Email.value)) {
			alert("Please enter your valid email address.");
			f.email.focus();
			return false;
		}
		return true;
	}

	
	$(document).ready(function(){
		$('.pf_img').hover(function(){
			$("div",this).animate({top:'70px'},{queue:false,duration:160});
		}, function(){
			$("div",this).animate({top:'150px'},{queue:false,duration:160});
		});
		setInterval("rotateMainbg(0)",5000);
	});

	var startSlide = 0;
	var secondSlide = 1;
	var slideState = true;

	function moveSlide4(){
		if(!slideState) return;

		startSlide++;
		secondSlide++;

		startSlide = (startSlide>3) ? 1 : startSlide;
		secondSlide = (secondSlide>3) ? 1 : secondSlide;

		$("#slide_num"+startSlide).animate({left:'-1000px'}, {
			duration: 1000,
			specialEasing: {
				top: 'easeOutBounce'
			}}
		);
				
		$("#slide_num"+secondSlide).animate({left:'0px'}, {
			duration: 1000,
			specialEasing: {
				top: 'easeOutBounce'
			}}
		);


		tempvar = ((secondSlide+1)>3) ? 1 :  secondSlide+1;


//		$("#slide_num"+startSlide).css("left",2000);
		$("#slide_num"+tempvar).css("left",1000);
		
	}
	setInterval("moveSlide4()",8000);

	
	function isEmailAddr(Email) {
		var result = false;
		var theStr = new String(Email);
		var index = theStr.indexOf("@");
		if (index > 0) {
			var pindex = theStr.indexOf(".",index);
			if ((pindex > index+1) && (theStr.length > pindex+1))
			result = true;
		}
		return result;
	}
	function formck(f) {
		if (f.Name.value == "") {
			alert("Please enter your name.");
			f.Name.focus();
			return false;
		}
		if (!isEmailAddr(f.Email.value)) {
			alert("Please enter your valid email address.");
			f.Email.focus();
			return false;
		}
		return true;
	}
	
	/* Portfolio */
	var currNum = 1;
	function iconChgt(n){
		for(var i = 1; i<=3; i++){
			$("#imgBtn"+i).attr("src","../images/pf_slider_dot.png");
		}
		$("#imgBtn"+n).attr("src","../images/pf_slider_dotred.png");
		currNum = n;
	}
	function chgDivpos(){
		currNum++;
		currNum = (currNum>3) ? 1 : currNum;
		posNum = (currNum==1) ? '12px' : ((currNum==2) ? '-662px' : '-1324px');

		$("#threeImg").animate({left:posNum},{queue:false,duration:360});
		iconChgt(currNum);
	}
	$(document).ready(function(){
		$('#imgBtn1').hover(function(){
			$("#threeImg").animate({left:'12px'},{queue:false,duration:360});
			iconChgt(1);
		});
		$('#imgBtn2').hover(function(){
			$("#threeImg").animate({left:'-662px'},{queue:false,duration:360});
			iconChgt(2);
		});
		$('#imgBtn3').hover(function(){
			$("#threeImg").animate({left:'-1324px'},{queue:false,duration:360});
			iconChgt(3);
		});
	});

	setInterval("chgDivpos()",5000);



	$(document).ready(function(){/*
		$(".slider").easySlider({
			auto: true, 
			continuous: true,
			numeric: true
		});*/
		
		$('.worksWrapper').hover(function(){
			$(".workscaption", this).stop().animate({top:'80px'},{queue:false,duration:160});
		}, function() {
			$(".workscaption", this).stop().animate({top:'162px'},{queue:false,duration:160});
		});
	});

	/* Portfolio End */
