//------------Rating section -----------------
var imagePath		 = "http://172.24.0.9:7003/Storage/rating/";
//var imagePath		 = "http://smartdatainc.co.in:8066/Images/rating/";
//var imagePath = document.getElementById("imagePath").value ;

var largeStarLeftOn  = imagePath+"star_v_on_l.gif";
var largeStarLeftOff = imagePath+"star_v_off_l.gif";
var largeStarMidOn   = imagePath+"star_v_on_m.gif";
var largeStarMidOff  = imagePath+"star_v_off_m.gif";
var largeStarRightOn = imagePath+"star_v_on_r.gif";
var largeStarRightOff= imagePath+"star_v_off_r.gif";
UserRating	= 0;

/*
function isAddress(s){
	//var s=trim(s);
	var bag = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-, ";
	var flag = false; 
	
	for (i = 0; i < s.length; i++)
    {
        var c = s.charAt(i);
        if (bag.indexOf(c) != -1){
			flag = true;
		}
    }
    return flag;
}
*/

function checkBadWords(fieldName,badArr,replaceArr){

	var tempStr = new String();
	tempStr=getObject(fieldName).value;
	var i = 0;
	for(i in badArr){
		tempStr = tempStr.replace(eval("/"+badArr[i]+"/g"),replaceArr[i]);
	}
	getObject(fieldName).value = tempStr;
}


function intOnly(obj) {	
	if(obj.value.length>0) {
		obj.value = obj.value.replace(/[^\d]+/g, '');
	}
}

function floatOnly(obj) {
	if(obj.value.length>0) {
		obj.value = obj.value.replace(/[^\d\.]+/g, '');
	}
}

function getStats1(FormName,FieldName)
{
	var chk=chkBoxes(FormName,FieldName);
		if(chk==true) 
		{
		 // If Select Action not select...
		      // alert(document.getElementById('Action').value);
		       if(document.getElementById("Action").value== 0) 
			{
			   alert("Please select 'Select Action' to perform the desired action ?");
			  
		        }
		  
		  //
			if(document.getElementById("Action").value=='Active') 
			{
				if(confirm("Are you sure that you want to 'Activate' the selected Keyword(s) ?")) 
				{
					document.getElementById("Action").value='Active';
					return true;
				}
			}
			if(document.getElementById("Action").value=='Inactive') 
			{
				
				if(confirm("Are you sure that you want to 'Inactivate' the selected Keyword(s)?")) 
				{
					document.getElementById("Action").value='Inactive';
					return true;
				}
			}
		}
		return false;
}


function getStats(FormName,FieldName)
{
  	var chk=chkBoxes(FormName,FieldName);
  	
  	
			 
		if(chk==true) 
		{
		  // If Select Action not select...
		      // alert(document.getElementById('Action').value);
		       if(document.getElementById("Action").value== 0) 
			{
			   alert("Please select 'Select Action' to perform the desired action.?");
			  
		        }
		  
		  //
			if(document.getElementById('Action').value=='Active') 
			{
			  
				if(confirm("Are you sure that you want to 'Activate' the selected Task(s)?")) 
				{
					document.getElementById('Action').value='Active';
					//document.frmaddMember.submit();
					document.getElementById(FormName).submit();
					return true;
				}
			}
			if(document.getElementById('Action').value=='Inactive') 
			{
				
				if(confirm("Are you sure that you want to 'Deactivate' the selected Task(s)?")) 
				{
					document.getElementById('Action').value='Inactive';
					document.frmaddMember.submit();
					return true;
				}
			}
			
			if(document.getElementById('Action').value=='Delete') 
			{
				
				if(confirm("Are you sure to 'Delete' the Task(s)?")) 
				{
					document.getElementById('Action').value='Delete';
					document.frmaddMember.submit();
					return true;
				}
			}
		}
		
		return false;
}

// for population 

