
// JavaScript Document
	function imgSwap(oImg)
	{
    var strImg = oImg.src

    var strOver  = "_o.jpg";    // image to be used with mouse over
    var strOff = ".jpg";    // normal image
	if (strImg.indexOf(".png") != -1)
    {
	   strOver  = "_o.png";    // image to be used with mouse over
	   strOff = ".png";    // normal image
    
    }	
	   if (strImg.indexOf(strOver) != -1) 
		  oImg.src = strImg.replace(strOver,strOff)
	   else
		  oImg.src = strImg.replace(strOff,strOver)
	}
	
	function inputch01(txtedit,txtshow)
	{
		txtshow.style.display='none';
		txtedit.style.display='inline';
		txtedit.focus();
			
	}
	function inputch02(txtedit,txtshow)
	{
		if(txtedit.value=='')
		{
			txtshow.style.display='inline';
			txtedit.style.display='none';
			
		}	
	}
	
function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}
	/*
	New Function to support PNG rollovers
	21/05/2010
	*/
	function imgSwapPng(oImg)
	{
	   var strOver  = "_o.png";    // image to be used with mouse over
	   var strOff = ".png";    // normal image
	   var strImg = oImg.src
	   if (strImg.indexOf(strOver) != -1) 
		  oImg.src = strImg.replace(strOver,strOff)
	   else
		  oImg.src = strImg.replace(strOff,strOver)
	}
	/////////////////////////////////////////////////////////
	doJSONAJAP = function(url,callback){
	    $.getJSON(url,callback);
	};
	
	var DoSendInvite = function(qs){
	$.getJSON('../user/userajax.aspx?call=sendinvite&qs='+qs+'&JSONCallback=?',
	    function(jr){
	        $('#divMsg').html(jr.success.Msg);
	    }
	)};
	
	var DoOpenInvite = function(){
    // Send the request
    alert($('#emails').val());
    $.post('user/userajax.aspx?call=addcontacts', $('#emails').val(), function(response) {
        $('#emails').val('');
    }, 'json')
    };
	/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

function insertAtCursor(myField, myValue) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}

