
/**
 * Home Module JS Files
 * @author Pathfinder Solutions India
 * @link http://www.pathfindersolutions.biz
 * @version 1.0
 * @package justmeans
 * @subpackage home
 */
	function fnHide()
	{
		document.getElementById('hiddenform').style.display='';
		document.getElementById('contactform').style.display='none';    
		document.getElementById('info').style.display='none';    
	}
	
	function fnValidateCheck(cb,type) 
	{
		//var val = cb.checked;
		var frm = document.frmshowcontacts;
		var len = frm.elements.length;
		var cnt = 0;
		var i=0;
		for( i=0 ; i<len ; i++) 
		{
			if (frm.elements[i].checked==true) 
			{
				cnt = 1;
			}
		}
		
		if(cnt == 0)
		{
			alert('# Select atleast one checkbox.');
			return false;
		}
		else
		{
			frm.submit();
		}
	}
	
	function toggleAll(cb,type) {
		
		var val = cb.checked;
		var frm = document.frmshowcontacts;
		var len = frm.elements.length;
		var i=0;
		for( i=0 ; i<len ; i++) {
			if (frm.elements[i].name==type+'[]') {
			   frm.elements[i].checked=val;
			   
			   if(val ==true)
			   	addtoright(frm.elements[i]); 
			   else
			   	removefrmlist(frm.elements[i].id);
			}
		}
	}
	
	 function addtoright(obj)
			   {
			      
			     if(obj.checked == true)
				 {
					
				     if(checkIndex(obj.id) < 0)				     
					 {						 	
					     arrHolder.push(obj.id);
						 var arrValue = new Array();
						 var strValue = obj.value;
						 arrValue = strValue.split(":::");
						 var strUserName = arrValue[1];
						
						 strHtml = "<div id='d__"+obj.id+"' class='feed_date' style='height:20px; text-align:left;padding-left:5px;'><a href='javascript:removefrmlist(";
						 strHtml = strHtml + '"'+obj.id+ '"';				 
						 strHtml = strHtml + ");void(0);'>";
						 strHtml = strHtml + "<img src='images/contact_close.jpg' border='0' id='closeimg"+obj.id+"' onmouseover='this.src=";
						 strHtml = strHtml + '"images/contact_close_hover.jpg"'; 
						 strHtml = strHtml + "' align='absmiddle' onmouseout='this.src=";
						 strHtml = strHtml + '"images/contact_close.jpg"'; 
						 strHtml = strHtml + "' /></a> "+strUserName;
						 strHtml = strHtml + "</div>"
						 
						 if(invited < 1)  document.getElementById("note").style.display = "none";
						 document.getElementById("newholder").innerHTML = document.getElementById("newholder").innerHTML + strHtml;
						 invited = 1;
					}
				 }
				 else
				 {
					 removefrmlist(obj.id);
				 }
			   }
			   
			   
			   function fnDeselectMain(type)
				{
					if(type == 'existingemails')
					{
						document.getElementById('id_ECheckAll').checked = false;
						
					}
					else
					{
						document.getElementById('id_NCheckAll').checked = false;
					}
				}
				
				 var arrHolder = new Array();
			   var closeimg = new Image();
			   var closeimgh = new Image();
			   var invited = 0;
			   closeimg.src = "images/contact_close.jpg";
			   closeimgh.src = "images/contact_close_hover.jpg";
			   
			   function checkIndex(id)
			   {
			   		try{ 
						strIndex = arrHolder.indexOf(id);
					}
					catch(err)
					{
						strIndex =-1;
					}
					return strIndex;
			   }
			   
			   
			function fnTryAnother()
			{
				document.getElementById('contactform').style.display='block';    
				document.getElementById('info').style.display='block';    
				document.getElementById('contactlist').style.display='none';    		
			}
	
	
			function removefrmlist(id)
		   	{
			  strIndex = arrHolder.indexOf(id);
			  arrHolder.splice(strIndex,1);
			document.getElementById("d__"+id).style.display = 'none';
			var oNodeToRemove = document.getElementById("d__"+id);
			oNodeToRemove.parentNode.removeChild(oNodeToRemove);
			  document.getElementById(id).checked = false;	
			  
			  if(arrHolder.length < 1) {
			  document.getElementById("note").style.display = "block";
			  invited = 0;
			  }
		   	}
			
			function fnValidateEmailForm(actionname,callparams)
			{	
				
				var setaction = "";
				var setcallparams = "";
				var setaction = actionname;
				var setcallparams = callparams;
				
//javascript:Lightbox.showBoxByAJAX('{frmaction}&uemail='+document.getElementById('id_txtpromoteemail').value+'&udomain='+document.getElementById('id_grabcombo').value+'&upassw='+document.getElementById('id_txtpassword').value+'&{callbackparams}',600,600); void(0);
				var strError = "";
				if(document.getElementById('id_txtpromoteemail').value == "" || document.getElementById('id_txtpromoteemail').value == "Your Email" )
				{
					strError = 	strError + " Enter email \n";
				}
				if(document.getElementById('id_txtpassword_grab').value == "" || document.getElementById('id_txtpassword_grab').value == "Your Password")
				{
					strError = 	strError + " Enter password \n";
				}
					
				if(strError != "")
				{
					alert(strError);
					return false;
				}
				else
				{				
					
					//alert(setaction+'?uemail='+document.getElementById('id_txtpromoteemail').value+'&udomain='+document.getElementById('id_grabcombo').value+'&upassw='+document.getElementById('id_txtpassword_grab').value+'&'+setcallparams);
					Lightbox.showBoxByAJAX(setaction+'?uemail='+document.getElementById('id_txtpromoteemail').value+'&udomain='+document.getElementById('id_grabcombo').value+'&upassw='+document.getElementById('id_txtpassword_grab').value+'&'+setcallparams,600,600);
					return false;
				}
			}
			
			
		function fnShowPromoteEmailBox()
		{
			if(document.getElementById("id_txtpromoteemail").value == "" || document.getElementById("id_txtpromoteemail").value == "Your Email")
			{				
				document.getElementById("id_txtpromoteemail").value = "";				
				document.getElementById("id_txtpromoteemail").focus();
			}		
		}
	
		function fnShowPromotePasswordBox()
		{
			if(document.getElementById("id_txtpassword_grab").value == "" || document.getElementById("id_txtpassword_grab").value == "Your Password")
			{				
				document.getElementById("id_txtpassword_grab").value = "";				
				document.getElementById("id_txtpassword_grab").type = "password";
				document.getElementById("id_txtpassword_grab").focus();
			}		
		}