function SetAllCheck(FormName,FieldName)
	{
	var isChecked=document.getElementById('selectAll').checked;
	//alert("Hello");
	if(isChecked==true){
		var	CheckValue='true';
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;
		}
}


// End..


// for study design...



function SetAllCheckStudy(FormName,FieldName)
	{
	var isChecked=document.getElementById('selectstudy').checked;
	//alert("Hello");
	if(isChecked==true){
		var	CheckValue='true';
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;
		}
}


function checkMasterCheckBoxStudy(checkBoxObj,FormName,checkBoxName,masterCheckBoxName)
{
  allCheckBoxCheckedStatus	= false;
	formObj	= getObject(FormName);
	masterCheckBoxObj	= getObject(masterCheckBoxName);
	allCheckBoxCheckedStatus	= isAllcheckBoxSelected(formObj,checkBoxName);
	if(checkBoxObj.checked==true){
		if(allCheckBoxCheckedStatus==true){
			masterCheckBoxObj.checked	= true;
		}
	}else{
		masterCheckBoxObj.checked	= false;
	}
	
}
// End..

// for Theropetic Area...



function SetAllCheckTheropetic(FormName,FieldName)
	{
	var isChecked=document.getElementById('selecttheropetic').checked;
	//alert("Hello");
	if(isChecked==true){
		var	CheckValue='true';
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;
		}
}


function checkMasterCheckBoxTheropetic(checkBoxObj,FormName,checkBoxName,masterCheckBoxName)
{
  allCheckBoxCheckedStatus	= false;
	formObj	= getObject(FormName);
	masterCheckBoxObj	= getObject(masterCheckBoxName);
	allCheckBoxCheckedStatus	= isAllcheckBoxSelected(formObj,checkBoxName);
	if(checkBoxObj.checked==true){
		if(allCheckBoxCheckedStatus==true){
			masterCheckBoxObj.checked	= true;
		}
	}else{
		masterCheckBoxObj.checked	= false;
	}
	
}
// End..

// Dose Administration



function SetAllCheckdose(FormName,FieldName)
	{
	var isChecked=document.getElementById('selectdose').checked;
	//alert("Hello");
	if(isChecked==true){
		var	CheckValue='true';
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;
		}
}

// for Special Area...



function SetAllCheckSpecial(FormName,FieldName)
	{
	var isChecked=document.getElementById('selectspecial').checked;
	//alert("Hello");
	if(isChecked==true){
		var	CheckValue='true';
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;
		}
}


function checkMasterCheckBoxSpecial(checkBoxObj,FormName,checkBoxName,masterCheckBoxName)
{
  allCheckBoxCheckedStatus	= false;
	formObj	= getObject(FormName);
	masterCheckBoxObj	= getObject(masterCheckBoxName);
	allCheckBoxCheckedStatus	= isAllcheckBoxSelected(formObj,checkBoxName);
	if(checkBoxObj.checked==true){
		if(allCheckBoxCheckedStatus==true){
			masterCheckBoxObj.checked	= true;
		}
	}else{
		masterCheckBoxObj.checked	= false;
	}
	
}
// End..
// for keyword Activate and deactivate....1 May 2009....

function getStats_new(FormName,FieldName)
{
  	var chk=chkBoxes(FormName,FieldName);
		if(chk==true) 
		{
		
		 // If Select Action not select...
		      // alert(document.getElementById('Action').value);
		       if(document.getElementById("Action").value== 0) 
			{
			   alert("Please select 'Select Action' to perform the desired action ?");
			  
		        }
		  
		  //
			if(document.getElementById('Action').value=='Active') 
			{
			  
				if(confirm("Are you sure that you want to 'Activate' the selected Keyword(s) ?")) 
				{
					document.getElementById('Action').value='Active';
					//document.frmaddMember.submit();
					document.getElementById(FormName).submit();
					return true;
				}
			}
			if(document.getElementById('Action').value=='Inactive') 
			{
				
				if(confirm("Are you sure that you want to 'Deactivate' the selected Keyword(s) (s)?")) 
				{
					document.getElementById('Action').value='Inactive';
					document.frmaddMember.submit();
					return true;
				}
			}
			
			if(document.getElementById('Action').value=='Delete') 
			{
				
				if(confirm("Are you sure to 'Delete' the Keyword(s)?")) 
				{
					document.getElementById('Action').value='Delete';
					document.frmaddMember.submit();
					return true;
					
				}
			}
		}
		return false;
}

