﻿function validate_email(field,alerttxt)
{
    with (field)
    {
        apos= $(field).val().indexOf("@");
        dotpos=$(field).val().lastIndexOf(".");
        if (apos<1||dotpos-apos<2) 
          {alert(alerttxt);return false;}
        else {return true;}
    }
}

function isInteger(s) 
{
    return (s.toString().search(/^-?[0-9]+$/) == 0);
}

$.fn.clearForm = function() 
{
    return this.each(function() 
    {
        var type = this.type, tag = this.tagName.toLowerCase();
        if (tag == 'form')
        return $(':input',this).clearForm();
        if (type == 'text' || type == 'password' || tag == 'textarea')
        this.value = '';
        else if (type == 'checkbox' || type == 'radio')
        this.checked = false;
        else if (tag == 'select')
        this.selectedIndex = 0;
    });
};

function tooltip()
{	
    xOffset = -7;
    yOffset = -290;	
    $('.ToolTp').hover(function(e){		
        $(this).next()
            .css("top",(e.pageY - xOffset) + "px")
            .css("left",(e.pageX + yOffset) + "px")
            .fadeIn("fast");		
    },
    function(){	
        $(this).next().hide();
        });	
        $('.ToolTp').mousemove(function(e){
         $(this).next()
            .css("top",(e.pageY - xOffset) + "px")
            .css("left",(e.pageX + yOffset) + "px");
    });			
};
