var common = jQuery.noConflict();
common(document).ready(function(){
	common(window).scroll(function () {
		common("#topRight-button").fadeIn().css("display", "block"); 
	});
});
function mask(end,middle,start,subject){
var one ='mai';
var two='lto:';
var three='?Subject=';
//start,middle,end,subject;
var putogether= one+two+start+middle+end+three+subject;
document.location.href=eval('"'+putogether+'"');
window.status=putogether;
}
function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

/*
 * FeatureList - simple and easy creation of an interactive "Featured Items" widget
 * Examples and documentation at: http://jqueryglobe.com/article/feature_list/
 * Version: 1.0.0 (01/09/2009)
 * Copyright (c) 2009 jQueryGlobe
 * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License
 * Requires: jQuery v1.3+
*/
;(function($) {
	$.fn.featureList = function(options) {
		var tabs	= $(this);
		var output	= $(options.output);

		new jQuery.featureList(tabs, output, options);

		return this;	
	};

	$.featureList = function(tabs, output, options) {
		function slide(nr) {
			if (typeof nr == "undefined") {
				nr = visible_item + 1;
				nr = nr >= total_items ? 0 : nr;
			}

			tabs.removeClass('current').filter(":eq(" + nr + ")").addClass('current');

			output.stop(true, true).filter(":visible").fadeOut();
			output.filter(":eq(" + nr + ")").fadeIn(function() {
				visible_item = nr;	
			});
		}

		var options			= options || {}; 
		var total_items		= tabs.length;
		var visible_item	= options.start_item || 0;

		options.pause_on_hover		= options.pause_on_hover		|| true;
		options.transition_interval	= options.transition_interval	|| 5000;

		output.hide().eq( visible_item ).show();
		tabs.eq( visible_item ).addClass('current');

		tabs.click(function() {
			if ($(this).hasClass('current')) {
				return false;	
			}

			slide( tabs.index( this) );
		});

		if (options.transition_interval > 0) {
			var timer = setInterval(function () {
				slide();
			}, options.transition_interval);

			if (options.pause_on_hover) {
				tabs.mouseenter(function() {
					clearInterval( timer );

				}).mouseleave(function() {
					clearInterval( timer );
					timer = setInterval(function () {
						slide();
					}, options.transition_interval);
				});
			}
		}
	};
})(jQuery);

var divArray = new Array();
var divNumber=0;
var imagePadding=0;
var animationSpeed=800;  //this is the speed of the animation
var waitInterval=5000;


var currentImage=1;

//*********Please change these settings if you have made some changes in the HTML or CSS files!************
var imageWidth=312;   //this is the width of a single image

var timer=-1;

$(function(){
getAllDivs();

setDefaultWidth();
setSlider();

timer = window.setInterval("moveLeft()", waitInterval);
});

/**
 *	Gets all the divs that have to be shown in the slider and fills them in an array.
 */
function getAllDivs(){
	//fill the divs in an array
	$(".imageHolder").each(function(i){
		divArray[i]=$(this);
		divNumber++;
	});
}

/**
 *	Moves the image wrapper to the right.
 */
function moveRight(){
	if(currentImage>1){
		$(".wrapper ul").animate({marginLeft:"+="+animationLength}, animationSpeed);
		currentImage--;
		window.clearInterval(timer);
		timer=window.setInterval("wait()", waitInterval);
	}
}

function wait(){
	window.clearInterval(timer);
	timer=window.setInterval("moveLeft()", waitInterval);
}

/**
 *	Moves the image wrapper to the left.
 */
function moveLeft(){
	if(currentImage<divNumber){
		$(".wrapper ul").stop().animate({marginLeft:-animationLength*(currentImage)}, animationSpeed);
		currentImage++;
	}else{
		$(".wrapper ul").stop().animate({marginLeft:0}, animationSpeed);
		currentImage=1;
	}
}


/**
 *	This is the main function. It sets click event handlers to the arrows to animate the divs.
 */
function setSlider(){
	
	//set a click event handler for the right gradient 
	$("#rightArrow").click(function(){	
		moveLeft();
		window.clearInterval(timer);
		timer=window.setInterval("wait()", waitInterval);
	});
	
	//set a click event handler for the left gradient
	$("#leftArrow").click(function(){	
		moveRight();
	});
	
	$("#rightArrow").mouseover(function(){	
		$("#rightArrow").css({cursor:"pointer"});
	});
	
	$("#leftArrow").mouseover(function(){	
		$("#leftArrow").css({cursor:"pointer"});
	});
}

/**
 *	Sets the width of a single div and the width of the div wrapper.
 */
function setDefaultWidth(){
	var allDivsWidth=0;	
	
	imagePadding=0;
	$(".imageHolder").css({paddingLeft:imagePadding+"px", paddingRight:imagePadding+"px"});
	allDivsWidth=divNumber*(2*imagePadding+imageWidth+2);
	
	//set the width of the wrapper div
	$(".wrapper ul").css({width:allDivsWidth+"px"});
	
	var marginLeft=0;
	
	//initial position of the images
	$(".wrapper ul").animate({marginLeft:"-="+marginLeft},1);
	
	animationLength=imageWidth;
}