//

    function firstChanged() {
            
            
            if(document.getElementById("id").selectedIndex == "")
            {
                document.getElementById("list").disabled = false;
                }
            else
            {
                document.getElementById("list").disabled = true;
        
        }
      }
      
  
  function secondChanged() {
  
            if(document.getElementById("list").selectedIndex == "")
            {
                document.getElementById("id").disabled = false;
                }
            else
            {
                document.getElementById("id").disabled = true;
        
        }
        }
      
function OnMouseClickStars(ratingId){
    
	if(UserRating!=0){
		UserRating=0;
	}else {
		UserRating = ratingId; 	
		getObject("txtRating").value	= ratingId;
	}
}

function OnMouseOverStars(ratingId, img){

  if ((ratingId < 1)||(ratingId > 5)||(UserRating > 0))
    return;

  img.style.cursor = "pointer";
  
  if (ratingId >= 1)
    getObject("rating_star_1").src = largeStarLeftOn;
  else  
    getObject("rating_star_1").src = largeStarLeftOff;
        
  if (ratingId >= 2)        
    getObject("rating_star_2").src = largeStarMidOn;
  else  
    getObject("rating_star_2").src = largeStarMidOff;    
    
  if (ratingId >= 3)            
    getObject("rating_star_3").src = largeStarMidOn;
  else  
    getObject("rating_star_3").src = largeStarMidOff;    
    
  if (ratingId >= 4)                
    getObject("rating_star_4").src = largeStarMidOn;
  else  
    getObject("rating_star_4").src = largeStarMidOff;    
    
  if (ratingId >= 5)                    
    getObject("rating_star_5").src = largeStarRightOn;
  else  
    getObject("rating_star_5").src = largeStarRightOff;
}

function OnMouseOutRating(a, img){

  img.style.cursor = "default";

  if (UserRating == 0){
    getObject("rating_star_1").src = largeStarLeftOff;
    getObject("rating_star_2").src = largeStarMidOff;
    getObject("rating_star_3").src = largeStarMidOff;
    getObject("rating_star_4").src = largeStarMidOff;
    getObject("rating_star_5").src = largeStarRightOff;
 	getObject("txtRating").value	= 0;
  }  
}

function chkBoxes(FormName,FieldName)
{
	var chk=0;
	if(!document.forms[FormName])
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];

	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(countCheckBoxes){
		for(var i = 0; i < countCheckBoxes; i++){
			if(objCheckBoxes[i].checked==true) {
				chk=1;
				break;
			} else {
				chk=0;	
			}
		}
	} else {
		if(objCheckBoxes.checked==true){
			chk=1;
		}else {
			chk=0;
		}	
	}
	if(chk==0)
		{
			alert('Please check atleast one check box to perform the desired action');
			return false;
		}
		else
		{
			return true;
		}
}

function SetAllCheckBoxes(FormName,FieldName)
{
	var isChecked=document.getElementById('idSelectAll').checked;
	//alert("Rajesh");
	if(isChecked==true){
		var	CheckValue='true';
	}
	else{
		var	CheckValue='';
	}
	if(!document.forms[FormName])
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];

	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;
		}
}

// for Select all check box......1 May 2009

