//ltrim function
function ltrim(argvalue) {

  while (1) {
    if (argvalue.substring(0, 1) != " ")
      break;
    argvalue = argvalue.substring(1, argvalue.length);
  }

  return argvalue;
}

//rtrim function
function rtrim(argvalue) {

  while (1) {
    if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
      break;
    argvalue = argvalue.substring(0, argvalue.length - 1);
  }

  return argvalue;
}

//trim function
function trim(argvalue) 
{
  var tmpstr = ltrim(argvalue);
  return rtrim(tmpstr);

}

//function to check email validation
	function validateEmail(email) {//passing controlas a argument
	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
	if (!re_mail.test(email.value)) {
		//alert("Error");
		//email.focus();
		//email.select();
		return false;
	}

	return true;
}

//function to check for number	
function isNumber(inputStr) {
		for( var i=0; i < inputStr.length; i++)
		{
			var oneChar = inputStr.substring(i, i + 1)
			if ((oneChar < "0" || oneChar > "9") && (oneChar!="."))
			{
				return false
				exit
			}
		}
		return true
}

//function to check for Integer
function isInteger(inputStr) {
		for( var i=0; i < inputStr.length; i++)
		{
			var oneChar = inputStr.substring(i, i + 1)
			if ((oneChar < "0" || oneChar > "9"))
			{
				return false
				exit
			}
		}
		return true
}

//validate date
function checkDate(day1,month1,year1) {
	if(month1== 1)
	{
	month1="Jan"
	}
	else if(month1== 2)	
	{
	month1="Feb"
	}
	else if(month1== 3)	
	{
	month1="Mar"	
	}
	else if(month1== 4)	
	{
	month1="Apr"	
	}
	else if(month1== 5)	
	{
	month1="May"	
	}
	else if(month1== 6)	
	{
	month1="Jun"	
	}
	else if(month1== 7)	
	{
	month1="Jul"	
	}
	else if(month1== 8)	
	{
	month1="Aug"	
	}
	else if(month1== 9)	
	{
	month1="Sep"	
	}
	else if(month1== 10)	
	{
	month1="Oct"	
	}
	else if(month1== 11)	
	{
	month1="Nov"	
	}
	else if(month1== 12)	
	{
	month1="Dec"	
	}

	var myDateStr = day1 + ' ' + month1 + ' ' + year1;
	//alert(myDateStr)
	var myDate = new Date( myDateStr );
	//alert(myDate)
	var myDate_string = myDate.toString();
	//alert(myDate_string)
	var myDate_array = myDate_string.split( ' ' );
	//alert(myDate_array[1])
	if ( myDate_array[1] != month1 ) {
		 return false;
		 } 
	else {
		return true;
	}
}

//add no. of days to a date
function addDays(myDate,days) {
    return new Date(myDate.getTime() + days*24*60*60*1000);
}

//Open popup window
function popup_win(filepath,h,w,l,t)
{
	window.open(filepath,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,max=no,WIDTH='+w+',HEIGHT='+h+',LEFT='+l+',TOP='+t);
}

//jump to url
function go_url(path) 
{
	top.location=path;
}

//Enable Disable a Control
function EnableDisable(ctrl,stat)
{
var var1;
var1=ctrl + '.disabled=' + stat;
eval(var1);
}

//Add to favorite
function FavoriteAdd()
{
	window.external.AddFavorite(location.href,document.title);
}

function show_hide(con)
{
	if(document.getElementById(con).className=='showtext')
		document.getElementById(con).className='hidetext';
	else
		document.getElementById(con).className='showtext';
}
function changeIt(objName)
{
	//The image object accessed through its id we mentioned in the DIV block which is going to be visible currently
	var obj = document.getElementById(objName);
	
	//An array that hold the IDs of images that we mentioned in their DIV blocks
	var objId = new Array();
	
	//Storing the image IDs into the array starts here
	objId[0] = "image1";
	objId[1] = "image2";
	objId[2] = "image3";
	//objId[3] = "image4";
	//objId[4] = "image5";
	//Storing the image IDs into the array ends here
	
	//A counter variable going to use for iteration
	var i;
	
	//A variable that can hold all the other object references other than the object which is going to be visible
	var tempObj;
	
	//The following loop does the display of a single image based on its ID. The image whose ID we passed into this function will be the
	//only image that is displayed rest of the images will be hidden based on their IDs and that part has been handled by the else part
	//of the if statement within this loop.
	for(i=0;i<objId.length;i++)
	{
		if(objName == objId[i])
		{
			obj.style.display = "block";
		}
		else
		{
			tempObj = document.getElementById(objId[i]);
			tempObj.style.display = "none";	
		}
	}
	return;	
}

<!-- PreLoad Wait-->
function waitPreloadPage() 
{ //DOM
	if (document.getElementById)
	{
		document.getElementById('prepage').style.visibility='hidden';
	}
	else
	{
		if (document.layers)
		{ //NS4
			document.prepage.visibility = 'hidden';
		}
		else 
		{ //IE4
			document.all.prepage.style.visibility = 'hidden';
		}
	}
}
<!-- PreLoad Wait Ends -->
function disableclick()
{
	alert('Copyright by Studio Thirsty Crow'); 
	return false;
}

function right(e) 
{
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
	{
		return false;
	}
	return true;
}

function context()
{
	//This function takes care of Net 6 and IE.
	alert ('Copyright@2010 Studio Thirsty Crow');
	return false;
}
