﻿// JScript File

$(document).ready(
    function () 
    {        
        //side panel head
        jQuery.each($(".ap"),
            function()
            {
                $(this).prepend("<div class='pn_hd'>" + $(this).attr("title") + "</div>");
            }
        );
        
        //format watermark
        jQuery.each($("input.wm"),
            function()
            {
                $(this).addClass("wm_on").val($(this).attr("title"));
            }
        );
        $("input.wm").focus(
            function ()
            {
                if(jQuery.trim($(this).val())==$(this).attr("title") && $(this).hasClass("wm_on"))
                {
                    $(this).val("");
                    $(this).removeClass("wm_on");
                }
            }
        );
        $("input.wm").blur(
            function ()
            {
                if(jQuery.trim($(this).val())=="")
                {
                    $(this).val($(this).attr("title"));
                    $(this).addClass("wm_on");
                }
            }
        );       

        //format table-layout of sign up (su)
        //$("table.su").css({marginTop:"25px"});   
        $("table.su tr td:first").css({width:"125px"});
        //format email to be longer than others
        $("input.em").css({width:"200px"});
        
    }
);

//Notification Message
function showMessage(message, type)
{
   $("#message_panel").click(
            function()
            {
                $(this).fadeOut();
            }
   ).html("<span class='message_text message_"+type+"'>"+message+"</span><span class='message_click'>click to hide</span><div class='clearme'></div>").fadeIn("slow");
}

//Query String 
(function() { 
        jQuery.query = r = {}; 
        var q = location.search;         
        q = q.replace(/^\?/,''); // remove the leading ?         
        q = q.replace(/\&$/,''); // remove the trailing & 
        jQuery.each(q.split('&'), function(){ 
                var key = this.split('=')[0]; 
                var val = this.split('=')[1]; 
                // convert floats 
                if(/^[0-9.]+$/.test(val)) 
                        val = parseFloat(val); 
                // ingnore empty values 
                if(val) 
                        r[key] = val; 
        }); 
})(); 