function SetAllCheckBoxes_new(FormName,FieldName)
{
//alert("raj");
	//var isChecked=document.getElementById('idSelectAll').checked;
	var isChecked=document.getElementById('selectAll').checked;

	if(isChecked==true){
		var	CheckValue='true';
		
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];

	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;

	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;

			
		}
}

//

function setSort(frmName,FieldName,srtBy) {
	document.forms[frmName].hidSortValue.value='sort';
	
	if(document.forms[frmName].hidSortValue.value=='sort')
	{
		if(srtBy=='')
		{
			document.forms[frmName].hidSortAction.value="ASC";	
		}
		else
		{
			document.forms[frmName].hidSortAction.value=srtBy;
		}
	}
	document.forms[frmName].hidSortField.value=FieldName;
	document.forms[frmName].submit();

}

function showBetweenDate(frmobj){
		document.getElementById('betweenData').style.display="";
		document.getElementById('betweenText').style.display="";
	}
	function hideBetweenDate(frmobj){
		document.getElementById('betweenData').style.display="none";
		document.getElementById('betweenText').style.display="none";
		document.getElementById('dateFrom').value="";
		document.getElementById('dateto').value="";
	}


function setView(frmObj,FieldName)
{
	if(document.forms[frmObj.name].show_name_photo.checked==true)
	{	
		document.getElementById(FieldName).value="thumb";
	}
}


	
	
	//=====================tooltip======================================
		function xstooltip_findPosX(obj) 
		{
		  var curleft = 0;
		  if (obj.offsetParent) 
		  {
			while (obj.offsetParent) 
				{
					curleft += obj.offsetLeft
					obj = obj.offsetParent;
				}
			}
			else if (obj.x)
				curleft += obj.x;
			return curleft;
		}
		
		function xstooltip_findPosY(obj) 
		{
			var curtop = 0;
			if (obj.offsetParent) 
			{
				while (obj.offsetParent) 
				{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			}
			else if (obj.y)
				curtop += obj.y;
			return curtop;
		}
		function xstooltip_show(tooltipId, parentId, divWidth,displayText,messageType)
		{
			posX	= 0;
			posY	= 0;
			//alert("sdfsdfsd");
			it = getObject(tooltipId);
			
			
			it.style.top	= "";
			it.style.width	= divWidth;
			it.style.left	= "";
			if ((it.style.top == '' || it.style.top == 0) 
				&& (it.style.left == '' || it.style.left == 0))
			{
				// need to fixate default size (MSIE problem)
				it.style.width = it.offsetWidth + 'px';
				it.style.height = it.offsetHeight + 'px';
				
				img = getObject(parentId); 
				
				// if tooltip is too wide, shift left to be within parent 
				if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
				if (posX < 0 ) posX = 0; 
				
				x = xstooltip_findPosX(img) + posX;
				y = xstooltip_findPosY(img) + posY;
				var browser=navigator.appName;
				if(browser=="Microsoft Internet Explorer"){
					it.style.top = y+35 + 'px';
					it.style.left = x+5 + 'px';
				}else {
					it.style.top = y+20 + 'px';
					it.style.left = x-5 + 'px';
				}
			}
			displayTextDivObj	= getObject("errorMessageTD");
			displayTextDivObj.innerHTML	= displayText; 
			if(messageType==1){
				displayTextDivObj.style.color	= "#CC3300";
			}else if(messageType==2){
				displayTextDivObj.style.color	= "#006600";
			}
			it.style.visibility = 'visible'; 
		}
		function xstooltip_hide(id)
		{
			it = getObject(id); 
			it.style.visibility = 'hidden'; 
		}
		
		
		
		function xstooltipImg_show(tooltipId, parentId, divWidth,imgSource)
		{
			posX	= 0;
			posY	= 0;
			
			it = getObject(tooltipId);
			it.style.top	= "";
			it.style.width	= divWidth;
			it.style.left	= "";
			if ((it.style.top == '' || it.style.top == 0) 
				&& (it.style.left == '' || it.style.left == 0))
			{
				// need to fixate default size (MSIE problem)
				it.style.width = it.offsetWidth + 'px';
				it.style.height = it.offsetHeight + 'px';
				
				img = getObject(parentId); 
			
				// if tooltip is too wide, shift left to be within parent 
				if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
				if (posX < 0 ) posX = 0; 
				
				x = xstooltip_findPosX(img) + posX;
				y = xstooltip_findPosY(img) + posY;
				var browser=navigator.appName;
				if(browser=="Microsoft Internet Explorer"){
					it.style.top = y+35 + 'px';
					it.style.left = x+5 + 'px';
				}else {
					it.style.top = y+20 + 'px';
					it.style.left = x-5 + 'px';
				}
			}
			displayImgDivObj		= getObject("imageforShowFull");
			displayImgDivObj.src	= imgSource;
			it.style.visibility = 'visible'; 
		}
		
	
	//====================================================================

//===============================Create object ============================

function getObject(a){
	  if(document.getElementById && document.getElementById(a)){
		return document.getElementById(a)
	  }else if(document.all&&document.all(a)){
		return document.all(a)
	  }else if(document.layers&&document.layers[a]){
		return document.layers[a]
	  }else{
		return false
	  }
}

//==========================================================================




// ===========================Prelaod images==============================


		function MM_swapImgRestore() { //v3.0
		  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
		}
		function MM_preloadImages() { //v3.0
		  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
		}

		function MM_findObj(n, d) { //v4.01
		  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		  if(!x && d.getElementById) x=d.getElementById(n); return x;
		}

		function MM_swapImage() { //v3.0
		  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
		}


// ==========================================================================

function showHideDiv(divName){
	divObj	= getObject(divName);
	if(divObj.style.display=="none"){
		divObj.style.display	= "inline";
	}else {
		divObj.style.display	= "none";
	}
}


function submitFormThroughJS(frmName){
	frmObj	= getObject(frmName);
	frmObj.submit();
}

function submitFormThroughHyperLink(obj){
	var validationFunction	= obj.name +"_validation(obj)";
	var returnStatus = eval(validationFunction);
	if(returnStatus==true){
		obj.submit();
	}
}

function resetFormThroughHyperLink(obj)
{
	obj.reset();
}


//===========================================================
function SetAllCheckBoxes(FormName,FieldName)
	{
	var isChecked=document.getElementById('checkAll').checked;

	if(isChecked==true){
		var	CheckValue='true';
		
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[FieldName];

	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;

	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;

			
		}
}

function checkMasterCheckBox(checkBoxObj,FormName,checkBoxName,masterCheckBoxName)
{
  allCheckBoxCheckedStatus	= false;
	formObj	= getObject(FormName);
	masterCheckBoxObj	= getObject(masterCheckBoxName);
	allCheckBoxCheckedStatus= isAllcheckBoxSelected(formObj,checkBoxName);
	var countCheckBoxes = checkBoxName.length;
	for(var i = 0; i < countCheckBoxes; i++) {
		if(checkBoxName[i].checked == false) {
			masterCheckBoxName.checked	= false;
		}
		else {
			masterCheckBoxName.checked	= true;
		}
	}
	
	if(checkBoxObj.checked==true){
		if(allCheckBoxCheckedStatus==true){
			masterCheckBoxObj.checked	= true;
		}		
	}else{
		masterCheckBoxObj.checked	= false;
	}
	
}


//=============================================================
//===========================================================
function checkedUnCheckedAllCheckboxes(FormName,masterCheckBoxObj,checkBoxName)
	{	
	
	var isChecked=masterCheckBoxObj.checked;
	
	if(isChecked==true){
		var	CheckValue='true';
		
	}
	else
	{
		var	CheckValue='';
	}	

	if(!FormName)
		return;
		var objCheckBoxes = document.forms[FormName].elements[checkBoxName];

	if(!objCheckBoxes)
		return;
		var countCheckBoxes = objCheckBoxes.length;

	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
		{
				objCheckBoxes[i].checked = CheckValue;

			
		}
}


//=============================================================


function isAllcheckBoxSelected(formObj,checkBoxName){
  var status	= false;
	var countCheckBoxes = 0;
	var objCheckBoxes = formObj.elements[checkBoxName];
	countCheckBoxes = objCheckBoxes.length;
	if(countCheckBoxes!=0){
		for(var i = 0; i <countCheckBoxes; i++){
			if(objCheckBoxes[i].checked==true){
				status	= true;
			}else{
				status	= false;
				break;
			}
		}
	}if(!countCheckBoxes) {
		if(objCheckBoxes.checked==true){
			status	= true;
		}else {
			status	= false;
		}
	}
	return status;
}


//======================= Javacsript function for mouse effect on buttons ===================================

//========== Function for loign button in header =============

function buttonOnMouseOverHeader(buttonObj,buttonEndImageDiv)
{
	buttonObj.className="buttonGrayBackground1";
	document.getElementById(buttonEndImageDiv).className="buttonEndGrayBackground1";
}
function buttonOnMouseOutHeader(buttonObj,buttonEndImageDiv)
{
	buttonObj.className="buttonRedBackground1";
	document.getElementById(buttonEndImageDiv).className="buttonEndRedBackground1";

}

//=============== function for normal button =================
function buttonOnMouseOver(buttonObj,buttonEndImageDiv)
{
	buttonObj.className="buttonGrayBackground";
	document.getElementById(buttonEndImageDiv).className="buttonEndGrayBackground";
}
function buttonOnMouseOut(buttonObj,buttonEndImageDiv)
{
	buttonObj.className="buttonRedBackground";
	document.getElementById(buttonEndImageDiv).className="buttonEndRedBackground";

}


//-------------------- Search box on top bar ====================
function onFocusOnSearchBoxInTop(){
	getObject('srch_data').value	= "";
}

function onFocusOutOnSearchBoxInTop(){
	if(getObject('srch_data').value	== "")
	getObject('srch_data').value	= "Keyword search";
}

//===============================================================

function validateListForm33(formObj){
	//alert("sjadflkjkl");return false;
	var flage	= 0;
	var val=formObj.selectOption.value;
	//alert(val);return false;
	var msg="Please select one checkbox to perform the desired action.";
	var objCheckBoxes = formObj.elements['selectAll_check[]'];
	var countCheckBoxes = objCheckBoxes.length;
	var confirmation;
	//alert(countCheckBoxes);return false;
	if(countCheckBoxes){
		for(var i = 0; i <countCheckBoxes; i++){
			if(objCheckBoxes[i].checked==true){
				flage=1;
				break;
			}else{
				flage=0;
			}
		}
	}else {
		if(objCheckBoxes.checked==true){
			flage=1;
		}else {
			flage=0;
		}
	}
	
	if(flage==1){ 
		confirmation=confirm("Are you sure you to '"+val+"' the selected record(s)?");
	}
	if(flage==0)
		alert(msg);
	
	if(confirmation==true)
		return true;
	else 
		return false;

}


function validateListFormNew33(){
        formObj = document.frmaddMember;
	//alert("formObj"+formObj)//;return false;
	//alert("formObj"+formObj.selectOption.value)
	var flage	= 0;
	var val=formObj.selectOption.value;
	//alert(val+"Pankaj");//return false;
	var msg="Please select one checkbox to perform the desired action.";
	var objCheckBoxes = formObj.elements['checkAll[]'];
	var countCheckBoxes = objCheckBoxes.length;
	var confirmation;
	//alert(countCheckBoxes);return false;
	if(countCheckBoxes){
		for(var i = 0; i <countCheckBoxes; i++){
			if(objCheckBoxes[i].checked==true){
				flage=1;
				break;
			}else{
				flage=0;
			}
		}
	}else {
		if(objCheckBoxes.checked==true){
			flage=1;
		}else {
			flage=0;
		}
	}
	
	if(flage==1){ 
		confirmation=confirm("Are you sure you to '"+val+"' the selected record(s)?");
	}
	if(flage==0)
		alert(msg);
	
	if(confirmation==true){

		return true;
		}
	else {
		return false;
             }
}


function validateListForm44(formObj){
	//alert("sjadflkjkl");return false;
	var flage	= 0;
	var val=formObj.changeAction.value;
	//alert(val);return false;
	var msg="Please select one checkbox to perform the desired action.";
	var objCheckBoxes = formObj.elements['checkAll[]'];
	var countCheckBoxes = objCheckBoxes.length;
	var confirmation;
	//alert(countCheckBoxes);return false;
	if(countCheckBoxes){
		for(var i = 0; i <countCheckBoxes; i++){
			if(objCheckBoxes[i].checked==true){
				flage=1;
				break;
			}else{
				flage=0;
			}
		}
	}else {
		if(objCheckBoxes.checked==true){
			flage=1;
		}else {
			flage=0;
		}
	}
	
	if(flage==1){
		confirmation=confirm("Are you sure you to '"+val+"' the selected Listings?");
	}
	if(flage==0)
		alert(msg);
	
	if(confirmation==true)
		return true;
	else 
		return false;

}

function validateListForm66(formObj){
	//alert("sjadflkjkl");return false;
	var flage	= 0;
	var val=formObj.changeAction.value;
	//alert(val);return false;
	var msg="Please select one checkbox to perform the desired action.";
	var objCheckBoxes = formObj.elements['checkAll[]'];
	var countCheckBoxes = objCheckBoxes.length;
	var confirmation;
	//alert(countCheckBoxes);return false;
	if(countCheckBoxes){
		for(var i = 0; i <countCheckBoxes; i++){
			if(objCheckBoxes[i].checked==true){
				flage=1;
				break;
			}else{
				flage=0;
			}
		}
	}else {
		if(objCheckBoxes.checked==true){
			flage=1;
		}else {
			flage=0;
		}
	}
	
	if(flage==1){
		confirmation=confirm("Are you sure you to '"+val+"' the selected Listings?");
	}
	if(flage==0)
		alert(msg);
	
	if(confirmation==true)
		return true;
	else 
		return false;

}

function changeLoginTab(user)
{
    if(user == "R")
	{
		document.getElementById("researcher").className = "logintabactive";
		document.getElementById("vendor").className = "logintab";
		document.getElementById("loginTab").value = "R";
	}
	else
	{
		document.getElementById("researcher").className = "logintab";
		document.getElementById("vendor").className = "logintabactive";
		document.getElementById("loginTab").value = "V";
	}
}

function checkLoginTabOnPostBack()
{
	
	if(document.getElementById("loginTab").value == "R")
	{
		document.getElementById("researcher").className = "logintabactive";
		document.getElementById("vendor").className = "logintab";
	}
	else if(document.getElementById("loginTab").value  == "V") 
	{
		document.getElementById("researcher").className = "logintab";
		document.getElementById("vendor").className = "logintabactive";
	}
}
//For Selecting/ deselecting check boxed
   function selectDeselect(field, isCheck) {
	   var boxes = document.getElementsByName(field);
	   var boxes_checked = anyChecked();
   
	   if(isCheck){
		   if(document.getElementsByName(isCheck)[0].checked) setChecks(true);
		   else setChecks(false);			
	   }else{
		   if(!boxes_checked) setChecks(true);
		   else setChecks(false);
	   }
   
	   function setChecks( setting ) {
		   for( var i=0; i < boxes.length; i++ ) {
			   boxes[ i ].checked = setting;
		   }
	   }
	   function anyChecked() {
		   for( var i=0; i < boxes.length; i++ ) {
			   if( boxes[i].checked == true) {
				   return (true);
			   } 
		   }
		   return (false);
	   }
   }

   //To check wheather user have selected box or not
   function anyChecked(field) {
	   var boxes = document.getElementsByName(field);
	   for( var i=0; i < boxes.length; i++ ) {
		   if( boxes[i].checked == true) {
			   return (true);
		   } 
	   }
	   return (false);
   }

   function checkSelection(field, name) {
	   ifAnyChecked(document.getElementsByName(field), name)
   }

   function ifAnyChecked(obj, name) {
	   var count = 0;
	   for( var i=0; i < obj.length; i++ ) {
		   if( obj[i].checked == false) {
			   count++;
		   } 
	   }

	   if(count > 0){
		   if(document.getElementById(name).checked){
			   document.getElementById(name).checked = false;
		   }
	   }
   }
   function setFocus(el){
	if(el != "undefined"){
		document.getElementById(el).focus();
		//setAlertStyle(el);
	//	addEvent(document.getElementById(el),'onblur',function(){ alert('hello!'); })
	}else if(typeof gl_el != "undefined"){
		gl_el.focus();	
	}
	return true;
	
  }
  
  function adminValidate(){
	//alert('hello');
	
	// User Name..
	if(document.getElementById('txtUserName').value == ''){
	alert('Please Enter User Name.');
	setFocus('txtUserName');
	return false;
	}
	
	// Password...
	
	if(document.getElementById('txtPassword').value == ''){
	alert('Please Enter Password.');
	setFocus('txtPassword');
	return false;
	}
	
	return true;
	
	}
	
	function adminAccountValidate(){
	//alert('hello');
	
	// User Name..
	
	if(document.getElementById('txtUserName').value == ''){
	alert('Please Enter User Name.');
	setFocus('txtUserName');
	return false;
	}
	// Email..
	
	if(document.getElementById('txtEmail').value == ''){
	alert('Please Enter Email.');
	setFocus('txtEmail');
	return false;
	}
	
	// Password...txtNewPassword
	
	if(document.getElementById('txtOldPassword').value == ''){
	alert('Please Enter Password.');
	setFocus('txtOldPassword');
	return false;
	}
	// New password...
	
	// Confirm Password..
	if(document.getElementById('txtNewPassword').value == ''){
		alert('Please Enter Confirm Password.');
		setFocus('txtNewPassword');
		return false;
	}
  
    else if(document.getElementById('txtNewPassword').value != document.getElementById('txtOldPassword').value )

			{
			
		alert('Invalid Confirm Password.');
		setFocus('txtNewPassword');
		return false;
			}
			
			//.......... End ....... /////
	return true;
	
	}
	
 //	  
  function addStaticPageValidate(){
	//alert('hello');
	
	// Page Name..
	if(document.getElementById('txtPageName').value == ''){
	alert('Please Enter Page Name.');
	setFocus('txtPageName');
	return false;
	}
	// Page Yrl..
	if(document.getElementById('txtPageUrl').value == ''){
	alert('Please Enter Page URL.');
	setFocus('txtPageUrl');
	return false;
	}
	// Page Title..
	if(document.getElementById('txtTitle').value == ''){
	alert('Please Enter Page Title.');
	setFocus('txtTitle');
	return false;
	}
	
	// Page Description...
	
	/*if(document.getElementById('content').value == ''){
	alert('Please Enter Page Description.');
	setFocus('content');
	return false;
	}*/
	
	return true;
	
	}

	
 //	  
  function addItemValidate(){
	//alert('hello');
	
	// Item File Name..
	if(document.getElementById('filename').value == ''){
	alert('Please Select CSV File Name.');
	setFocus('filename');
	return false;
	}
	
	return true;
	
	}
	  function resetText(obj) {

	textBoxId = obj.id;

	document.getElementById(textBoxId).value = '';	

  }