
	function DESemail(emailname,emailserver) {
		document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
		document.write(emailname + "@" + emailserver); 
		document.write("</a>"); 
	}

	function initClientsList() {
		if (document.getElementById("client_list")) {
			$("#client_list a").click( function() {
				var clientID = $(this).attr("rel");
				$("#client_list a").removeClass("active");
				$("#client_content").hide();
				$("#preloading").css("display", "block");

				$("#client_content").load("/incs/actions/clients.php?clientID=" + clientID,
					null,
					function() {
						$("#client_content").slideDown("medium");
						$("#preloading").css("display", "none");
					}
				);

				$(this).addClass("active");
				return false;
			});
		}
	}

	function initMailingList() {
		$("#YMLP0").one("click",function() {
			if ($(this).val() == 'enter email address...') $(this).val("");
		}).focus(function() {
			$(this).addClass("foc");
		});

		$("#sgo").hover(
			function() { $(this).addClass("hov");    },
			function() { $(this).removeClass("hov"); }
		);
	}

	function initPoemForm() {
		$("#poem_form input.def").focus(function() {
			$(this).addClass("foc");
		}).blur(function() {
			$(this).removeClass("foc");
		});

		$("#poem_form textarea").focus(function() {
			if ($(this).val() == 'enter your poem in here...') $(this).val("");
			$(this).addClass("foc");
		}).blur(function() {
			if ($(this).val() == '') $(this).val("enter your poem in here...");
			$(this).removeClass("foc");
		});

		$("#submit_btn").hover(
			function() { $(this).addClass("hov");    },
			function() { $(this).removeClass("hov"); }
		);
	}

	function initServicesList() {
		if ($("#service_list").get(0)) {
			$("#service_list a").click( function() {

				var serviceID = $(this).attr("rel");
				$("#service_list a").removeClass("active");
				$("#service_content").hide();
				$("#preloading").css("display", "block");
			
				var randomnumber = Math.floor(Math.random() * 150);

				newSrc  = '/img/fullsize/services' + serviceID + '.jpg';
				newSrc += '?ran=' + randomnumber;

				var nextImg = new Image();
				nextImg.src = newSrc;

				$("#service_content").load("/incs/actions/services.php?serviceID=" + serviceID,
					null,
					function() {
						$("#service_content").slideDown("medium");
						$("#preloading").css("display", "none");
					}
				);

				$(this).addClass("active");
				return false;
			});
		}
	}



	$(function() {
		initServicesList();
		initClientsList();
		initMailingList();
		initPoemForm();

		if (document.images) {
			pic1     = new Image(912, 630); 
			pic1.src = "/img/design/about_bg.jpg"; 
			pic2     = new Image(912, 630); 
			pic2.src = "/img/design/awards_bg.jpg"; 
			pic3     = new Image(912, 630); 
			pic3.src = "/img/design/services_bg.jpg"; 
			pic4     = new Image(912, 630); 
			pic4.src = "/img/design/contact_bg.jpg"; 
		}

		if ($('#cycle').get(0)) {
			function cycle_react(response) {
				$(response).insertAfter('.master');

				$('.master')
					.css({ height : 260 })
					.cycle({
						timeout: 0,
						pager: '.triggers',
						pagerAnchorBuilder: function(idx, slide) {
							return '.triggers li:eq(' + (idx) + ') a';
						}
					});
			}

			id = $('#cycle').attr('class');

			$.ajax({
				data : { 'ajax' : true, 'id' : id },
				dataType: 'html',
				success : function(response) {
					cycle_react(response);
				},
				type : 'GET',
				url : '/incs/actions/vidpics.php'
			});
		}
	});
