/**
 * @Copyright CSSJockey
 * @Website: http://www.cssjockey.com
 * This message must stay intact, read more about terms of use here: http://www.cssjockey.com/terms-of-use
 * Do not change anything in this document unless you know what you are doing.
 */
$(document).ready(function(){
// Wordpress Comments Check
	$("#commentform").submit(function(){
		var author = $("#author");
		var email = $("#email");
		var comment = $("#comment");
		var emailFormat = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
		if(author.val() == ""){alert("Name must be filled out!");author.focus();return false;}
		if (email.val() == "") {alert("Email must be filled out!");email.focus();return false;}
		if(email.val().search(emailFormat) == -1){alert("Please enter valid email address!");email.focus();return false;}
		if(comment.val() == ""){alert("Got nothing to say?");comment.focus();return false;}	
	}) // End Function
})
//#### Drop Down Menu ##################################
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;






$(document).ready(function(){
    $("a#show-panel").click(function(){
        $("#lightbox, #lightbox-panel").fadeIn(300);
    });
    $("a#close-panel").click(function(){
        $("#lightbox, #lightbox-panel").fadeOut(300);
    });
});


$(document).ready(function(){
	// add a "rel" attrib if Opera 7+
	if(window.opera) {
		if ($("a.bookmark").attr("rel") != ""){ // don't overwrite the rel attrib if already set
			$("a.bookmark").attr("rel","sidebar");
		}
	}

	$("a.bookmark").click(function(event){
		event.preventDefault(); // prevent the anchor tag from sending the user off to the link
		var url = this.href;
		var title = this.title;

		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		} else if(window.opera) { // Opera 7+
			return false; // do nothing - the rel="sidebar" should do the trick
		} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
			 alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
		}

	});
});
