function Right(str, n)
{
      if (n <= 0)
          return "";
      else if (n > String(str).length)
          return str;
      else
   {
          var iLen = String(str).length;
          return String(str).substring(iLen, iLen - n);
      }
}

function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}


function Trim(str)
{
	return LTrim(RTrim(str));
}

function LTrim(str) 
{
	for (var i=0; ((str.charAt(i)<=" ")&&(str.charAt(i)!="")); i++);
	return str.substring(i,str.length);
}

function RTrim(str)
{
	for (var i=str.length-1; ((str.charAt(i)<=" ")&&(str.charAt(i)!="")); i--);
	return str.substring(0,i+1);
}



function getYPosition( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function getXPosition( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue +=oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}


function ajaxGeneral(path,swDebug)
 {  
  s="";
  var xmlHttp;
  var x;
  try
	{    
	// Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest();    
	}
  catch (e)
	{    
	  // Internet Explorer    
	  try
	  {      
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  }
	catch (e)
	  {      
	  try
		{
		   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");   
		}
	  catch (e)
		{        
		alert("Your browser does not support AJAX!");       
		return false;        
		}      
	  } 
	}
	err=new Error();
	try{
		xmlHttp.open("GET",path,false);
		xmlHttp.send("null");
		s=xmlHttp.responseText;
	   }
	catch(err){alert(err.description);s="";}
	
	if (swDebug==1) window.open(path);
	
	return unescape(s);
	
}

function sendMail(whichdiv,sName,sPhone,sEmail){
        iediv=eval(whichdiv)
        iediv.innerHTML = '<div style="text-align:center;margin-top:10px;"><img src="images/ajax-loading.gif" width="31px" height="31px" alt="" /></div>'
        //setTimeout("ajaxGeneral('NewsletterSignAjax.asp?fName=' + sName + '&Phone=' + sPhone + '&Email=' + sEmail ,0)",1500);

        //iediv.innerHTML = 'NewsletterSignAjax.asp?fName=' + sName + 'Phone=' + sPhone + 'Email=' + sEmail;
		iediv.innerHTML = ajaxGeneral('NewsletterSignAjax.asp?fName=' + sName + '&Phone=' + sPhone + '&Email=' + sEmail ,0); 
}

		
		
function OpenDiv(DivID)
{
if(document.getElementById(DivID).style.display == 'none')
	document.getElementById(DivID).style.display = 'inline'
else
	document.getElementById(DivID).style.display = 'none'
}


function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) 
{ //v3.0
	if(window.screen)if(isCenter)if(isCenter=="true"){
	var myLeft = (screen.width-myWidth)/2;
	var myTop = (screen.height-myHeight)/2;
	features+=(features!='')?',':'';
	features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}


function pasteInput(obj,txt)
 {
  if(obj.value == '')
	{
		obj.value = txt;
	}
 }
 
function clearInput(obj,txt)
 {
  if(obj.value == txt)
	{
		obj.value = "";
	}
 }

