/*<![CDATA[*/
		   
/*****************************************************************************
//-> START GENERAL FUNCTIONS
*****************************************************************************/

// --> Start label2value
this.label2value = function(){
	// function
	$("label.s-frm").each(function(){
		obj = document.getElementById($(this).attr("for"));
		if(($(obj).attr("type") == "text") || (obj.tagName.toLowerCase() == "textarea")){
			//$(obj).addClass(inactive);
			var text = $(this).text();
			$(this).css("display","none");
			$(obj).val(text);
			$(obj).focus(function(){
				//$(this).addClass(focused);
				//$(this).removeClass(inactive);
				//$(this).removeClass(active);
				if($(this).val() == text) $(this).val("");
			});
			$(obj).blur(function(){
				//$(this).removeClass(focused);
				if($(this).val() == "") {
					$(this).val(text);
					//$(this).addClass(inactive);
				} else {
					//$(this).addClass(active);
				};
			});
		};
	});
};

/*****************************************************************************
//-> END GENERAL FUNCTIONS
*****************************************************************************/

/*****************************************************************************
//-> START Window Load
*****************************************************************************/

$(document).ready(function () {

    // --> Start Home Page Tabs
    var tabContainers = $('div.pages > div');
    tabContainers.hide().filter(':first').show();

    //$('ul#tabs-links li a').click(function () {
    $('ul#tabs-links li a').mouseover(function () {
        $("div.pages div").hide(); //hide all    
        //tabContainers.stop().slideUp();        
        //tabContainers.filter(this.hash).stop().slideDown();
        tabContainers.filter(this.hash).show(); //fadeIn();        
        $('ul#tabs-links li').removeClass('selected');
        $(this).parent().addClass('selected');
        return false;
    }).filter(':first').click();

    /* --> Start Vertically align Hp titles
    $("div.hp-featured-box").each(function () {
											
    var elm_height = $(this).height();
    var img_height = $(this).find("div.title img").height();
		
    $(this).find("div.title").css({"height":elm_height});
    $(this).find("div.title img").css({"margin-top":(elm_height - img_height)/2});
    });
    */
    // --> Start Feature list alternating colors
    $("table.features-list tbody tr:odd").css({ "background-color": "#fae6d9" });

    // --> Start Feature list alternating colors
//    $("table.features-list tbody tr").each(function () {
//        var org_clr = $(this).css("background-color");
//        $(this).hover(function () {
//            $(this).css({ "background-color": "#FFC" });
//        }, function () {
//            $(this).css({ "background-color": org_clr });
//        });
//    });


    // --> Start Disable '#' links from being clicked
    $("a[href^='#']").click(function () {
        return false;
    });

    // --> Init External Links
    $("a[rel*='external']").attr("target", "_blank");

    // --> Stripping a tags with: class="remove"
    $("a[class*='strip']").each(function () {
        $(this).replaceWith($(this).html());
    });

    // --> Init SPAM Email links
    $("a[href^='mailto:']").each(function () {
        var mail = $(this).attr("href").replace("mailto:", "");
        var replaced = mail.replace("/at/", "@");
        $(this).attr("href", "mailto:" + replaced);
        if ($(this).text() == mail) {
            $(this).text(replaced);
        }
    });

    // --> Init Label2Value
    label2value();
});  
/*****************************************************************************
//-> END Window Load
*****************************************************************************/

/*]]>*/
