// CID JQUERY FUNCTIONS
// Created: 7-3-2009
// Author: Ivo Vandeberg
// Owner: Concept, Image & Design
// URL: http://cid-iv.com
// Portfolio: http://eyes-on-mywork.com
// Last update: 7-3-2009


$(document).ready(function(){

	// Contact options button.
	var baseColor = "#000";
	var hoverColor = "#FFF";
	$("ul#contact-options li a").mouseover(function(){
		// Store flash font colour.
		if ($(this).attr("rel") == "") {
			$(this).attr("rel", $(this).css("color"));
		}
		$(this).stop().css({"color": $(this).attr("rel")}).animate({"color": hoverColor}, 350);
	}).mouseout(function(){
		// Fade back font color.
		$(this).stop().css({"color": hoverColor}).animate({"color": baseColor}, 250);
	});
	
	// Hide noscript message.
	//$("#hide_noscript_msg").click(function(){
		//cid_hideMsg($(this).attr("id"));
	//});
	
	// Columnize text.
	$(".columnize").columnize();
	$(".columnize.ch250.cw400").columnize({width:400});
	
});

// Hide messages.
function cid_hideMsg(the_msg) {
	// Set cookie.
	
	// Hide message.
	$(the_msg).hide("slow");
}

// Flash font.
flashTextDirection = "up";
flashTextColor = "#257DC5";
function cid_flashFont(elem_id,elem_col) {
	// Set color
	var flashTo;
	if (flashTextDirection=="up") {
		flashTo = flashTextColor;
	} else {
		flashTo = elem_col;
	}
	// Flash color
	$(elem_id).stop().animate({"color": flashTo}, 150);
	// Flip
	if (flashTextDirection=="up") {
		flashTextDirection = "down";
	} else {
		flashTextDirection = "up";
	}
}

// Set cookie.
function SetCookie(cookieName,cookieValue,nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString();
}