/* Method to replace the '$(id)' in the functions */
function $(id){return document.getElementById(id);}

/* Method to validate the format of the email */
function validateEmail(sEmail)
{
	var bAtmail = false;
	var bDotmail = false;
	var sCorrEmailVal = '0';
	for(i=0;i<=sEmail.length;i++)
   	{
     	if(sEmail.charAt(i)=='@' && !bAtmail)
     	{
	     	bAtmail=true;
	   	}
	   	
     	if(sEmail.charAt(i)=='.' && bAtmail && !bDotmail)
     	{
	     	bDotmail=true;
	    }
   	}
   	if(bAtmail && bDotmail)
	{
		var sCorrEmailVal = '1';
	}
	return sCorrEmailVal;
}

/* Method to validate the special characters */
function validateSpecialChars(sUsername)
{
	var numaric = sUsername;
	var sCorrSpecialChars = '0';
	for(var j=0; j<numaric.length; j++)
	{
		  var alphaa = numaric.charAt(j);
		  var hh     = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || (hh == 46))
		  {
			  sCorrSpecialChars = '1';
		  }
		  else	
		  { 
              return false;
		  }
    }
	 return true;
}

/* Method to validate the username length */
function validateUserLen(sUsername)
{
	var numaric = sUsername;
	if((numaric.length > 18) || (numaric.length < 8))
	{
		var sCorrUserLen =  false;
	}
	else var sCorrUserLen =  true;
	return sCorrUserLen;		
}

/* Method to validate the Areas of Interest section */
function  checkAreaInterest(iTotal)
{
	var chkStatus = 0;
	for(j=0; j<iTotal; j++)
	{
		var chkName = 'chkAreaInterest'+j;
		if($(chkName).checked == true)
		{
			chkStatus++;
	    }
	}
	return chkStatus;
}

/* Method to validate the integer fields */
function isInteger(s)
{  
    var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
   return true;
}

/* Methods to open and close the 'Date of Birth' overlay in the registration page */
function showDiv(obj)
{
	$(obj).style.display = 'block';
}
function closeDiv(obj)
{
	$(obj).style.display = 'none';
}

/* Method to validate the user inputs in the registration page */
function submitNewUser()
{
	$('errormessage').style.display = "block";
	var oForm = $('frmAddMember');
	var sEmail = $('frmAddMember').txtEmail.value;
	sCorrEmailVal = validateEmail(sEmail);	
	var sUsername = $('frmAddMember').txtUsername.value;
	sCorrUserLen      = validateUserLen(sUsername);
	sCorrSpecialChars = validateSpecialChars(sUsername);
	
	if(($('frmAddMember').txtUsername.value != "") && (sCorrUserLen == true) )
	{    
			$('txtUsername').style.border = "1px solid #00CC00";		   		
	}
	else $('txtUsername').style.border = "1px solid red";	
	if(($('frmAddMember').txtUsername.value != "") && (sCorrSpecialChars == true) )
	{    
		$('txtUsername').style.border = "1px solid #00CC00";				
	 }
	else $('txtUsername').style.border = "1px solid red";	
	  if(($('frmAddMember').txtEmail.value != "") && (sCorrEmailVal == '1'))
	  {
		  sErrEmail = "";
		  $('txtEmail').style.border = "1px solid #00CC00";	      
		  sErrEmailVal = '0';
	  } 
	  else $('txtEmail').style.border = "1px solid red";	
	  if($('frmAddMember').txtPwd.value != "")
	  {
		    sErrPassword = "";
			$('txtPwd').style.border = "1px solid #00CC00";		    
			sErrPasswordVal = '0';
	  }
	  else $('txtPwd').style.border = "1px solid red";	
	  if($('frmAddMember').txtRetypePwd.value != "")
	  {
		    sErrRetypePassword = "";
			$('txtRetypePwd').style.border = "1px solid #00CC00";		    
			sErrRetypePasswordVal = '0';
	  }
	  else $('txtRetypePwd').style.border = "1px solid red";		 
	
	  if($('frmAddMember').txtUsername.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrFName = "<b>Error:</b> Please provide an Username.<br/>";
		  $('errormessage').innerHTML = sErrFName;
	      $('txtUsername').style.borderWidth 	= "1px";
	      $('txtUsername').style.borderColor 	= "red";
	      $('txtUsername').style.borderStyle 	= "solid";
	      var sErrFNameVal = '1';
		  oForm.txtUsername.focus();		  
	  }
	  else if(($('frmAddMember').txtUsername.value != "") && (sCorrUserLen == false))
	  {	   
		   $('errormessage').style.color 		= "red";
		   var sErrEmail1 = "<b>Error:</b> The Username should be between 8 - 18 characters.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail1;
	       $('txtUsername').style.borderWidth 	= "1px";
	       $('txtUsername').style.borderColor 	= "red";
	       $('txtUsername').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
	       oForm.txtUsername.value='';
		   oForm.txtUsername.focus();
	  } 
	  else if(($('frmAddMember').txtUsername.value != "") && (sCorrSpecialChars == false))
	  {	   
		   $('errormessage').style.color 		= "red";
		   var sErrEmail1 = "<b>Error:</b> Your Username should not contain any special characters or blank space.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail1;
	       $('txtUsername').style.borderWidth 	= "1px";
	       $('txtUsername').style.borderColor 	= "red";
	       $('txtUsername').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
	       oForm.txtUsername.value='';
		   oForm.txtUsername.focus();
	  } 
	  else if($('frmAddMember').txtEmail.value == "")
	  {		  	  
		  $('errormessage').style.color 	= "red";
		  var sErrEmail = "<b>Error:</b> Please enter your Email Address.<br/>";
		  $('errormessage').innerHTML 		= sErrEmail;	  
	      $('txtEmail').style.borderWidth 	= "1px";
	      $('txtEmail').style.borderColor 	= "red";
	      $('txtEmail').style.borderStyle 	= "solid";
		  oForm.txtEmail.focus();
	  }
	  else if(($('frmAddMember').txtEmail.value != "") && (sCorrEmailVal == '0'))
	  {	   
		   $('errormessage').style.color 		= "red";
		   var sErrEmail1 = "<b>Error:</b> The Email field should have the correct format.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail1;
	       $('txtEmail').style.borderWidth 	= "1px";
	       $('txtEmail').style.borderColor 	= "red";
	       $('txtEmail').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
	       oForm.txtEmail.value='';
		   oForm.txtEmail.focus();
	  } 
	  else if($('frmAddMember').txtPwd.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrPassword = "<b>Error:</b> Please provide your Password.<br/>";
		  $('errormessage').innerHTML = sErrPassword;
	      $('txtPwd').style.borderWidth 	= "1px";
	      $('txtPwd').style.borderColor 	= "red";
	      $('txtPwd').style.borderStyle 	= "solid";
	      sErrPasswordVal = '1';
		  oForm.txtPwd.focus();
	  }	  
	  else if($('frmAddMember').txtRetypePwd.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrRetypePassword = "<b>Error:</b> Please retype the password.<br/>";
		  $('errormessage').innerHTML = sErrRetypePassword;
	      $('txtRetypePwd').style.borderWidth 	= "1px";
	      $('txtRetypePwd').style.borderColor 	= "red";
	      $('txtRetypePwd').style.borderStyle 	= "solid";
	      var sErrRetypePasswordVal = '1';
		  oForm.txtRetypePwd.focus();
	  }
	  else if(($('frmAddMember').txtRetypePwd.value != "") && (($('frmAddMember').txtPwd.value) != ($('frmAddMember').txtRetypePwd.value)))
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrRetypePassword = "<b>Error:</b> Please retype the password correctly.<br/>";
		  $('errormessage').innerHTML = sErrRetypePassword;
	      $('txtRetypePwd').style.borderWidth 	= "1px";
	      $('txtRetypePwd').style.borderColor 	= "red";
	      $('txtRetypePwd').style.borderStyle 	= "solid";
	      var sErrRetypePasswordVal = '1';
		  oForm.txtRetypePwd.focus();
	  }	  
	  else if($('frmAddMember').txtSecurity.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrSecCode = "<b>Error:</b> Please enter the security code.<br/>";
		  $('errormessage').innerHTML = sErrSecCode;
	      $('txtSecurity').style.borderWidth 	= "1px";
	      $('txtSecurity').style.borderColor 	= "red";
	      $('txtSecurity').style.borderStyle 	= "solid";
	      var sErrSecCodeVal = '1';
		  oForm.txtSecurity.focus();	  
	  }
	  else if($('frmAddMember').txtSecurity.value != "")
  	  {
  	     var url = './user360/app/submit-join.rem.php';
		 //Set up the parameters of our AJAX call
		 //$('errormessage').style.color = "black";
		 var postStr = $("txtSecurity").name + "=" + encodeURIComponent( $("txtSecurity").value );
		 //Call the function that initiate the AJAX request
		 makeRequestJoin(url, postStr); 	     
   	  } 
}

/* Method to validate the user inputs in the News/ Blogs Add page while submitting the entry */
function  submitAddNews()
{
	var oForm = $('frmAdd');
	var iTotal = $('hidAreasValue').value;
    chkStatus = checkAreaInterest(iTotal);
    if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}	
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Description field.');
		oForm.taDescription.focus();
		return false;
	}
	else if(chkStatus== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value != '' && $('filePhoto').value == '')
	{
		alert ('Please upload the photo for your caption.');
		oForm.filePhoto.focus();
		return false;
	}
	else if($('dmCity').value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=news-and-blog&EventParam=add&Action=submit";
		oForm.submit();
	}
}

/* Method to validate the user inputs in the News/ Blogs Add page while saving the entry */
function saveAddNews()
{
	var oForm = $('frmAdd');
	
    if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 120)
	{
		alert ('Title field should be 120 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=news-and-blog&EventParam=add&Action=save";
		oForm.submit();
	}
}

/* Method to validate the user inputs in the News/ Blogs Edit page while saving the entry */
function  editSaveNews(iArticleId)
{
	var oForm = $('frmEdit');
	
    if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 120)
	{
		alert ('Title field should be 120 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else
	{
	   	document.frmEdit.action = "my360.php?ModuleParam=news-and-blog&EventParam=edit&Action=save&ArticleId="+iArticleId;
		oForm.submit();
	}
}

/* Method to validate the user inputs in the News/ Blogs Edit page while submitting the entry */
function  editSubmitNews(iArticleId)
{
	var oForm = $('frmEdit');
	var iTotal = $('hidAreasValue').value;
	chkStatus = checkAreaInterest(iTotal);
    if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 120)
	{
		alert ('Title field should be 120 character of length.');
		oForm.txtTitle.focus();
		return false;
	}	
	else if($('frmEdit').taDescription.value == '')
	{
		alert ('Please fill up the Description field.');
		oForm.taDescription.focus();
		return false;
	}
	else if(chkStatus== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
    else if($('dmCity').value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
	else
	{
	   	document.frmEdit.action = "my360.php?ModuleParam=news-and-blog&EventParam=edit&Action=submit&ArticleId="+iArticleId;
		oForm.submit();
	}
}

/* Method to validate the user inputs in the Event Add page while saving the entry */
function saveAddEvent()
{
	var oForm = $('frmAdd');
	
	var iDtCompare = compareEventDate('frmAdd');
	
	if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else if(iDtCompare == 1)
    {
	  alert('The event end date cannot be less than the event start date');
	  oForm.dmEndDay.focus();
	  return false; 
    } 
    else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=events&EventParam=add&Action=save";
		oForm.submit();
	}
	
}

/* Method to validate the user inputs in the Event Add page while submitting the entry */
function submitAddEvent()
{
	var oForm = $('frmAdd');
	var iTotal = $('hidAreasValue').value;
	chkStatus = checkAreaInterest(iTotal);
	var iDtCompare = compareEventDate('frmAdd');
  	if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('dmCategory').value == '')
	{
		alert ('Please select the Category field.');
		oForm.dmCategory.focus();
		return false;
	}
	else if($('frmAdd').dmStartDay.value == "")
	{
		alert ('Please select the Day field.');
		oForm.dmStartDay.focus();
		return false; 
	}
	else if($('frmAdd').dmStartMonth.value == "")
	{
		alert ('Please select the Month field.');
		oForm.dmStartMonth.focus();
		return false; 
	}
	else if($('frmAdd').dmStartYear.value == "")
	{
		alert ('Please select the Year field.');
		oForm.dmStartYear.focus();
		return false; 
	}
	else if(iDtCompare == 1)
    {
	    alert('The event end date cannot be less than the event start date');
	    oForm.dmEndDay.focus();
		return false; 
    } 
	else if($('dmCity').value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
	else if($('txtLocation').value == '')
	{
		alert ('Please fill up Location field.');
		oForm.txtLocation.focus();
		return false;
	}
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Description  field.');
		oForm.taDescription.Focus();
		return false;
	}
	else if(chkStatus== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value != '' && $('filePhoto').value == '')
	{
		alert ('Please upload the photo for your caption.');
		oForm.filePhoto.focus();
		return false;
	}
	else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=events&EventParam=add&Action=submit";
		oForm.submit();
	}
	
}

/* Method to validate the user inputs in the Event edit page while saving the entry */
function  editSaveEvent(iEventId,iStatus)
{
	var oForm = $('frmEdit');
	var iDtCompare = compareEventDate('frmEdit');
  if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else if(iDtCompare == 1)
  {
	  alert('The event end date cannot be less than the event start date');
	  oForm.dmEndDay.focus();
		return false; 
  } 
	else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value != '' && $('filePhoto').value == '')
	{
		alert ('Please upload a photo for your caption.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
   		oForm.action = "my360.php?ModuleParam=events&EventParam=edit&Action=save&EventId="+iEventId;
   		oForm.submit();
	}
}

/* Method to validate the user inputs in the Event edit page while submitting the entry */
function  editSubmitEvent(iEventId,iStatus)
{
	var oForm = $('frmEdit');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
	var iDtCompare = compareEventDate('frmEdit');
    if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('dmCategory').value == '')
	{
		alert ('Please select the Category field.');
		oForm.dmCategory.focus();
		return false;
	}
	else if($('frmEdit').dmStartDay.value == "")
	{
		alert ('Please select the Day field.');
		oForm.dmStartDay.focus();
		return false; 
	}
	else if($('frmEdit').dmStartMonth.value == "")
	{
		alert ('Please select the Month field.');
		oForm.dmStartMonth.focus();
		return false; 
	}
	else if($('frmEdit').dmStartYear.value == "")
	{
		alert ('Please select the Year field.');
		oForm.dmStartYear.focus();
		return false; 
	}
	else if(iDtCompare == 1)
    {
	    alert('The event end date cannot be less than the event start date');
	    oForm.dmEndDay.focus();
		return false; 
    }
	else if($('dmCity').value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
	else if($('txtLocation').value == '')
	{
		alert ('Please fill up Location field.');
		oForm.txtLocation.focus();
		return false;
	}
	else if($('frmEdit').taDescription.value == '')
	{
		alert ('Please fill up the Description  field.');
		oForm.taDescription.Focus();
		return false;
	}
	else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value != '' && $('filePhoto').value == '')
	{
		alert ('Please browse a photo for your caption.');
		oForm.filePhoto.focus();
		return false;
	}
	else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
   		oForm.action = "my360.php?ModuleParam=events&EventParam=edit&Action=submit&EventId="+iEventId;
   		oForm.submit();
	}
		
}

function editPublishOrWithdrawnEvent(iEventId,iEventStatus)
{
	var oForm = $('frmEventEdit');
    if(iEventStatus == 3)
    {
	    var sAction = 'published';
    }
    else
    {
	    var sAction = 'withdrawn';
    }
   
    if($('frmEventEdit').taUpdates.value == '')
	{
		alert ('Please fill up the Description  field.');
		oForm.taUpdates.focus();
		return false;
	}
	else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value != '' && $('filePhoto').value == '')
	{
		alert ('Please upload a photo for your caption.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
		oForm.action = "my360.php?ModuleParam=events&EventParam=edit&Action="+sAction+"&EventId="+iEventId;
   		oForm.submit();
	}
}

/* Method to validate the user inputs in the Photos add page while submitting the entry */
function submitAddPhoto()
{
	var oForm = $('frmAddPhoto');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
    if($('frmAddPhoto').txtCaption.value == '')
	{
		alert ('Please fillup the Caption field.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('frmAddPhoto').filePhoto.value == '')
	{
		alert ('Please Browse a Photo.');
		oForm.filePhoto.focus();
		return false;
	}
	else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }	
	else
	{
	   	oForm.action = "my360.php?ModuleParam=photos&EventParam=add&Action=submit";
		oForm.submit();
	}
	
}

/* Method to validate the user inputs in the Photos add page while saving the entry */
function saveAddPhoto()
{
	var oForm = $('frmAddPhoto');
	
    if($('frmAddPhoto').txtCaption.value == '')
	{
		alert ('Please fillup the Title field.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
	   	oForm.action = "my360.php?ModuleParam=photos&EventParam=add&Action=save";
		oForm.submit();
	}
	
}

/* Method to validate the user inputs in the Photos edit page while saving the entry */
function  saveEditPhoto(iPhotoId)
{
	var oForm = $('frmEditPhoto');
	
    if($('frmEditPhoto').txtCaption.value == '')
	{
		alert ('Please fillup the Title field.');
		oForm.txtCaption.focus();
		return false;
	}
	else
	{
	   	oForm.action = "my360.php?ModuleParam=photos&EventParam=edit&Action=save&PhotoId="+iPhotoId;
		oForm.submit();
	}
}

/* Method to validate the user inputs in the Photos edit page while submitting the entry */
function  submitEditPhoto(iPhotoId)
{
	var oForm = $('frmEditPhoto');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
    if($('frmEditPhoto').txtCaption.value == '')
	{
		alert ('Please fillup the Caption field.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('hidPhotoName').value == ''&& $('filePhoto').value == '')
	{
		alert ('Please upload a photo.');
		oForm.filePhoto.focus();
		return false;
	}
    else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
	else
	{
	   	oForm.action = "my360.php?ModuleParam=photos&EventParam=edit&Action=submit&PhotoId="+iPhotoId;
		oForm.submit();
	}
}
/* Method to delete individual photos */
function deleteIndividualPhoto(PhotoId)
{
	var oForm = $('frmEditPhoto');
	oAnswer = confirm("Do you want to delete the photo?");
	if(oAnswer)
	 {
		oForm.action = "my360.php?ModuleParam=photos&EventParam=delete-individual-photo&PhotoId="+PhotoId;
		oForm.submit(); 
	 }
}

/* Method to open and close the overlay of the my360 revision needed section */
function openRevision(iIndex)
{
	sName = 'logText'+ iIndex;
	$(sName).style.display = "block";
}

function closeRevision(iIndex)
{
	sName = 'logText'+ iIndex;
	$(sName).style.display = "none";
}

/* Method to validate the user inputs in the Classifieds add page while submitting the entry */
function  submitAddClassified()
{
	var oForm = $('frmAdd');
	var iTotal = $('hidAreasValue').value;
    chkStatus = checkAreaInterest(iTotal);
	
    if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Description  field.');
		oForm.taDescription.focus();
		return false;
	}
	else if($('frmAdd').dmCategory.value == '')
	{
		alert ('Please select the Category field.');
		oForm.dmCategory.focus();
		return false;
	}
	else if(chkStatus== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value != '' && $('filePhoto').value == '')
	{
		alert ('Please upload the photo for your caption.');
		oForm.filePhoto.focus();
		return false;
	}
	else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('frmAdd').dmCity.value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=classifieds&EventParam=add&Action=submit";
		oForm.submit();
	}
}

/* Method to validate the user inputs in the Classifieds add page while saving the entry */
function  saveAddClassified()
{
	var oForm = $('frmAdd');
	
    if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=classifieds&EventParam=add&Action=save";
		oForm.submit();
	}
}

/* Method to validate the user inputs in the Classifieds edit page while saving the entry */
function  saveEditClassified(iClassifiedId)
{
	var oForm = $('frmEdit');
	
    if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	else
	{
	   	document.frmEdit.action = "my360.php?ModuleParam=classifieds&EventParam=edit&Action=save&ClassifiedId="+iClassifiedId;
		oForm.submit();
	}
}

/* Method to validate the user inputs in the Classifieds edit page while submitting the entry */
function  submitEditClassified(iClassifiedId)
{
	var oForm = $('frmEdit');
	var iTotal = $('hidAreasValue').value;
    chkStatus = checkAreaInterest(iTotal);
	
    if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 200)
	{
		alert ('Title field should be 200 character of length.');
		oForm.txtTitle.focus();
		return false;
	}
	
	else if($('frmEdit').taDescription.value == '')
	{
		alert ('Please fill up the Description  field.');
		oForm.taDescription.focus();
		return false;
	}
	else if($('frmEdit').dmCategory.value == '')
	{
		alert ('Please select the Category field.');
		oForm.dmCategory.focus();
		return false;
	}
	else if(chkStatus== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else if($('filePhoto').value != '' && $('txtCaption').value == '')
	{
		alert ('Please fill up caption for your photo.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('txtCaption').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		oForm.txtCaption.focus();
		return false;
	}
	else if($('frmEdit').dmCity.value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
	else
	{
	   	document.frmEdit.action = "my360.php?ModuleParam=classifieds&EventParam=edit&Action=submit&ClassifiedId="+iClassifiedId;
		oForm.submit();
	}
}
function showTab1()
{
	$('tab1').style.backgroundColor = '#FFFFFF';
	$('tab1').style.borderTop = '#C2DCEF 1px solid';
	$('tab1').style.borderBottom = '#C2DCEF 0px solid';
	$('tab1').style.borderLeft = '#C2DCEF 1px solid';
	
	$('tab2').style.backgroundColor = '#E7F1F8';
	$('tab2').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab3').style.backgroundColor = '#E7F1F8';
	$('tab3').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab4').style.backgroundColor = '#E7F1F8';
	$('tab4').style.borderBottom = '#C2DCEF 1px solid';
	
	$('basicProfile').style.display='block';
	$('professionalInformation').style.display='none';
	$('socialInterests').style.display='none';
	$('changePwd').style.display='none';
}
function showTab2()
{
	$('tab2').style.backgroundColor = '#FFFFFF';
	$('tab2').style.borderTop = '#C2DCEF 1px solid';
	$('tab2').style.borderBottom = '#C2DCEF 0px solid';
	$('tab2').style.borderLeft = '#C2DCEF 1px solid';
	
	$('tab1').style.backgroundColor = '#E7F1F8';
	$('tab1').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab3').style.backgroundColor = '#E7F1F8';
	$('tab3').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab4').style.backgroundColor = '#E7F1F8';
	$('tab4').style.borderBottom = '#C2DCEF 1px solid';
	
	$('basicProfile').style.display='none';
	$('professionalInformation').style.display='block';
	$('socialInterests').style.display='none';
	$('changePwd').style.display='none';
}
function showTab3()
{
	$('tab3').style.backgroundColor = '#FFFFFF';
	$('tab3').style.borderTop = '#C2DCEF 1px solid';
	$('tab3').style.borderBottom = '#C2DCEF 0px solid';
	$('tab3').style.borderLeft = '#C2DCEF 1px solid';
	
	$('tab1').style.backgroundColor = '#E7F1F8';
	$('tab1').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab2').style.backgroundColor = '#E7F1F8';
	$('tab2').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab4').style.backgroundColor = '#E7F1F8';
	$('tab4').style.borderBottom = '#C2DCEF 1px solid';
	
	$('basicProfile').style.display='none';
	$('professionalInformation').style.display='none';
	$('socialInterests').style.display='block';
	$('changePwd').style.display='none';
}
function showTab4()
{
	$('tab4').style.backgroundColor = '#FFFFFF';
	$('tab4').style.borderTop = '#C2DCEF 1px solid';
	$('tab4').style.borderBottom = '#C2DCEF 0px solid';
	
	$('tab1').style.backgroundColor = '#E7F1F8';
	$('tab1').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab2').style.backgroundColor = '#E7F1F8';
	$('tab2').style.borderBottom = '#C2DCEF 1px solid';
	
	$('tab3').style.backgroundColor = '#E7F1F8';
	$('tab3').style.borderBottom = '#C2DCEF 1px solid';
	
	$('basicProfile').style.display='none';
	$('professionalInformation').style.display='none';
	$('socialInterests').style.display='none';
	$('changePwd').style.display='block';
}
function showInboxTab1()
{
	$('inboxTab1').style.backgroundColor = '#FFFFFF';
	$('inboxTab1').style.borderTop = '#C2DCEF 1px solid';
	$('inboxTab1').style.borderBottom = '#C2DCEF 0px solid';
	$('inboxTab1').style.borderLeft = '#C2DCEF 1px solid';
	
	$('inboxTab2').style.backgroundColor = '#E7F1F8';
	$('inboxTab2').style.borderBottom = '#C2DCEF 1px solid';
	
	$('inboxDiv').style.display='block';
	$('sentMessagesDiv').style.display='none';
}
function showInboxTab2()
{
	$('inboxTab2').style.backgroundColor = '#FFFFFF';
	$('inboxTab2').style.borderTop = '#C2DCEF 1px solid';
	$('inboxTab2').style.borderBottom = '#C2DCEF 0px solid';
	$('inboxTab2').style.borderLeft = '#C2DCEF 1px solid';
	
	$('inboxTab1').style.backgroundColor = '#E7F1F8';
	$('inboxTab1').style.borderBottom = '#C2DCEF 1px solid';
	
	$('inboxDiv').style.display='none';
	$('sentMessagesDiv').style.display='block';
}

/* Method to delete individual photos */
function deleteIndividualPht(iItemId,iPhotoId,iPhotoStatus, sTableSuffix)
{	
	oAnswer = confirm("Do you want to delete the photo?");
	if(oAnswer)
	 {	
		 if(sTableSuffix == 'articles')
		 {
			 var oForm = $('frmEdit');
			 $('txtCaption').value == ''; 
			 oForm.action = "my360.php?ModuleParam=news-and-blog&EventParam=delete-individual-photo&ArticleId="+iItemId+"&PhotoId="+iPhotoId+"&PhotoStatus="+iPhotoStatus;
		 }
		 else if(sTableSuffix == 'classifieds')
		 {
			 var oForm = $('frmEdit');
			 $('txtCaption').value == ''; 
			 oForm.action = "my360.php?ModuleParam=classifieds&EventParam=delete-individual-photo&ClassifiedId="+iItemId+"&PhotoId="+iPhotoId+"&PhotoStatus="+iPhotoStatus;
		 }
		 else if(sTableSuffix == 'events')
		 {
			 var oForm = $('frmEdit');
			 $('txtCaption').value == ''; 
			 oForm.action = "my360.php?ModuleParam=events&EventParam=delete-individual-photo&EventId="+iItemId+"&PhotoId="+iPhotoId+"&PhotoStatus="+iPhotoStatus;
		 }
		 else if(sTableSuffix == 'websitesettings')
		 {
			 var oForm = $('frmSettings');
			 oForm.action = "my360.php?ModuleParam=website-setting&PhotoId="+iPhotoId+"&PhotoStatus="+iPhotoStatus;
		 }
		 oForm.submit(); 
	 }
}

/************************Date comparison functions********************************/
function mkEventDay(sDay, sMonth, sYear, sHour, sMinute, sHourType)
{
	 sMkEventDay = Date.parse(sDay+'-'+sMonth+'-'+sYear+' '+sHour+':'+sMinute+' '+sHourType);
	  return sMkEventDay;
}

function compareEventDate(iFormId)
{
		var sMakeStartEventDay = '';
	  var sMakeEndEventDay = '';
	  if($(iFormId).dmStartDay.value != '') 			var sStartDay 			= $(iFormId).dmStartDay.value;
	  if($(iFormId).dmStartMonth.value != '') 		var sStartMonth 		= $(iFormId).dmStartMonth.value;
	  if($(iFormId).dmStartYear.value != '') 		var sStartYear 			= $(iFormId).dmStartYear.value; 
	  if($(iFormId).dmStartHour.value != '') 	  var sStartHour 			= $(iFormId).dmStartHour.value; 
	  else var sStartHour  = '06';
		if($(iFormId).dmStartMinute.value != '') 	var sStartMinute 		= $(iFormId).dmStartMinute.value; 
		else var sStartMinute  = '00';
		if($(iFormId).dmStartHourType.value != '') var sStartHourType 	= $(iFormId).dmStartHourType.value; 
		else var dmStartHourType  = 'AM';
		if( sStartDay != '' && sStartMonth != '' && sStartYear != '' && sStartHour != '' && sStartMinute != '' && sStartHourType != '')
		{
		 	sMakeStartEventDay = mkEventDay(sStartDay, sStartMonth, sStartYear, sStartHour, sStartMinute, sStartHourType);
	  }
	  if($(iFormId).dmEndDay.value != '')        var sEndDay 			  = $(iFormId).dmEndDay.value;
	  else var sEndDay 			  = sStartDay;
	  if($(iFormId).dmEndMonth.value != '') 		  var sEndMonth 		  = $(iFormId).dmEndMonth.value;
	  else var sEndMonth 			= sStartMonth;
		if($(iFormId).dmEndYear.value != '') 			var sEndYear 			  = $(iFormId).dmEndYear.value; 
		else var sEndYear 			= sStartYear;
		if($(iFormId).dmEndHour.value != '') 	  	var sEndHour 				= $(iFormId).dmEndHour.value; 
		else var sEndHour  = '11';
		if($(iFormId).dmEndMinute.value != '') 		var sEndMinute 			= $(iFormId).dmEndMinute.value; 
		var sEndMinute = '55';
		if($(iFormId).dmEndHourType.value != '') 	var sEndHourType 		= $(iFormId).dmEndHourType.value; 
		var sEndHourType = 'PM';
		if( sEndDay != 'Day' && sEndMonth != 'Month' && sEndYear != 'Year' && sEndHour != 'Hour' && sEndMinute != 'Minute' && sEndHourType != '')
		{
			
		 	sMakeEndEventDay = mkEventDay(sEndDay, sEndMonth, sEndYear, sEndHour, sEndMinute, sEndHourType);
	  }  
	  if(sMakeStartEventDay != '' && sMakeEndEventDay != '')
	  {
		  var oMakeStartEventDay = new Date(sMakeStartEventDay);
		  var oMakeEndEventDay   = new Date(sMakeEndEventDay);
		  var iDtCompare 		 = oMakeStartEventDay.compareTo(oMakeEndEventDay); 
	  }
	  return iDtCompare;
}

/* FORM VALIDATION FOR MY ACCOUNT SECTION */
function saveBasicProfile(sRedirectInbox,isIndividual)
{
	var objform = $('formBasicProfile');
	var iMobNo  = $('txtMobile').value;
	if($('txtFirstname').value == '')
	{
		alert ('Please provide your Firstname.');
		objform.txtFirstname.focus();
		return false;
	}
	else if($('txtLastname').value == '')
	{
		alert ('Please provide your Lastname.');
		objform.txtLastname.focus();
		return false;
	}
	else if($('dmCity').value == '')
	{
		alert ('Please select City field.');
		objform.dmCity.focus();
		return false;
	}
	else if($('txtMobile').value == '')
	{
		alert ('Please fill up Mobile field.');
		objform.txtMobile.focus();
		return false;
	}
	else if(isNaN(iMobNo) || iMobNo.indexOf(" ")!=-1)
	{
		alert ('Please enter numeric values to Mobile field.');
	}
	else if($('taAddress').value == '')
	{
		alert ('Please fill up Postal Address field.');
		objform.taAddress.focus();
		return false;
	}
	 else if($('dmDay').value == "")
	 {	 
		  alert ('Please provide the day of your birth.');
		  objform.dmDay.focus();
		  return false;
	 }
	  else if($('dmMonth').value == "")
	  {
		    alert ('Please provide the month of your birth.');
		  	objform.dmMonth.focus();
		  	return false;
	  } 
	  else if($('dmYear').value == "")
	  {
		  alert ('Please provide the year of your birth.');
		  objform.dmYear.focus();
		  return false;
	  }
	  else if(isIndividual == '2' && (!($('rbMale').checked) && !($('rbFemale').checked)))
	  {
		 alert ('Please specify your Gender.');
		 objform.rbMale.focus();
		 return false;		 
	  }
	  else
	  {
			objform.action = "my360.php?ModuleParam=account&EventParam=add&Action=basicprofile&RedirectInbox="+sRedirectInbox;
			objform.submit();
	  }
}
/* FUNCTION USED FOR RESET PASSWORD FOR MY ACCOUNT SECTION */
function resetPassword()
{
	var objform = $('formResetPwd');
	iPwd = $('hidPwd').value;
	if($('txtCurrentPassword').value == '')
	{
		alert ('Please fill up the current password field.');
		objform.txtCurrentPassword.focus();
		return false;
	}
	else if($('txtCurrentPassword').value != iPwd)
	{
		alert("Please fill up the current password field correctly.");
		objform.txtCurrentPassword.focus();
		return false;
	}
	else if($('txtNewPassword').value == '')
	{
		alert ('Please fill up the new password field.');
		objform.txtNewPassword.focus();
		return false;
	}
	else if($('txtNewPassword').value.length < 6)
	{
		alert ('New password field should be minimum of 6 character of length.');
		objform.txtNewPassword.focus();
		return false;
	}
	else if($('txtRetypePassword').value == '')
	{
		alert ('Please fill up the retype password field.');
		objform.txtRetypePassword.focus();
		return false;
	}
	else if($('txtRetypePassword').value.length < 6)
	{
		alert ('Retype password field should be minimum of 6 character of length.');
		objform.txtRetypePassword.focus();
		return false;
	}
	else if($('txtNewPassword').value != $('txtRetypePassword').value)
	{
		alert("New Password and Confirm New Password do not match!");
		objform.txtNewPassword.focus();
		return false;
	}
	else
	{
		objform.action = "my360.php?ModuleParam=change-password";
		objform.submit();
	}
}
/* FUNCTION USED FOR PROFESSIONAL INFORMATION */
function professionalInformation(sRedirectInbox)
{
	var objform = $('formProfessionalObj');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
	if($('txtObjective').value == '')
	{
		alert ('Please outline your objective.');
		objform.txtObjective.focus();
		return false;
	}
	else if($('txtOrganization').value == '')
	{
		alert ('Please specify your Current Organization.');
		objform.txtOrganization.focus();
		return false;
	}
	else if($('txtPosition').value == '')
	{
		alert ('Please specify your Current Designation.');
		objform.txtPosition.focus();
		return false;
	}
	else if($('txtQualification').value == '')
	{
		alert ('Please provide your Highest Qualification.');
		objform.txtQualification.focus();
		return false;
	}
	else if($('txtPassedFrom').value == '')
	{
		alert ('Please provide your university/ college/ institute/ school passed from.');
		objform.txtPassedFrom.focus();
		return false;
	}
	else if($('txtSkills').value == '')
	{
		alert ('Please provide your Professional Skills.');
		objform.txtSkills.focus();
		return false;
	}
	else if($('taCv').value == '')
	{
		alert ('Please describe your Profile.');
		objform.taCv.focus();
		return false;
	}
	else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
	else
	{
		objform.action = "my360.php?ModuleParam=profile&RedirectInbox="+sRedirectInbox;
		objform.submit();
	}
}
/* FUNCTIO USED FOR SOCIAL PROFILE */
function socialProfile()
{
	var objform = $('formSocialInterest');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
	if($('txtSObjective').value == '')
	{
		alert ('Please fill up the social objective field.');
		objform.txtSObjective.focus();
		return false;
	}
	else if($('taInterests').value == '')
	{
		alert ('Please fill up the describe your social interests field.');
		objform.taInterests.focus();
		return false;
	}
	else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
    else
    {
	    objform.action = "my360.php?ModuleParam=account&EventParam=add&Action=socialprofile";
		objform.submit();
    }
}

/* MY ACCOUNT TAB SYSTEM */
function showMyAccountTab1()
{
	$('tabcontent1').style.display = 'block';
	$('tabcontent2').style.display = 'none';
	$('tabcontent3').style.display = 'none';
	$('tabcontent4').style.display = 'none';
	
	$('myAccountTab1').style.backgroundColor = '#E7F1F8';
	$('link1').style.color = '#ff6633';
	
	$('myAccountTab3').style.backgroundColor = '#4479AF';
	$('link2').style.color = '#ffffff';
	
	$('myAccountTab2').style.backgroundColor = '#4479AF';
	$('link4').style.color = '#ffffff';
	
	$('myAccountTab4').style.backgroundColor = '#4479AF';
	$('link3').style.color = '#ffffff';
	
}
function showMyAccountTab2()
{
	$('tabcontent1').style.display = 'none';
	$('tabcontent2').style.display = 'block';
	$('tabcontent3').style.display = 'none';
	$('tabcontent4').style.display = 'none';
		
	$('myAccountTab1').style.backgroundColor = '#4479AF';
	$('link1').style.color = '#ffffff';
	
	$('myAccountTab3').style.backgroundColor = '#E7F1F8';
	$('link2').style.color = '#ff6633';
	
	$('myAccountTab2').style.backgroundColor = '#4479AF';
	$('link4').style.color = '#ffffff';
	
	$('myAccountTab4').style.backgroundColor = '#4479AF';
	$('link3').style.color = '#ffffff';
	
	$('myAccountTab1').style.borderWidth = '1px';
	$('myAccountTab1').style.borderStyle = 'solid';
	$('myAccountTab1').style.borderColor = '#C2DCEF';
	$('myAccountTab1').style.borderBottomWidth = '0px';
}
function showMyAccountTab3()
{
	$('tabcontent1').style.display = 'none';
	$('tabcontent2').style.display = 'none';
	$('tabcontent3').style.display = 'block';
	$('tabcontent4').style.display = 'none';
		
	$('myAccountTab1').style.backgroundColor = '#4479AF';
	$('link1').style.color = '#ffffff';
	
	$('myAccountTab3').style.backgroundColor = '#4479AF';
	$('link2').style.color = '#ffffff';
	
	$('myAccountTab4').style.backgroundColor = '#E7F1F8';
	$('link3').style.color = '#ff6633';
	
	$('myAccountTab2').style.backgroundColor = '#4479AF';
	$('link4').style.color = '#ffffff';
	
	$('myAccountTab1').style.borderWidth = '1px';
	$('myAccountTab1').style.borderStyle = 'solid';
	$('myAccountTab1').style.borderColor = '#C2DCEF';
	$('myAccountTab1').style.borderBottomWidth = '0px';
}
function showMyAccountTab4()
{
	$('tabcontent2').style.display = 'none';
	$('tabcontent1').style.display = 'none';
	$('tabcontent3').style.display = 'none';
	$('tabcontent4').style.display = 'block';
		
	$('myAccountTab1').style.backgroundColor = '#4479AF';
	$('link1').style.color = '#ffffff';
	
	$('myAccountTab3').style.backgroundColor = '#4479AF';
	$('link2').style.color = '#ffffff';
	
	$('myAccountTab4').style.backgroundColor = '#4479AF';
	$('link3').style.color = '#ffffff';
	
	$('myAccountTab2').style.backgroundColor = '#E7F1F8';
	$('link4').style.color = '#ff6633';
	
	$('myAccountTab1').style.borderWidth = '1px';
	$('myAccountTab1').style.borderStyle = 'solid';
	$('myAccountTab1').style.borderColor = '#C2DCEF';
	$('myAccountTab1').style.borderBottomWidth = '0px';
}

/* validation function for YP */
function  saveAddYP()
{   
	var objform = $('frmAdd');
	
    if($('frmAdd').txtBusinessName.value == '')
	{
		alert ('Please fill up the Business Name field.');
		objform.txtBusinessName.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=profile&EventParam=add&Action=save";
		objform.submit();
	}
}
function  submitAddYP(sRedirectInbox)
{   
	var objform = $('frmAdd');
    var sEmail = $('frmAdd').txtEmail.value;
    var iPinCode = $('frmAdd').txtPinCode.value;
    var iPin = isInteger(iPinCode);
	sCorrEmailVal = validateEmail(sEmail);
	
    if($('frmAdd').txtBusinessName.value == '')
	{
		alert ('Please fill up the Business Name field.');
		objform.txtBusinessName.focus();
		return false;
	}
	else if($('frmAdd').txtServices.value == '')
	{
		alert ('Please fill up the Services/ Products field.');
		objform.txtServices.focus();
		return false;
	}
	else if($('frmAdd').dmCategory.value == '')
	{
		alert ('Please select the Areas of Interest field.');
		objform.dmCategory.focus();
		return false;
	}
	else if($('frmAdd').txtContactName.value == '')
	{
		alert ('Please fill up the Contact Name field.');
		objform.txtContactName.focus();
		return false;
	}
	else if($('frmAdd').txtDesignation.value == '')
	{
		alert ('Please fill up the Designation field.');
		objform.txtDesignation.focus();
		return false;
	}
	else if(($('frmAdd').txtEmail.value != "") && (sCorrEmailVal == '0'))
	{	   
	   alert('The Email field should have the correct format.');
       var sCorrEmailVal = '0';
       objform.txtEmail.value='';
	   objform.txtEmail.focus();
	}
	else if($('frmAdd').txtTelephone.value == "")
	{
		alert('Please fill up the Telephone field.');
		objform.txtTelephone.focus();
		return false;
	}
	else if($('frmAdd').txtStreet.value == "")
	{
		alert('Please fill up the Street Address field.');
		objform.txtStreet.focus();
		return false;
	}
	else if($('frmAdd').txtVillage.value == "")
	{
		alert('Please fill up the AreaName/ Village field.');
		objform.txtVillage.focus();
		return false;
	}
	else if($('frmAdd').txtPostOffice.value == "")
	{
		alert('Please fill up the Post Office field.');
		objform.txtPostOffice.focus();
		return false;
	}
	else if($('frmAdd').txtPinCode.value == "")
	{
		alert('Please fill up the Pin Code field.');
		objform.txtPinCode.focus();
		return false;
	}
	else if(!iPin)
	{
		alert('Please fill up Pin Code field with numeric values only.');
		objform.txtPinCode.focus();
		return false;
	}
	else if($('frmAdd').dmCity.value == '')
	{
		alert ('Please select the City field.');
		objform.dmCity.focus();
		return false;
	}
	else if($('frmAdd').dmDistrict.value == '')
	{
		alert ('Please select the District field.');
		objform.dmDistrict.focus();
		return false;
	}
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Description  field.');
		objform.taDescription.focus();
		return false;
	}
	/*else if($('filePhoto1').value != '' && $('txtCaption1').value == '')
	{
		alert ('Please fill up caption for your photo.');
		objform.txtCaption1.focus();
		return false;
	}
	else if($('txtCaption1').value != '' && $('filePhoto1').value == '')
	{
		alert ('Please upload the photo for your caption.');
		objform.filePhoto1.focus();
		return false;
	}
	else if($('txtCaption1').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		objform.txtCaption1.focus();
		return false;
	}
	else if($('filePhoto2').value != '' && $('txtCaption2').value == '')
	{
		alert ('Please fill up caption for your photo.');
		objform.txtCaption2.focus();
		return false;
	}
	else if($('txtCaption2').value != '' && $('filePhoto2').value == '')
	{
		alert ('Please upload the photo for your caption.');
		objform.filePhoto2.focus();
		return false;
	}
	else if($('txtCaption2').value.length > 200)
	{
		alert ('Caption field should be 200 character of length.');
		objform.txtCaption2.focus();
		return false;
	}*/
	else
	{
	   	objform.action = "my360.php?ModuleParam=profile&EventParam=add&Action=submit&RedirectInbox="+sRedirectInbox;
		objform.submit();
	}
}
function  saveEditYP(iYPId)
{   
	var objform = $('frmEdit');
	
    if($('frmEdit').txtBusinessName.value == '')
	{
		alert ('Please fill up the Business Name field.');
		objform.txtBusinessName.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=profile&EventParam=edit&Action=save&YellowpageId="+iYPId;
		objform.submit();
	}
}
function  submitEditYP(iYPId)
{   
	var objform = $('frmEdit');
    var sEmail = $('frmEdit').txtEmail.value;
    var iPinCode = $('frmEdit').txtPinCode.value;
    var iPin = isInteger(iPinCode);
	sCorrEmailVal = validateEmail(sEmail);
	
    if($('frmEdit').txtBusinessName.value == '')
	{
		alert ('Please fill up the Business Name field.');
		objform.txtBusinessName.focus();
		return false;
	}
	else if($('frmEdit').txtServices.value == '')
	{
		alert ('Please fill up the Services/ Products field.');
		objform.txtServices.focus();
		return false;
	}
	else if($('frmEdit').dmCategory.value == '')
	{
		alert ('Please select the Areas of Interest field.');
		objform.dmCategory.focus();
		return false;
	}
	else if($('frmEdit').txtContactName.value == '')
	{
		alert ('Please fill up the Contact Name field.');
		objform.txtContactName.focus();
		return false;
	}
	else if($('frmEdit').txtDesignation.value == '')
	{
		alert ('Please fill up the Designation field.');
		objform.txtDesignation.focus();
		return false;
	}
	else if(($('frmEdit').txtEmail.value != "") && (sCorrEmailVal == '0'))
	{	   
	   alert('The Email field should have the correct format.');
       var sCorrEmailVal = '0';
       objform.txtEmail.value='';
	   objform.txtEmail.focus();
	}
	else if($('frmEdit').txtTelephone.value == "")
	{
		alert('Please fill up the Telephone field.');
		objform.txtTelephone.focus();
		return false;
	}
	else if($('frmEdit').txtStreet.value == "")
	{
		alert('Please fill up the Street Address field.');
		objform.txtStreet.focus();
		return false;
	}
	else if($('frmEdit').txtVillage.value == "")
	{
		alert('Please fill up the AreaName/ Village field.');
		objform.txtVillage.focus();
		return false;
	}
	else if($('frmEdit').txtPostOffice.value == "")
	{
		alert('Please fill up the Post Office field.');
		objform.txtPostOffice.focus();
		return false;
	}
	else if($('frmEdit').txtPinCode.value == "")
	{
		alert('Please fill up the Pin Code field.');
		objform.txtPinCode.focus();
		return false;
	}
	else if(!iPin)
	{
		alert('Please fill up Pin Code field with numeric values only.');
		objform.txtPinCode.focus();
		return false;
	}
	else if($('frmEdit').dmCity.value == '')
	{
		alert ('Please select the City field.');
		objform.dmCity.focus();
		return false;
	}
	else if($('frmEdit').dmDistrict.value == '')
	{
		alert ('Please select the District field.');
		objform.dmDistrict.focus();
		return false;
	}
	else if($('frmEdit').taDescription.value == '')
	{
		alert ('Please fill up the Description  field.');
		objform.taDescription.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=profile&EventParam=edit&Action=submit&YellowpageId="+iYPId;
		objform.submit();
	}
}

/* FUNCTION USED FOR ADVERTISEMENTS */
function saveAddBanner(iEventParam)
{
	var objform        = $('frmAddAdvertisements');
	if(iEventParam == 'add')iAdBannerType           = $('dmAdBannerType').value;
	else if(iEventParam == 'edit')iAdBannerType     = $('hidBannerType').value;
	if(iAdBannerType == 0) sLinkURL           = $('txtLinkUrl').value;
	else if(iAdBannerType == 1) sLinkURL           = $('txtLinkUrl1').value;
	if(iAdBannerType == 0 || iAdBannerType == 1)
    iValidURL          = validateLinkURL(sLinkURL);

	if((iAdBannerType == 0) && $('txtLinkText').value == '')
	{
		alert("Please fill up Link Text field.");
	    objform.txtLinkText.focus();
	    return false;
	}
	else if((iAdBannerType == 0) && ($('txtLinkUrl').value != '') &&  (iValidURL == -1))
	{
		alert ('The Link URL should start with http://');
		objform.txtLinkUrl.focus();
		return false;
	}
	else if((iAdBannerType == 1) && ($('txtLinkUrl1').value != '') &&  (iValidURL == -1))
	{
		alert ('The Link URL should start with http://');
		objform.txtLinkUrl1.focus();
		return false;
	}
	else if((iEventParam == 'add') && (iAdBannerType == 0) && $('filePhoto').value == '')
	{
	    alert("Please Upload Image file.");
	    objform.filePhoto.focus();
		return false;
    }
    else if((iEventParam == 'add') && (iAdBannerType == 1) && $('filePhoto1').value == '')
    {
	    alert("Please Upload Flash file.");  
        objform.filePhoto1.focus();
		return false;
	}	
	else if($('dmAdBannerSize').value == '')
	{
		alert ('Please select Size of Advertisement.');
		objform.dmAdBannerSize.focus();
		return false;
	}
	else
    {
		objform.submit();
    }  
}

function selectType()
{
	var iAdBannerType = $("dmAdBannerType").selectedIndex;
	if(iAdBannerType == 1)
	{
		$('adTextDiv').style.display="block";
		$('imageDiv').style.display="none";
	}
	else if(iAdBannerType == 0 || iAdBannerType == 2)
	{
		$('adTextDiv').style.display="none";
		$('imageDiv').style.display="block";
	}
}
function selectAdType(iAdType)
{
	var iAdBannerType = $("dmAdBannerType").selectedIndex;
	if(iAdBannerType == 1)
	{
		$('adTextDiv').style.display="block";
		$('imageDiv').style.display="none";
	}
	else if(iAdBannerType == 0 || iAdBannerType == 2)
	{
		$('adTextDiv').style.display="none";
		$('imageDiv').style.display="block";
	}
	$("hidAdType").value=iAdBannerType;
}
function loadSelectAdType()
{
	
	var iAdBannerType = $('hidAdTypeId').value;
	if(iAdBannerType == 2)
	{
		$('adTextDiv').style.display="block";
		$('imageDiv').style.display="none";
	}
	else if(iAdBannerType == 1 || iAdBannerType == 3)
	{
		$('adTextDiv').style.display="none";
		$('imageDiv').style.display="block";
	}
}

/* END OF FUNCTION USED FOR ADVERTISEMENTS */
function saveMyProfile(iAdBanner)
{
	var objform = $('frmUpdateAdPurchase');
	var iMobNo  = $('txtMobile').value;
	if($('dmLocation').value == '')
	{
		alert ('Please select City/ town field.');
		objform.dmLocation.focus();
		return false;
	}
	else if($('txtMobile').value == '')
	{
		alert ('Please fill up the Mobile Number field.');
		objform.txtMobile.focus();
		return false;
	}
	else if(isNaN(iMobNo) || iMobNo.indexOf(" ")!=-1)
	{
		alert ('Please enter numeric values to Mobile field.');
	}
	else if($('taAddress').value == '')
	{
		alert ('Please fill up Postal Address field.');
		objform.taAddress.focus();
		return false;
	}
	else if($('hidPhoto').value == ''&& $('filePhoto').value == '')
	{
		alert ('Please upload a photograph.');
		objform.filePhoto.focus();
		return false;
	}
	else
	{
		objform.action = "my360.php?ModuleParam=advertisements&EventParam=purchase-points&AdBannerId="+iAdBanner;
		objform.submit();
	}
}
function checkForgotPwdEmail()
{
	var oForm = $('membershipActivate');
	var sEmail = $('membershipActivate').txtEmailId.value;
	sCorrEmailVal = validateEmail(sEmail);
	if($('membershipActivate').txtEmailId.value == "")
	{
		alert('Please fill up your Email Address.');
		$('txtEmailId').value='';
	   	$('txtEmailId').focus();
	}
	else if(($('membershipActivate').txtEmailId.value != "") && (sCorrEmailVal == '0'))
	{	   
	   alert('The Email field should have the correct format.');
       var sCorrEmailVal = '0';
       $('txtEmailId').value='';
	   $('txtEmailId').focus();
	}
	else
	{
		$('hidStatus').value=2;
		oForm.action = "mylogin.php?ModuleParam=forgot-your-password"
		oForm.submit();
	}
}
function validateActivation()
{
	var oForm = $('membershipActivate');
	if($('membershipActivate').txtActivationCode.value == "")
	{
		alert('Please fill up your Activation Code.');
		$('txtActivationCode').value='';
	   	$('txtActivationCode').focus();
	}
	else
	{
		oForm.action = "join.php?ModuleParam=activate"
		oForm.submit();
	}
}
/* Inbox tab */
function showMyInboxTab()
{
	$('tabcontent1').style.display = 'block';
	$('tabcontent2').style.display = 'none';
	
	$('myAccountTab1').style.backgroundColor = '#E7F1F8';
	$('myInbox').style.color = '#ff6633';
	
	$('myAccountTab3').style.backgroundColor = '#4479AF';
	$('myMsg').style.color = '#ffffff';
	
}
function showMyMsgTab()
{
	$('tabcontent1').style.display = 'none';
	$('tabcontent2').style.display = 'block';

	$('myAccountTab1').style.backgroundColor = '#4479AF';
	$('myInbox').style.color = '#ffffff';
	
	$('myAccountTab3').style.backgroundColor = '#E7F1F8';
	$('myMsg').style.color = '#ff6633';
}
function composeMessage()
{
	var oForm     = $('frmComposeMsg');
	var sMsgType  = $('frmComposeMsg').hidMsgType.value;
	var sEmail    = $('frmComposeMsg').txtMsgTo.value;
	var sUserName = $('frmComposeMsg').txtMsgTo.value;
	sCorrEmailVal = validateEmail(sEmail);
	if($('frmComposeMsg').txtMsgTo.value == "")
	{
		alert("Please fill up the receiver's email address.");
		oForm.txtMsgTo.value='';
	   	oForm.txtMsgTo.focus();
	   	return false;
	}
	else if($('frmComposeMsg').txtMsgTo.value != "")
	{
		 var postValues = encodeURIComponent(sUserName);
	     var url="./user360/app/check-username.rem.php";
         makeRequestUserName(url,postValues);
	}
}

function validateMyLogin()
{
	var oForm = $('frmMyLogin');
	var sEmail = $('frmMyLogin').txtLogin.value;
	//sCorrEmailVal = validateEmail(sEmail);
	if ($('frmMyLogin').txtLogin.value == '')
	{
    	alert("Username/ Email cannot be blank!");
    	$('frmMyLogin').txtLogin.focus();
    	return false;
	}	
	else if ($('frmMyLogin').txtPassword.value == '')
	{
    	alert("Password field cannot be blank!");
    	$('frmMyLogin').txtPassword.focus();
    	return false;
	}
	else
	{
		oForm.submit();
	}
}

function validateComment()
{
	var oForm = $('frmMyComments');
	if ($('frmMyComments').taComment.value == '')
	{
    	alert("Please enter your comment");
    	$('frmMyComments').taComment.focus();
    	return false;
	}	
	else
	{
		oForm.submit();
	}
}

function popup(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	//sLargePhotoId = $('txtPhoto').value;
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/news/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
function enlargeForEvent(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/events/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
function enlargeForMP(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/marketplace/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
function enlargeForClassified(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/classifieds/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
function popupWindow(name, height, width, scrollbars)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	sLargePhotoId = $('txtPhoto').value;
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('../news/photo/'+sLargePhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
/* validation function for Marketplace */
function  saveAddMP()
{   
	var objform = $('frmAddMP');
	
    if($('frmAddMP').txtProduct.value == '')
	{
		alert ('Please fill up the Product/ Service Name field.');
		objform.txtProduct.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=marketplace&EventParam=add&Action=save";
		objform.submit();
	}
}
function  submitAddMP()
{   
	var objform = $('frmAddMP');
	var count1 = 0;
	var iPrice  = $('txtPrice').value;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
	
    if($('frmAddMP').txtProduct.value == '')
	{
		alert ('Please fill up the Product/ Service Name field.');
		objform.txtProduct.focus();
		return false;
	}
	else if($('frmAddMP').filePhoto.value == '')
	{
		alert ('Please upload the Photo/ Logo.');
		objform.filePhoto.focus();
		return false;
	}
	else if($('frmAddMP').taSummary.value == '')
	{
		alert ('Please fill up the Summary field.');
		objform.taSummary.focus();
		return false;
	}
	else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
	else if($('frmAddMP').dmPriceType.value == '')
	{
		alert ('Please select the Price Type field.');
		objform.dmPriceType.focus();
		return false;
	}
	else if($('frmAddMP').txtPrice.value == '')
	{
		alert ('Please fill up the Price field.');
		objform.txtPrice.focus();
		return false;
	}
	else if(!isInteger(iPrice))
	{
		alert ('Please enter numeric values to Price field.');
	}
	else if($('dmCity').value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
    else if($('frmAddMP').taDescription.value == '')
	{
		alert ('Please fill up the Description field.');
		objform.taDescription.focus();
		return false;
	}
	else if($('txtCaption1').value != '' && $('filePhoto1').value == '')
	{
		alert ('Please upload the photo for your caption.');
		objform.filePhoto1.focus();
		return false;
	}
	else if($('txtCaption2').value != '' && $('filePhoto2').value == '')
	{
		alert ('Please upload the photo for your caption.');
		objform.filePhoto2.focus();
		return false;
	}
	else if($('filePhoto1').value != '' && $('txtCaption1').value == '')
	{
		alert ('Please fill up the caption field for your photo.');
		objform.txtCaption1.focus();
		return false;
	}
	else if($('filePhoto2').value != '' && $('txtCaption2').value == '')
	{
		alert ('Please fill up the caption field for your photo.');
		objform.txtCaption2.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=marketplace&EventParam=add&Action=submit";
		objform.submit();
	}
}
function  saveEditMP(iMarketplaceId)
{   
	var objform = $('frmEditMP');
    if($('frmEditMP').txtProduct.value == '')
	{
		alert ('Please fill up the Product/ Service Name field.');
		objform.txtProduct.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=marketplace&EventParam=edit&Action=save&MarketplaceId="+iMarketplaceId;
		objform.submit();
	}
}
function  submitEditMP(iMarketplaceId)
{   
	var objform = $('frmEditMP');
	var count1 = 0;
	var iPrice  = $('txtPrice').value;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
	
    if($('frmEditMP').txtProduct.value == '')
	{
		alert ('Please fill up the Product/ Service Name field.');
		objform.txtProduct.focus();
		return false;
	}
	else if($('frmEditMP').hidPhoto.value == '' && $('frmEditMP').filePhoto.value == '')
	{
		alert ('Please upload the Photo/ Logo.');
		objform.filePhoto.focus();
		return false;
	}
	else if($('frmEditMP').taSummary.value == '')
	{
		alert ('Please fill up the Summary field.');
		objform.taSummary.focus();
		return false;
	}
	else if(count1== 0)
    {
    	alert("Please select atleast one areas of interest");
    }
	else if($('frmEditMP').dmPriceType.value == '')
	{
		alert ('Please select the Price Type field.');
		objform.dmPriceType.focus();
		return false;
	}
	else if($('frmEditMP').txtPrice.value == '')
	{
		alert ('Please fill up the Price field.');
		objform.txtPrice.focus();
		return false;
	}
	else if(!isInteger(iPrice))
	{
		alert ('Please enter numeric values to Price field.');
	}
	else if($('dmCity').value == '')
	{
		alert ('Please select the City/ Town field.');
		oForm.dmCity.focus();
		return false;
	}
    else if($('frmEditMP').taDescription.value == '')
	{
		alert ('Please fill up the Description field.');
		objform.taDescription.focus();
		return false;
	}
	else
	{
	   	objform.action = "my360.php?ModuleParam=marketplace&EventParam=edit&Action=submit&MarketplaceId="+iMarketplaceId;
		objform.submit();
	}
}
function deliveryStatusLog(iSalesId,iBuyerid)
{
	var objform = $('frmStatus');
   	objform.action = "my360.php?ModuleParam=my-purchase&EventParam=log&SalesId="+iSalesId+"&BuyerId="+iBuyerid;
	objform.submit();
}
/* news public page changes */
function showMediumSizePhoto(sMediumPhoto,photoTitle,iPhotoId,SlugUrl)
{
	$('mediumphoto').src = sMediumPhoto;
	$('photoTitle').innerHTML = photoTitle;
	$('mediumphoto').title = photoTitle;
	$('txtPhoto').value = iPhotoId;
	$('photoLink').innerHTML = '&nbsp;(<a href="http://www.odisha360.com/photos/'+iPhotoId+'/'+SlugUrl+'">+ Enlarge</a>)';
}

function funcCheckExists()
{
	var oForm = $('frmAddMember');
	var sUsername = oForm.txtUsername.value;
	if(sUsername == "")
	{	 
	  $('errormessage').style.color 		= "red";
	  var sErrFName = "<b>Error:</b> Please provide an Username.<br/>";
	  $('errormessage').innerHTML = sErrFName;
	  $('txtUsername').style.borderWidth 	= "1px";
	  $('txtUsername').style.borderColor 	= "red";
	  $('txtUsername').style.borderStyle 	= "solid";
	  var sErrFNameVal = '1';
	  oForm.txtUsername.focus();	  
	}
	else
  	{
  	     var url     = './user360/app/submit-exists.rem.php';
		 //Set up the parameters of our AJAX call
	 	 var postStr = encodeURIComponent(sUsername);
	 	 //Call the function that initiate the AJAX request
		 makeRequestExists(url, postStr);     
   	 } 
}

function showPubTab1()
{
	if($('tabcontent1'))
	{
		$('tabcontent1').style.display = 'block';
	}	
	if($('tabcontent2'))
	{
		$('tabcontent2').style.display = 'none';
	}	
	if($('tab1'))
	{
		$('tab1').style.backgroundColor = '#E7F1F8';
	}
	if($('link1'))
	{
		$('link1').style.color = '#ff6633';
	}
	if($('tab2'))
	{
		$('tab2').style.backgroundColor = '#4479AF';
	}
	if($('link2'))
	{
		$('link2').style.color = '#ffffff';
	}	
	
	
	
}
function showPubTab2()
{
	
	if($('tabcontent2'))
	{
		$('tabcontent2').style.display = 'block';
	}	
	if($('tabcontent1'))
	{
		$('tabcontent1').style.display = 'none';
	}	
	if($('tab1'))
	{
		$('tab1').style.backgroundColor = '#4479AF';
	}		
	if($('link1'))
	{
		$('link1').style.color = '#ffffff';
	}	
	if($('tab2'))
	{
		$('tab2').style.backgroundColor = '#E7F1F8';
		$('tab2').style.borderWidth = '1px';
		$('tab2').style.borderStyle = 'solid';
		$('tab2').style.borderColor = '#C2DCEF';
		$('tab2').style.borderBottomWidth = '0px';
	}
	if($('link2'))
	{
		$('link2').style.color = '#ff6633';
	}		
}

function enlargePhoto(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/news/index.php?ModuleParam=indivisual-photo&PhotoId='+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}

function submitPay()
{
	var objform = $('frmPay');
	objform.submit();
}

function updateMyProfile(iMpId, sURL)
{
	var objform = $('frmProfile');
	if($('frmProfile').txtFName)
	{
		if($('frmProfile').txtFName.value == '')
		{
			alert ('Please fill up your First Name field.');
			objform.txtFName.focus();
			return false;
		}
	}
	if($('frmProfile').txtLName)
	{
		if($('frmProfile').txtLName.value == '')
		{
			alert ('Please fill up your Last Name field.');
			objform.txtLName.focus();
			return false;
		}
	}
	if($('frmProfile').dmCity)
	{
		if($('frmProfile').dmCity.value == '')
		{
			alert ('Please select the City/ Town field.');
			objform.dmCity.focus();
			return false;
		}
	}
	if($('frmProfile').txtMobile)
	{
		var iMobNo  = $('txtMobile').value;
		if($('frmProfile').txtMobile.value == '')
		{
			alert ('Please fill up Mobile field.');
			objform.txtMobile.focus();
			return false;
		}
		else if(isNaN(iMobNo) || iMobNo.indexOf(" ")!=-1)
		{
			alert ('Please enter numeric values to Mobile field.');
			objform.txtMobile.focus();
			return false;
		}
	}
	if($('frmProfile').taAddress)
	{
		if($('frmProfile').taAddress.value == '')
		{
			alert ('Please fill up the Postal Address field.');
			objform.taAddress.focus();
			return false;
		}
	}
   	objform.action = sURL+"/marketplace/index.php?Categ=order&MarketplaceId="+iMpId;
    objform.submit();
}
function submitMessage(iMpId, sURL)
{
	var objform = $('frmMessage');
	if($('frmMessage').taMessage.value == '')
	{
		alert ('Please fill up the Message field.');
		objform.taMessage.focus();
		return false;
	}
	else
	{
		objform.action = sURL+"/marketplace/index.php?Categ=order&MarketplaceId="+iMpId;
    	objform.submit();
	}
}

function showHomeTab1()
{
	if($('tabcontent1')) $('tabcontent1').style.display = 'block';
	if($('tabcontent2')) $('tabcontent2').style.display = 'none';
	if($('mainTab2')) $('mainTab2').style.backgroundColor = '#E7F1F8';
	if($('link1')) $('link1').style.color = '#ff6633';
	if($('mainTab1')) $('mainTab1').style.backgroundColor = '#4479AF';
	if($('link2')) $('link2').style.color = '#ffffff';
	if($('viewphoto')) $('viewphoto').style.display = 'block';
	if($('viewvideo')) $('viewvideo').style.display = 'none';
}
function showHomeTab2()
{
	if($('tabcontent2')) $('tabcontent2').style.display = 'block';
	if($('tabcontent1')) $('tabcontent1').style.display = 'none';
	if($('mainTab2')) $('mainTab2').style.backgroundColor = '#4479AF';
	if($('link1')) $('link1').style.color = '#ffffff';
	if($('mainTab1')) $('mainTab1').style.backgroundColor = '#E7F1F8';
	if($('link2')) $('link2').style.color = '#ff6633';
	if($('mainTab1')) $('mainTab1').style.borderWidth = '1px';
	if($('mainTab1')) $('mainTab1').style.borderStyle = 'solid';
	if($('mainTab1')) $('mainTab1').style.borderColor = '#C2DCEF';
	if($('mainTab1')) $('mainTab1').style.borderBottomWidth = '0px';
}

function enlargePhotoCommunity(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/members/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
function showTabSocial()
{
	$('tabcntsocial').style.display = 'block';
	$('tabcntprof').style.display = 'none';
	$('tabsocial').style.backgroundColor = '#E7F1F8';
	$('linksoc').style.color = '#ff6633';
	$('tabprof').style.backgroundColor = '#4479AF';
	$('linkprof').style.color = '#ffffff';
	
	$('tabsocial').style.borderWidth = '1px';
	$('tabsocial').style.borderStyle = 'solid';
	$('tabsocial').style.borderColor = '#C2DCEF';
	$('tabsocial').style.borderBottomWidth = '0px';
}
function showTabProfess()
{
	$('tabcntprof').style.display = 'block';
	$('tabcntsocial').style.display = 'none';
	$('tabsocial').style.backgroundColor = '#4479AF';
	$('linksoc').style.color = '#ffffff';
	$('tabprof').style.backgroundColor = '#E7F1F8';
	$('linkprof').style.color = '#ff6633';
}

function  saveVoucher()
{
	var objform = $('frmAdd');
	
	if($('frmAdd').txtVoucherTitle.value == '')
	{
		alert ('Please fill up the Voucher Title field.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherTitle.value.length >80)
	{
		alert ('Voucher Title should less then 80 characters.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Voucher Description field.');
		objform.taDescription.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherCode.value.length < 4 || $('frmAdd').txtVoucherCode.value.length > 10 )
	{
		alert ('Voucher Code should be 4 to 10 character.');
		objform.txtVoucherCode.focus();
		return false;
	}
	else if($('frmAdd').dmValidityDay.value == '')
	{
		alert ('Please select the day.');
		objform.dmValidityDay.focus();
		return false;
	}
	else if($('frmAdd').dmValidityMonth.value == '')
	{
		alert ('Please select the month.');
		objform.dmValidityMonth.focus();
		return false;
	}
	else if($('frmAdd').dmValidityYear.value == '')
	{
		alert ('Please select the year.');
		objform.dmValidityYear.focus();
		return false;
	}
	else if($('frmAdd').selApplicableTo.value == '')
	{
		alert ('Please select to whom you want to apply.');
		objform.selApplicableTo.focus();
		return false;
	}
	else
	{
		objform.action = "my360.php?ModuleParam=my-voucher&EventParam=add&ActionParam=save";
		objform.submit();
	}
}

function  submitVoucher()
{
	var objform = $('frmAdd');
	
	if($('frmAdd').txtVoucherTitle.value == '')
	{
		alert ('Please fill up the Voucher Title field.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherTitle.value.length >80)
	{
		alert ('Voucher Title should less then 80 characters.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Voucher Description field.');
		objform.taDescription.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherCode.value.length < 4 || $('frmAdd').txtVoucherCode.value.length > 10 )
	{
		alert ('Voucher Code should be 4 to 10 character.');
		objform.txtVoucherCode.focus();
		return false;
	}	
	else if($('frmAdd').dmValidityDay.value == '')
	{
		alert ('Please select the day.');
		objform.dmValidityDay.focus();
		return false;
	}
	else if($('frmAdd').dmValidityMonth.value == '')
	{
		alert ('Please select the month.');
		objform.dmValidityMonth.focus();
		return false;
	}
	else if($('frmAdd').dmValidityYear.value == '')
	{
		alert ('Please select the year.');
		objform.dmValidityYear.focus();
		return false;
	}
	else if($('frmAdd').selApplicableTo.value == '')
	{
		alert ('Please select to whom you want to apply.');
		objform.selApplicableTo.focus();
		return false;
	}
	else
	{
		objform.action = "my360.php?ModuleParam=my-voucher&EventParam=add&ActionParam=submit";
		objform.submit();
	}
}

function  saveEditVoucher(iVoucherId)
{
	var objform = $('frmAdd');
	
	if($('frmAdd').txtVoucherTitle.value == '')
	{
		alert ('Please fill up the Voucher Title field.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherTitle.value.length >80)
	{
		alert ('Voucher Title should less then 80 characters.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Voucher Description field.');
		objform.taDescription.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherCode.value.length < 4 || $('frmAdd').txtVoucherCode.value.length > 10 )
	{
		alert ('Voucher Code should be 4 to 10 character.');
		objform.txtVoucherCode.focus();
		return false;
	}
	else if($('frmAdd').dmValidityDay.value == '')
	{
		alert ('Please select the day.');
		objform.dmValidityDay.focus();
		return false;
	}
	else if($('frmAdd').dmValidityMonth.value == '')
	{
		alert ('Please select the month.');
		objform.dmValidityMonth.focus();
		return false;
	}
	else if($('frmAdd').dmValidityYear.value == '')
	{
		alert ('Please select the year.');
		objform.dmValidityYear.focus();
		return false;
	}
	else if($('frmAdd').selApplicableTo.value == '')
	{
		alert ('Please select to whom you want to apply.');
		objform.selApplicableTo.focus();
		return false;
	}
	else
	{
		objform.action = "my360.php?ModuleParam=my-voucher&EventParam=edit&ActionParam=save&VoucherId="+iVoucherId;
		objform.submit();
	}
}

function submitEditVoucher(iVoucherId)
{
	var objform = $('frmAdd');
	
	if($('frmAdd').txtVoucherTitle.value == '')
	{
		alert ('Please fill up the Voucher Title field.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherTitle.value.length >80)
	{
		alert ('Voucher Title should less then 80 characters.');
		objform.txtVoucherTitle.focus();
		return false;
	}
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Voucher Description field.');
		objform.taDescription.focus();
		return false;
	}
	else if($('frmAdd').txtVoucherCode.value.length < 4 || $('frmAdd').txtVoucherCode.value.length > 10 )
	{
		alert ('Voucher Code should be 4 to 10 character.');
		objform.txtVoucherCode.focus();
		return false;
	}
	else if($('frmAdd').dmValidityDay.value == '')
	{
		alert ('Please select the day.');
		objform.dmValidityDay.focus();
		return false;
	}
	else if($('frmAdd').dmValidityMonth.value == '')
	{
		alert ('Please select the month.');
		objform.dmValidityMonth.focus();
		return false;
	}
	else if($('frmAdd').dmValidityYear.value == '')
	{
		alert ('Please select the year.');
		objform.dmValidityYear.focus();
		return false;
	}
	else if($('frmAdd').selApplicableTo.value == '')
	{
		alert ('Please select to whom you want to apply.');
		objform.selApplicableTo.focus();
		return false;
	}
	else
	{
		objform.action = "my360.php?ModuleParam=my-voucher&EventParam=edit&ActionParam=submit&VoucherId="+iVoucherId;
		objform.submit();
	}
}
function showTabCommunity1()
{
	$('tabcontent1').style.display = 'block';
	$('tabcontent2').style.display = 'none';
	$('tab1').style.backgroundColor = '#E7F1F8';
	$('link1').style.color = '#ff6633';
	$('tab2').style.backgroundColor = '#4479AF';
	$('link2').style.color = '#ffffff';
}
function showTabCommunity2()
{
	$('tabcontent2').style.display = 'block';
	$('tabcontent1').style.display = 'none';
		
	$('tab1').style.backgroundColor = '#4479AF';
	$('link1').style.color = '#ffffff';
	$('tab2').style.backgroundColor = '#E7F1F8';
	$('link2').style.color = '#ff6633';
	$('tab2').style.borderWidth = '1px';
	$('tab2').style.borderStyle = 'solid';
	$('tab2').style.borderColor = '#C2DCEF';
	$('tab2').style.borderBottomWidth = '0px';
}

function requestForFriendship()
{
	var oForm = $('frmMyRequest');
	if ($('frmMyRequest').taMessage.value == '')
	{
    	alert("Please fill up your Message");
    	$('frmMyRequest').taMessage.focus();
    	return false;
	}	
	else
	{
		oForm.submit();
	}
}

function rate1(iEntryId, iSectionType)
{
	$('notRated').style.display="none";
	$('rateAsBad').style.display="block";
	var url = 'http://www.odisha360.com/lib360/ratings.rem.php';
	 //Set up the parameters of our AJAX call
	 var postStr = encodeURIComponent(iEntryId)+'^'+ encodeURIComponent(iSectionType)+'^'+ encodeURIComponent(1);
	 //Call the function that initiate the AJAX request
	 makeRequestRatings(url, postStr); 			 
}   

function rate2(iEntryId, iSectionType)
{
	$('notRated').style.display="none";
	$('rateAsFine').style.display="block";
	var url = 'http://www.odisha360.com/lib360/ratings.rem.php';
	 //Set up the parameters of our AJAX call
	 var postStr = encodeURIComponent(iEntryId)+'^'+ encodeURIComponent(iSectionType)+'^'+ encodeURIComponent(2);
	 //Call the function that initiate the AJAX request
	 makeRequestRatings(url, postStr); 			 
}   

function rate3(iEntryId, iSectionType)
{
	$('notRated').style.display="none";
	$('rateAsGood').style.display="block";
	var url = 'http://www.odisha360.com/lib360/ratings.rem.php';
	 //Set up the parameters of our AJAX call
	 var postStr = encodeURIComponent(iEntryId)+'^'+ encodeURIComponent(iSectionType)+'^'+ encodeURIComponent(3);
	 //Call the function that initiate the AJAX request
	 makeRequestRatings(url, postStr); 			 
}   

function rate4(iEntryId, iSectionType)
{
	$('notRated').style.display="none";
	$('rateAsVeryGood').style.display="block";
	var url = 'http://www.odisha360.com/lib360/ratings.rem.php';
	//Set up the parameters of our AJAX call
	 var postStr = encodeURIComponent(iEntryId)+'^'+ encodeURIComponent(iSectionType)+'^'+ encodeURIComponent(4);
	 //Call the function that initiate the AJAX request
	 makeRequestRatings(url, postStr); 			 
}   

function rate5(iEntryId, iSectionType)
{
	$('notRated').style.display = "none";
	$('rateAsExcellent').style.display = "block";
	var url = 'http://www.odisha360.com/lib360/ratings.rem.php';
	//Set up the parameters of our AJAX call
	 var postStr = encodeURIComponent(iEntryId)+'^'+ encodeURIComponent(iSectionType)+'^'+ encodeURIComponent(5);
	 //Call the function that initiate the AJAX request
	 makeRequestRatings(url, postStr); 			 
}  

function showTabCommunityNew1()
{
	$('tabcontent3').style.display = 'block';
	$('tabcontent4').style.display = 'none';
	$('tab3').style.backgroundColor = '#E7F1F8';
	$('link3').style.color = '#ff6633';
	$('tab4').style.backgroundColor = '#4479AF';
	$('link4').style.color = '#ffffff';
}
function showTabCommunityNew2()
{
	$('tabcontent4').style.display = 'block';
	$('tabcontent3').style.display = 'none';
	
	$('tab3').style.backgroundColor = '#4479AF';
	$('link3').style.color = '#ffffff';
	$('tab4').style.backgroundColor = '#E7F1F8';
	$('link4').style.color = '#ff6633';
	$('tab4').style.borderWidth = '1px';
	$('tab4').style.borderStyle = 'solid';
	$('tab4').style.borderColor = '#C2DCEF';
	$('tab4').style.borderBottomWidth = '0px';
}

function showTabCommunityNew3()
{
	$('tabcontent1').style.display = 'block';
	$('tabcontent2').style.display = 'none';
	$('tab1').style.backgroundColor = '#E7F1F8';
	$('link1').style.color = '#ff6633';
	$('tab2').style.backgroundColor = '#4479AF';
	$('link2').style.color = '#ffffff';
}

function showTabCommunityNew4()
{
	$('tabcontent2').style.display = 'block';
	$('tabcontent1').style.display = 'none';
	
	$('tab1').style.backgroundColor = '#4479AF';
	$('link1').style.color = '#ffffff';
	$('tab2').style.backgroundColor = '#E7F1F8';
	$('link2').style.color = '#ff6633';
	$('tab2').style.borderWidth = '1px';
	$('tab2').style.borderStyle = 'solid';
	$('tab2').style.borderColor = '#C2DCEF';
	$('tab2').style.borderBottomWidth = '0px';
}

/***********Ajax Calls*********/

function GetXmlHttpObject()
{
	var xmlHttp = null;
    try
    {
	    //Firefox,Opera 8.1
	    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 doesn't support AJAX!");
		       return false;
	       }
      }
   }
   return  xmlHttp;
}
  
var xmlHttp=GetXmlHttpObject();

//Gets the browser specific XmlHttpRequest Object 
function getXmlHttpRequestObject() {
 if (window.XMLHttpRequest) {
    return new XMLHttpRequest(); //Mozilla, Safari ...
 } else if (window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP"); //IE
 } else {
    //Display our error message
    alert("Your browser doesn't support the XmlHttpRequest object.");
 }
}

//Our XmlHttpRequest object
var receiveReq = getXmlHttpRequestObject();

//Initiate the AJAX request for Registration
function makeRequestJoin(url, param) {
//If our readystate is either not started or finished, initiate a new request
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   receiveReq.open("POST", url, true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   receiveReq.onreadystatechange = updateJoin; 

   //Add HTTP headers to the request
   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");

   //Make the request
   receiveReq.send(param);
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updateJoin() {
 //Check if our response is ready
 if (receiveReq.readyState == 4) {	 
     if(receiveReq.responseText == '<div><b>Error:</b> The Security Code is incorrect.</div>')
	 {
		 //Set the content of the DIV element with the response text
		   $('errormessage').style.color = "red";
		   $('errormessage').innerHTML = receiveReq.responseText;
		   $('txtSecurity').style.borderWidth = "1px";
		   $('txtSecurity').style.borderColor = "red";
		   $('txtSecurity').style.borderStyle = "solid";
		   //Get a reference to CAPTCHA image
		   img = $('imgCaptcha'); 
		   //Change the image
		   img.src = './lib360/captcha.php?' + Math.random();	
	 }
	 else if(receiveReq.responseText == '<h1>Test successful!</h1>')
	 {
		 //Set display of DIVs to none	   
		 sErrSecCode = "";
		 $('txtSecurity').style.borderWidth = "1px";
	     $('txtSecurity').style.borderColor = "#00CC00";
	     $('txtSecurity').style.borderStyle = "solid";
		 sErrSecCodeVal = '0';  
		 $('errormessage').style.display = "none";
		 var oForm = eval($('frmAddMember'));
		 oForm.submit();			 
	 }   
 } 
}

function makeRequestRatings(url, parameters) {
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateRatings; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updateRatings() 
{	
  var iRating = 0;
 //Check if our response is ready
 if (xmlHttp.readyState == 4) 
 {	 
 	 sResponse  = xmlHttp.responseText;
	 sResponse1 = sResponse.substring(0,2);
	 iRating = sResponse.substring(2);
 	 if (sResponse1 == '1-')
	 {  		
		//Set the content of the DIV element with the response text
		document.getElementById('thanks').style.display = "block";
		document.getElementById('thanks').style.color="#00CC00";
		//document.getElementById('thanks').style.marginBottom="15px";	
 		document.getElementById('thanks').innerHTML="Thank you for rating."; 
 		document.getElementById('rating').innerHTML = iRating; 		
 	 } 
 	 else
	 {   
		//Set the content of the DIV element with the response text
		document.getElementById('thanks').style.display = "block";
		document.getElementById('thanks').style.color="red";
		//document.getElementById('thanks').style.marginBottom="15px";	
 		document.getElementById('thanks').innerHTML="You are not able to rate."; 		
 	 }		
 } 
}

//Check Username Exists
function makeRequestExists(url, parameters) {
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateExists; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updateExists() 
{	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) 
 {	 
 	 sResponse  = xmlHttp.responseText;
 	 if (sResponse > '0')
	 {  		
		  $('errormessage').style.color 		= "red";
		  var sErrFName = "The Username already exists. Please provide another Username.<br/>";
		  $('errormessage').innerHTML = sErrFName;
	      $('txtUsername').style.borderWidth 	= "1px";
	      $('txtUsername').style.borderColor 	= "red";
	      $('txtUsername').style.borderStyle 	= "solid";
	      var sErrFNameVal = '1';
		  $('frmAddMember').txtUsername.focus();
 	 } 
 	 else
	 {   
	      $('txtUsername').style.borderWidth = "1px";
		  $('txtUsername').style.borderColor = "#00CC00";
		  $('txtUsername').style.borderStyle = "solid";	
		  $('errormessage').style.color 	   = "#00CC00";
		  var sErrFName = "Your Username is valid. Please proceed.<br/>";
		  $('errormessage').innerHTML = sErrFName;			  	
 	 }		
 } 
}

function submitSearchMember()
{
	var objform    = $('frmMemberSearch');
	if($('frmMemberSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search members.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmMemberSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search members.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		var sKeyword   = $('frmMemberSearch').txtSearch.value;
		objform.action = "http://www.odisha360.com/my360.php?ModuleParam=my-friends&EventParam=member-search&Word="+sKeyword;
		objform.submit();
	}
}
function searchMember()
{
	var objform    = $('frmSearch');
	if($('frmSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search members.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search members.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		var sKeyword   = $('frmSearch').txtSearch.value;
		objform.action = "index.php?ModuleParam=member-search&Word="+sKeyword;
		objform.submit();
	}
}
function displayBannerPPV()
{
	$('payPerView').style.display='block';
}
function displayBannerPPC()
{
	$('payPerClick').style.display='block';
}

function changeToUpIcon()
{
	$('sendMessage').style.display = 'block';
	$('downContent').style.display = 'none';
	$('upClose').style.display = 'block';
}
function changeToDownIcon()
{
	$('sendMessage').style.display = 'none';
	$('downContent').style.display = 'block';
	$('upClose').style.display = 'none';
}
function sendMessage(ypEmail)
{
	var objform = $('frmMessage');
	var sEmail = $('frmMessage').txtEmail.value;
	sCorrEmailVal = validateEmail(sEmail);
	if($('frmMessage').txtName.value == '')
	{
		alert ('Please fill up the Name field.');
		objform.txtName.focus();
		return false;
	}
	else if($('frmMessage').txtEmail.value == "")
	{
		alert('Please fill up your Email Address.'); 
		objform.txtEmail.focus();
		return false;
	}
	else if(($('frmMessage').txtEmail.value != "") && (sCorrEmailVal == '0'))
	{	   
	   alert('The Email field should have the correct format.');
       var sCorrEmailVal = '0';
       objform.txtEmail.value='';
	   objform.txtEmail.focus();
	}
	else if($('frmMessage').txtMobile.value == "")
	{
		alert('Please fill up the Telephone/ Mobile field.');
		objform.txtMobile.focus();
		return false;
	}
	else if($('frmMessage').taMessage.value == '')
	{
		alert ('Please fill up the Your Message field.');
		objform.taMessage.focus();
		return false;
	}
	else if($('frmMessage').txtSecurity.value == '')
	{
		alert ('Please enter the security code.');
		objform.txtSecurity.focus();
		return false;
	}
	else if($('txtSecurity').value != "")
  	{
  	     var url = './app/submit-message.rem.php';
		 //Set up the parameters of our AJAX call
		 //$('errormessage').style.color = "black";
		 var postStr = $("txtSecurity").name + "=" + encodeURIComponent( $("txtSecurity").value )+$("txtName").name + "=" + encodeURIComponent( $("txtName").value )+$("txtEmail").name + "=" + encodeURIComponent( $("txtEmail").value )+$("txtMobile").name + "=" + encodeURIComponent( $("txtMobile").value )+$("taMessage").name + "=" + encodeURIComponent( $("taMessage").value )+$("hidYPEmail").name + "=" + encodeURIComponent( $("hidYPEmail").value );
		 //Call the function that initiate the AJAX request
		 makeRequestMessage(url, postStr); 	     
   	} 
}
//Initiate the AJAX request for sending a quick message
function makeRequestMessage(url, param) {
//If our readystate is either not started or finished, initiate a new request
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   receiveReq.open("POST", url, true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   receiveReq.onreadystatechange = updateSendMessage; 

   //Add HTTP headers to the request
   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");

   //Make the request
   receiveReq.send(param);
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updateSendMessage() {
 //Check if our response is ready
 if (receiveReq.readyState == 4) {	 
     if(receiveReq.responseText == '<div><b>Error:</b> The Security Code is incorrect.</div>')
	 {
		 //Set the content of the DIV element with the response text
		   $('txtSecurity').style.borderWidth = "1px";
	       $('txtSecurity').style.borderColor = "red";
	       $('txtSecurity').style.borderStyle = "solid";
		   alert ('Please enter the correct security code.');
		   //Get a reference to CAPTCHA image
		   img = $('imgCaptcha'); 
		   //Change the image
		   img.src = '../lib360/captcha.php?' + Math.random();	
	 }
	 else if(receiveReq.responseText == '<h1>Test successful!</h1>')
	 {
		 //Set display of DIVs to none	   
		 sErrSecCode = "";
		 $('txtSecurity').style.borderWidth = "1px";
	     $('txtSecurity').style.borderColor = "#00CC00";
	     $('txtSecurity').style.borderStyle = "solid";
		 sErrSecCodeVal = '0';  
		 $('errormessage').style.display = "none";
		 var oForm = eval($('frmAddMember'));
		 oForm.submit();			 
	 }   
 } 
}
function enlargeForYP(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/yellow-pages/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}
function expandMessageBox()
{
	$('sendMessage123').style.display = 'block';
}
function collapseMessageBox()
{
	$('sendMessage123').style.display = 'none';
}

function submitYPCategory(labelid)
{
	for(iCount=65;iCount<91;iCount++)
	{
		sLabelId = 'label' + iCount;
		sChar    = 'char'  + iCount;
		$(sLabelId).style.display = 'None';
		$(sChar).style.fontWeight = 'normal';
	}
	
	sSelLabelId = 'label' + labelid;
	sSelChar    = 'char'  + labelid;
	$(sSelLabelId).style.display = 'block';
	$(sSelChar).style.fontWeight = 'bold';	
}
/* yellow page tab */
function showTabAlphabatically()
{
	$('tabcntsocial').style.display = 'block';
	$('tabcntprof').style.display = 'none';
	$('tabsocial').style.backgroundColor = '#E7F1F8';
	$('linksoc').style.color = '#ff6633';
	$('tabprof').style.backgroundColor = '#4479AF';
	$('linkprof').style.color = '#ffffff';
	
	$('tabsocial').style.borderWidth = '1px';
	$('tabsocial').style.borderStyle = 'solid';
	$('tabsocial').style.borderColor = '#C2DCEF';
	$('tabsocial').style.borderBottomWidth = '0px';
	
	for(iCount=65;iCount<91;iCount++)
	{
		sLabelId = 'label' + iCount;
		$(sLabelId).style.display = 'None';
	}
	sSelLabelId = 'label' + 65;
	sChar       = 'char'  + 65;
	$(sSelLabelId).style.display = 'block';
	$(sChar).style.fontWeight    = 'bold';	
}
function showTabCategorywise()
{
	$('tabcntprof').style.display = 'block';
	$('tabcntsocial').style.display = 'none';
	$('tabsocial').style.backgroundColor = '#4479AF';
	$('linksoc').style.color = '#ffffff';
	$('tabprof').style.backgroundColor = '#E7F1F8';
	$('linkprof').style.color = '#ff6633';
}

/******Email an article******/
function popupEmailItem(name, height, width, scrollbars,url)
{
    var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open(url,name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();		 
}   

function submitEmailItem(link)
{
    $('errormessage').style.display = "block";
	var oForm = $('frmEmailItem');
	var sEmail = $('frmEmailItem').txtEmail.value;
	sCorrEmailVal = validateEmail(sEmail);
	if($('frmEmailItem').txtReceiverEmail.value != "")
	  {
		  sErrReceiverEmail = "";
		  $('txtReceiverEmail').style.borderWidth = "1px";
	      $('txtReceiverEmail').style.borderColor = "#00CC00";
	      $('txtReceiverEmail').style.borderStyle = "solid";
		  sErrReceiverEmailVal = '0';
	  } 
	  if($('frmEmailItem').txtName.value != "")
	  {
		    sErrName = "";
			$('txtName').style.borderWidth = "1px";
		    $('txtName').style.borderColor = "#00CC00";
		    $('txtName').style.borderStyle = "solid";
			sErrNameVal = '0';
	  }
	  if(($('frmEmailItem').txtEmail.value != "") && (sCorrEmailVal == '1'))
	  {
		  sErrEmail = "";
		  $('txtEmail').style.borderWidth = "1px";
	      $('txtEmail').style.borderColor = "#00CC00";
	      $('txtEmail').style.borderStyle = "solid";
		  sErrEmailVal = '0';
	  } 	  
	  if($('frmEmailItem').tamsg.value != "")
	  {
		    sErrMsg = "";
			$('tamsg').style.borderWidth = "1px";
		    $('tamsg').style.borderColor = "#00CC00";
		    $('tamsg').style.borderStyle = "solid";
			sErrMsgVal = '0';
	  } 	
	  if($('frmEmailItem').txtReceiverEmail.value == "")
	  {	 
	      $('errormessage').innerHTML           = "";
		  $('errormessage').style.color 		= "red";
		  var sErrReceiverEmail = "<b>Error:</b> Please provide the recipient's E-mail address.<br/>";
		  $('errormessage').innerHTML = sErrReceiverEmail;
	      $('txtReceiverEmail').style.borderWidth 	= "1px";
	      $('txtReceiverEmail').style.borderColor 	= "red";
	      $('txtReceiverEmail').style.borderStyle 	= "solid";
	      var sErrReceiverEmailVal = '1';
		  oForm.txtReceiverEmail.focus();
		  
	  }	  
	  else if($('frmEmailItem').txtName.value == "")
	  {	 
	      $('errormessage').innerHTML           = "";
		  $('errormessage').style.color 		= "red";
		  var sErrName = "<b>Error:</b> Please provide your Name.<br/>";
		  $('errormessage').innerHTML = sErrName;
	      $('txtName').style.borderWidth 	= "1px";
	      $('txtName').style.borderColor 	= "red";
	      $('txtName').style.borderStyle 	= "solid";
	      var sErrNameVal = '1';
		  oForm.txtName.focus();		  
	  }	  
	  else if($('frmEmailItem').txtEmail.value == "")
	  {  
		  $('errormessage').innerHTML           = "";	  
		  $('errormessage').style.color 	= "red";
		  var sErrEmail = "<b>Error:</b> Please enter your Email Address.<br/>";
		  $('errormessage').innerHTML 		= sErrEmail;	  
	      $('txtEmail').style.borderWidth 	= "1px";
	      $('txtEmail').style.borderColor 	= "red";
	      $('txtEmail').style.borderStyle 	= "solid";
		  oForm.txtEmail.focus();
	  }
	  else if(($('frmEmailItem').txtEmail.value != "") && (sCorrEmailVal == '0'))
	  {	  
	       $('errormessage').innerHTML          = ""; 
		   $('errormessage').style.color 		= "red";
		   var sErrEmail1 = "<b>Error:</b> The Email field should have the correct format.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail1;
	       $('txtEmail').style.borderWidth 	= "1px";
	       $('txtEmail').style.borderColor 	= "red";
	       $('txtEmail').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
	       oForm.txtEmail.value='';
		   oForm.txtEmail.focus();
	  } 	 
	  else
  	  {
  	     $('errormessage').innerHTML           = "";
  	     var url = '../../lib360/submit-email.rem.php';
		 //Set up the parameters of our AJAX call
		 if($('frmEmailItem').tamsg.value != '')
		 {
			 var sYourMsg 		= $('frmEmailItem').tamsg.value;
			 sYourMsg 			= nl2br_js(sYourMsg);
		 }
		 var sReceiverEmail = $('frmEmailItem').txtReceiverEmail.value;
		 var sYourNm        = $('frmEmailItem').txtName.value;
		 var sYourEm        = $('frmEmailItem').txtEmail.value;
		  
	     var postStr = encodeURIComponent(link)+'^'+ encodeURIComponent(sReceiverEmail)+'^'+ encodeURIComponent(sYourNm)+'^'+ encodeURIComponent(sYourEm)+'^'+ encodeURIComponent(sYourMsg);
	     //Call the function that initiate the AJAX request
	     makeRequestEmailItem(url, postStr); 	     
   	  } 	
}

function nl2br_js(myString)
{
	return myString.replace( /\n/g, 'weed' );
}

/************Ajax for Email Item****************/
function makeRequestEmailItem(url, parameters) {
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateEmailItem; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updateEmailItem() 
{	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) 
 {	 
 	 sResponse  = xmlHttp.responseText;
 	 if (sResponse == 'You have shared the link successfully.')
	 {  		
		//Set the content of the DIV element with the response text
		document.getElementById('success').style.color    = "#00CC00";
		$('success').style.paddingTop 	          = "15px";
		$('success').style.paddingBottom 	      = "15px";
 		document.getElementById('success').innerHTML      = sResponse;
 	 } 
 	 else
	 {   
		//Set the content of the DIV element with the response text
		document.getElementById('errormsg').style.display = "block";
 	 }		
 } 
}
function inviteToJoin()
{
	var oForm = $('frmInvite');
	//var sEmail = $('frmInvite').txtEmail.value;
	if($('frmInvite').taEmail.value == '')
	{
		alert ('Please fill up the Email field.');
		oForm.taEmail.focus();
		return false;
	}
	else
	{
		//oForm.action = "my360.php?ModuleParam=dashboard&EventParam=invite";
		oForm.action = "members/index.php?EventParam=invite";
		oForm.submit();
	}
}
function checkParentCategory()
{
	//oForm = $('frmAdd');
	var iCategId = $('dmCategory').value;
	if(iCategId == 1 || iCategId == 2 || iCategId == 3 || iCategId == 4 || iCategId == 5)
	{
		alert('Please Select a Subcategory.');
		$('dmCategory').selectedIndex = 0;
		//oForm.dmCategory.focus();
		return false;
	}
}
function textCounter(field,cntfield,maxlimit) 
{
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
	cntfield.value = maxlimit - field.value.length;
}
function textareaCounter()
{
	oForm = $('frmEdit');
	var field = oForm.taDescription;
	var cntfield = oForm.remLen;
	var maxlimit = 5000;
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
	cntfield.value = maxlimit - field.value.length;
}
function textareaLimtCounter()
{
	oForm = $('frmEventEdit');
	var field = oForm.taUpdates;
	var cntfield = oForm.remLength;
	var maxlimit = 5000;
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
	cntfield.value = maxlimit - field.value.length;
}
function textareaLimiter()
{
	oForm = $('frmAdd');
	var field = oForm.taDescription;
	var cntfield = oForm.remLength;
	var maxlimit = 5000;
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
	cntfield.value = maxlimit - field.value.length;
}
function textareaLimitCheck()
{
	oForm = $('frmEdit');
	var field    = oForm.taDescription;
	var cntfield = oForm.remLength;
	var maxlimit = 5000;
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
	cntfield.value = maxlimit - field.value.length;
}
function enlargePhotoInfopedia(name, height, width, scrollbars, iPhotoId)
{
	 // Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	 var new_window;
	 var centred_x = (screen.width / 2) - (width / 2);
	 var centred_y = (screen.height / 2) - (height / 2);
	 new_window = window.open('http://www.odisha360.com/infopedia/photo/'+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	 new_window.focus();
}

/**********VIDEOS**********/
/* Method to validate the user inputs in the Videos add page while saving the entry */
function saveAddVideo()
{
	var oForm = $('frmAddVideo');
    if($('frmAddVideo').txtTitle.value == '')
	{
		alert ('Please fillup the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('frmAddVideo').filePhoto.value != '')
	{
		if(($('frmAddVideo').filePhoto.type == "file") && ($('frmAddVideo').filePhoto.value.indexOf(".flv") == -1)) 
		{
			alert('Please upload videos only of .flv type.');
		}
		else
		{
		   	oForm.action = "my360.php?ModuleParam=videos&EventParam=add&Action=save";
			oForm.submit();
		}
	}
	else
	{
	   	oForm.action = "my360.php?ModuleParam=videos&EventParam=add&Action=save";
		oForm.submit();
	}
	
}
/* Method to validate the user inputs in the Videos add page while submitting the entry */
function submitAddVideo()
{
	var oForm = $('frmAddVideo');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
    if($('frmAddVideo').txtTitle.value == '')
	{
		alert ('Please fillup the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('frmAddVideo').filePhoto.value == '')
	{
		alert ('Please Upload a Video.');
		oForm.filePhoto.focus();
		return false;
	}
	else if($('frmAddVideo').filePhoto.value != '')
	{
		if(($('frmAddVideo').filePhoto.type == "file") && ($('frmAddVideo').filePhoto.value.indexOf(".flv") == -1)) 
		{
			alert('Please upload videos only of .flv type.');
		}
		else if(count1== 0)
	    {
	    	alert("Please select atleast one areas of interest");
	    }	
		else
		{
		   	oForm.action = "my360.php?ModuleParam=videos&EventParam=add&Action=submit";
			oForm.submit();
		}
	}
}
/* Method to validate the user inputs in the Videos add page while saving the entry */
function saveEditVideo(iVideoId)
{
	var oForm = $('frmEditVideo');
    if($('frmEditVideo').txtTitle.value == '')
	{
		alert ('Please fillup the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('frmEditVideo').filePhoto.value != '')
	{
		if(($('frmEditVideo').filePhoto.type == "file") && ($('frmEditVideo').filePhoto.value.indexOf(".flv") == -1)) 
		{
			alert('Please upload videos only of .flv type.');
		}
		else
		{
		   	oForm.action = "my360.php?ModuleParam=videos&EventParam=edit&Action=save&VideoId="+iVideoId;
			oForm.submit();
		}
	}
	else
	{
	   	oForm.action = "my360.php?ModuleParam=videos&EventParam=edit&Action=save&VideoId="+iVideoId;
		oForm.submit();
	}
}
/* Method to validate the user inputs in the Videos add page while submitting the entry */
function submitEditVideo(iVideoId)
{
	var oForm = $('frmEditVideo');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
    if($('frmEditVideo').txtTitle.value == '')
	{
		alert ('Please fillup the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('frmEditVideo').hidVideo.value == '' && $('frmEditVideo').filePhoto.value == '')
	{
		alert ('Please Upload a Video.');
		oForm.filePhoto.focus();
		return false;
	}
	else if($('frmEditVideo').filePhoto.value != '')
	{
		if(($('frmEditVideo').filePhoto.type == "file") && ($('frmEditVideo').filePhoto.value.indexOf(".flv") == -1)) 
		{
			alert('Please upload videos only of .flv type.');
		}
		else if(count1== 0)
	    {
	    	alert("Please select atleast one areas of interest");
	    }	
		else
		{
		   	oForm.action = "my360.php?ModuleParam=videos&EventParam=edit&Action=submit&VideoId="+iVideoId;
			oForm.submit();
		}
	}
	else
	{
	   	oForm.action = "my360.php?ModuleParam=videos&EventParam=edit&Action=save&VideoId="+iVideoId;
		oForm.submit();
	}
}

function sendContact()
{
	$('errormessage').style.display = "block";
	var oForm       = $('frmContact');
	var sEmail      = $('frmContact').txtEmail.value;
	sCorrEmailVal   = validateEmail(sEmail);
	var email       = $('txtEmail').value;
    var contactName = $('txtName').value;
    var telephone   = $('txtTelephone').value;
    var message     = $('taDetails').value;
    var message     = nl2br_js(message);
    var company     = $('txtCompany').value;
    var mailAddress = $('txtAddress').value;
    var country     = $('dmCountry').value;  
    var securityCode = $('txtSecurity').value;
      if($('radReasonBizEnq').checked)
	  {
		  var radioValue=$('radReasonBizEnq').value;		  
	  }
	  else if($('radReasonServSup').checked)
	  {
		  var radioValue=$('radReasonServSup').value;		  
	  }
	  else if($('radReasonWebFeed').checked)
	  {
		  var radioValue=$('radReasonWebFeed').value;		  
	  }
	  else if($('radReasonPress').checked)
	  {
		  var radioValue=$('radReasonPress').value;	  
	  }
	  else if($('radReasonOther').checked)
	  {
		  var radioValue=$('radReasonPress').value;		  
	  }
	if($('frmContact').taDetails.value != "")
    {
	    sErrDetails = "";
		$('taDetails').style.borderWidth = "1px";
	    $('taDetails').style.borderColor = "#00CC00";
	    $('taDetails').style.borderStyle = "solid";
		sErrDetailsVal = '0';
    }
    if($('frmContact').txtName.value != "")
    {
	    sErrName = "";
		$('txtName').style.borderWidth = "1px";
	    $('txtName').style.borderColor = "#00CC00";
	    $('txtName').style.borderStyle = "solid";
		sErrNameVal = '0';
    }
    if($('frmContact').txtCompany.value != "")
    {
	    sErrCompany = "";
		$('txtCompany').style.borderWidth = "1px";
	    $('txtCompany').style.borderColor = "#00CC00";
	    $('txtCompany').style.borderStyle = "solid";
		sErrCompanyVal = '0';
    }
    if(($('frmContact').txtEmail.value != "") && (sCorrEmailVal == '1'))
    {
	  sErrEmail = "";
	  $('txtEmail').style.borderWidth = "1px";
      $('txtEmail').style.borderColor = "#00CC00";
      $('txtEmail').style.borderStyle = "solid";
	  sErrEmailVal = '0';
    } 
    if($('frmContact').txtTelephone.value != "")
    {
	    sErrTelephone = "";
		$('txtTelephone').style.borderWidth = "1px";
	    $('txtTelephone').style.borderColor = "#00CC00";
	    $('txtTelephone').style.borderStyle = "solid";
		sErrTelephoneVal = '0';
    }
    if($('frmContact').txtAddress.value != "")
    {
	    sErrAddress = "";
		$('txtAddress').style.borderWidth = "1px";
	    $('txtAddress').style.borderColor = "#00CC00";
	    $('txtAddress').style.borderStyle = "solid";
		sErrAddressVal = '0';
    }
    if($('frmContact').dmCountry.value != "")
    {
	    sErrCountry = "";
		$('dmCountry').style.borderWidth = "1px";
	    $('dmCountry').style.borderColor = "#00CC00";
	    $('dmCountry').style.borderStyle = "solid";
		sErrCountryVal = '0';
    }
	
	  if($('frmContact').taDetails.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrDetails = "<b>Error:</b> Please provide the Message.<br/>";
		  $('errormessage').innerHTML = sErrDetails;
	      $('taDetails').style.borderWidth 	= "1px";
	      $('taDetails').style.borderColor 	= "red";
	      $('taDetails').style.borderStyle 	= "solid";
	      var sErrDetailsVal = '1';
		  oForm.taDetails.focus();
		  
	  }
	  else if($('frmContact').txtName.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrName = "<b>Error:</b> Please provide your Name.<br/>";
		  $('errormessage').innerHTML = sErrName;
	      $('txtName').style.borderWidth 	= "1px";
	      $('txtName').style.borderColor 	= "red";
	      $('txtName').style.borderStyle 	= "solid";
	      sErrNameVal = '1';
		  oForm.txtName.focus();
	  }	  
	  else if($('frmContact').txtCompany.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrCompany = "<b>Error:</b> Please provide your Company.<br/>";
		  $('errormessage').innerHTML = sErrCompany;
	      $('txtCompany').style.borderWidth 	= "1px";
	      $('txtCompany').style.borderColor 	= "red";
	      $('txtCompany').style.borderStyle 	= "solid";
	      sErrCompanyVal = '1';
		  oForm.txtCompany.focus();
	  }	  
	  else if($('frmContact').txtEmail.value == "")
	  {  
		  	  
		  $('errormessage').style.color 	= "red";
		  var sErrEmail = "<b>Error:</b> Please provide your Email.<br/>";
		  $('errormessage').innerHTML 		= sErrEmail;	  
	      $('txtEmail').style.borderWidth 	= "1px";
	      $('txtEmail').style.borderColor 	= "red";
	      $('txtEmail').style.borderStyle 	= "solid";
		  oForm.txtEmail.focus();
	  }
	  else if(($('frmContact').txtEmail.value != "") && (sCorrEmailVal == '0'))
	  {	   
		   $('errormessage').style.color 		= "red";
		   var sErrEmail = "<b>Error:</b> The Email field should have the correct format.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail;
	       $('txtEmail').style.borderWidth 	= "1px";
	       $('txtEmail').style.borderColor 	= "red";
	       $('txtEmail').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
	       oForm.txtEmail.value='';
		   oForm.txtEmail.focus();
	  } 
	  else if($('frmContact').txtTelephone.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrTelephone = "<b>Error:</b> Please provide your Telephone/ Mobile.<br/>";
		  $('errormessage').innerHTML = sErrTelephone;
	      $('txtTelephone').style.borderWidth 	= "1px";
	      $('txtTelephone').style.borderColor 	= "red";
	      $('txtTelephone').style.borderStyle 	= "solid";
	      var sErrTelephoneVal = '1';
		  oForm.txtTelephone.focus();
	  }
	  else if($('frmContact').txtAddress.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrAddress = "<b>Error:</b> Please provide your Postal Address.<br/>";
		  $('errormessage').innerHTML = sErrAddress;
	      $('txtAddress').style.borderWidth 	= "1px";
	      $('txtAddress').style.borderColor 	= "red";
	      $('txtAddress').style.borderStyle 	= "solid";
	      var sErrAddressVal = '1';
		  oForm.txtAddress.focus();
	  }
	  else if($('frmContact').dmCountry.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrCountry = "<b>Error:</b> Please provide your Country.<br/>";
		  $('errormessage').innerHTML = sErrCountry;
	      $('dmCountry').style.borderWidth 	= "1px";
	      $('dmCountry').style.borderColor 	= "red";
	      $('dmCountry').style.borderStyle 	= "solid";
	      var sErrCountryVal = '1';
		  oForm.dmCountry.focus();	  
	  }
	  else if($('frmContact').txtSecurity.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrSecCode = "<b>Error:</b> Please enter the security code.<br/>";
		  $('errormessage').innerHTML = sErrSecCode;
	      $('txtSecurity').style.borderWidth 	= "1px";
	      $('txtSecurity').style.borderColor 	= "red";
	      $('txtSecurity').style.borderStyle 	= "solid";
	      var sErrSecCodeVal = '1';
		  oForm.txtSecurity.focus();	  
	  }
	  else if($('txtSecurity').value != "")
  	  {
  	     var postValues = encodeURIComponent(contactName)+'^'+ encodeURIComponent(email)+'^'+ encodeURIComponent(telephone)+'^'+ encodeURIComponent(company)+'^'+encodeURIComponent(mailAddress)+'^'+encodeURIComponent(securityCode)+'^'+encodeURIComponent(radioValue)+'^'+encodeURIComponent(country)+'^'+encodeURIComponent(message);
	     document.getElementById('errormessage').style.color = "black";
	     var url="./lib360/submit-contact-rem.php";
         makeRequestContact(url,postValues);    
   	  } 
}

// MAKE REQUEST CONTACT PAGE

function makeRequestContact(url, parameters) { 
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateContact; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

function updateContact() {
	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) { 
	 if(xmlHttp.responseText == '<div>Error: The Security Code is incorrect.</div>')
	 {   
		 //Set the content of the DIV element with the response text
		   document.getElementById('errormessage').style.color = "red";
		   document.getElementById('errormessage').innerHTML = xmlHttp.responseText;
		   document.getElementById('txtSecurity').style.borderWidth = "1px";
		   document.getElementById('txtSecurity').style.borderColor = "red";
		   document.getElementById('txtSecurity').style.borderStyle = "solid";
		   //Get a reference to CAPTCHA image
		   img = document.getElementById('imgCaptcha'); 
		   //Change the image
		   img.src = './lib360/captcha.php?' + Math.random();			   
		      
	 }
	 else if(xmlHttp.responseText == '<div>Message sent.</div>')
	 {		 
	     //Set display of DIVs to none	
	     $('errormessage').style.color = "green";  
	     $('errormessage').innerHTML = xmlHttp.responseText;   
		 //$('errormessage').style.display = "none";
		 var oForm = eval($('frmContact'));
		 oForm.submit();		 
	 }
	 else if(xmlHttp.responseText == '<div>Error sending Email.</div>')
	 {
		 $('errormessage').style.color = "red";
		 $('errormessage').innerHTML = xmlHttp.responseText;
     } 
   
 }
 
}

/* Check User Name */
function makeRequestUserName(url, parameters) { 
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = checkUserName; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}
//Called every time our XmlHttpRequest objects state changes
function checkUserName() 
{
 var oForm     = $('frmComposeMsg');
 var sMsgType  = $('frmComposeMsg').hidMsgType.value;	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) 
 {	
 	 sResponse  = xmlHttp.responseText;
 	 if (sResponse > '0')
	 { 
		 if($('frmComposeMsg').txtMsgSubject.value == "")
		 {	   
		   alert('Please provide a Subject Title.');
		   oForm.txtMsgSubject.focus();
		   return false;
		 }
		 else if($('frmComposeMsg').taMsgBody.value == "")
		 {	   
		   alert('Please fill up the Message block.');
		   oForm.taMsgBody.focus();
		   return false;
		 }
		 else
		 {
			oForm.action = "my360.php?ModuleParam=inbox&EventParam="+sMsgType;
			oForm.submit();
			return true;
		 } 
 	 } 
 	 else
	 {  
		 alert('Username does not exists');
 	 }		
 }
}
function newsSearch()
{
	var objform    = $('frmNewsSearch');
	var sKeyword   = $('frmNewsSearch').txtSearch.value;
	if($('frmNewsSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search news.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmNewsSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search news.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		objform.action = "http://www.odisha360.com/news/index.php?ModuleParam=search&Keyword="+sKeyword;
		objform.submit;
		return true;
	}
}
function eventSearch()
{
	var objform    = $('frmEventSearch');
	var sKeyword   = $('frmEventSearch').txtSearch.value;
	if($('frmEventSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search events.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmEventSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search events.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		objform.action = "http://www.odisha360.com/events/index.php?Categ=search&Keyword="+sKeyword;
		objform.submit;
		return true;
	}
}
function classifiedSearch()
{
	var objform    = $('frmClassifiedSearch');
	var sKeyword   = $('frmClassifiedSearch').txtSearch.value;
	if($('frmClassifiedSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search classifieds.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmClassifiedSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search classifieds.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		objform.action = "http://www.odisha360.com/classifieds/index.php?AoI=search&Keyword="+sKeyword;
		objform.submit;
		return true;
	}
}
function mpSearch()
{
	var objform    = $('frmMPSearch');
	var sKeyword   = $('frmMPSearch').txtSearch.value;
	if($('frmMPSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search marketplace.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmMPSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search marketplace.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		objform.action = "http://www.odisha360.com/marketplace/index.php?Categ=search&Keyword="+sKeyword;
		objform.submit;
		return true;
	}
}
function ypSearch()
{
	var objform    = $('frmYPSearch');
	var sKeyword   = $('frmYPSearch').txtSearch.value;
	if($('frmYPSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search yellow pages.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmYPSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search yellow pages.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		objform.action = "http://www.odisha360.com/yellow-pages/index.php?AoI=search&Keyword="+sKeyword;
		objform.submit;
		return true;
	}
}
function infopediaSearch()
{
	var objform    = $('frmInfopediaSearch');
	var sKeyword   = $('frmInfopediaSearch').txtSearch.value;
	if($('frmInfopediaSearch').txtSearch.value == '')
	{
		alert ('Please fill up to search infopedia.');
		objform.txtSearch.focus();
		return false;
	}
	else if($('frmInfopediaSearch').txtSearch.value.length < 3)
	{
		alert ('Please fill up atleast 3 characters to search infopedia.');
		objform.txtSearch.focus();
		return false;
	}
	else
	{
		objform.action = "http://www.odisha360.com/infopedia/index.php?CategId=search&Keyword="+sKeyword;
		objform.submit;
		return true;
	}
}
function openEditComment(iCount,iTotal)
{
	var sWallName = "editWall"+iCount;
	$('wall'+iCount).style.display="none";
	//$('editWall'+iCount).style.display="block";
	var sTextArea = "taComment"+iCount;
	for(var i=0;i<iTotal; i++)
	{
		if(i == iCount)
		{
			$('editWall'+iCount).style.display="block";
			$(sTextArea).focus();
		}
		else
		{
			$('editWall'+i).style.display="none";
			$('replyWall'+i).style.display="none";
			$('wall'+i).style.display="block";
		}
	}
}
function openReplyComment(iCount,iTotal)
{
	
	var sWallName = "replyWall"+iCount;
	var sTextArea = "taReplyToComment"+iCount;
	for(var i=0;i<iTotal; i++)
	{
		if(i == iCount)
		{
			$('replyWall'+iCount).style.display="block";
			$(sTextArea).focus();
		}
		else
		{
			$('editWall'+i).style.display="none";
			$('replyWall'+i).style.display="none";
			$('wall'+i).style.display="block";
		}
	}
}
function cancelReplyComments(iCount,iTotal)
{
	$('replyWall'+iCount).style.display="none";
}
function cancelEditComments(iCount,iTotal)
{
	$('editWall'+iCount).style.display="none";
	$('wall'+iCount).style.display="block";
}
function validatePublicComments(iCount,iUserId,iPostedId,iTypeId,iWallId,sSection)
{
	var sFormName = "frmComments"+iCount;
	var objform   = $(sFormName);
	var sTextArea = "taComment"+iCount;
	var sCommentText = $(sTextArea).value;
	if($(sTextArea).value == '')
	{
		alert('Please fill up the comments fields');
		$(sTextArea).focus();
		return false;
	}
	else if($(sTextArea).value.length > 140)
	{
		alert('Your comments should be within 140 characters.');
		$(sTextArea).focus();
		return false;
	}
	else
	{
		
		var postValues = encodeURIComponent(sCommentText)+'^'+ encodeURIComponent(iUserId)+'^'+ encodeURIComponent(iPostedId)+'^'+ encodeURIComponent(iTypeId)+'^'+ encodeURIComponent(iWallId)+'^'+ encodeURIComponent(iCount);
	    if(sSection == 'wallpost')
	    {
			var url = '../lib360/comments.rem.php';
		}
		else if(sSection == 'members')
	    {
			var url = '../lib360/comments.rem.php';
		}
		else
		{
			var url = './lib360/comments.rem.php';
		}
        makeRequestComments(url,postValues);
	}
}
function makeRequestComments(url, parameters) 
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) 
	{
	   url=url+"?query="+parameters;
	   url=url+"&sid="+Math.random();
	   xmlHttp.open("GET",url,true);
	   xmlHttp.onreadystatechange = updateComments; 
	   xmlHttp.send(null); 
	 }   
}

function updateComments() 
{	
	if (xmlHttp.readyState == 4) 
	{	 
	   sResponse = xmlHttp.responseText;
	   var aCommentArray  = new Array();
	   var aCommentArray  = sResponse.split(",");
	   var iCount         = aCommentArray[0];
	   var sWallPost      = aCommentArray[1];
	   $('wall'+iCount).style.display="block";
	   $('editWall'+iCount).style.display="none";
	   $('wall'+iCount).innerHTML = sWallPost; 	
	} 
}
function replyPublicComments(iCount,iUserId,iPostedId,iTypeId,iWallId,sSection)
{
	var sFormName = "frmReplyComments"+iCount;
	var objform   = $(sFormName);
	var sTextArea = "taReplyToComment"+iCount;
	var sCommentText = $(sTextArea).value;
	if($(sTextArea).value == '')
	{
		alert('Please fill up the comments fields');
		$(sTextArea).focus();
		return false;
	}
	else if($(sTextArea).value.length > 140)
	{
		alert('Your comments should be within 140 characters.');
		$(sTextArea).focus();
		return false;
	}
	else
	{
		var postValues = encodeURIComponent(sCommentText)+'^'+ encodeURIComponent(iUserId)+'^'+ encodeURIComponent(iWallId)+'^'+ encodeURIComponent(iCount);
	    if(sSection == 'wallpost')
	    {
			var url = '../lib360/reply-comments.rem.php';
		}
		else if(sSection == 'members')
	    {
			var url = '../lib360/reply-comments.rem.php';
		}
		else
		{
			var url = './lib360/reply-comments.rem.php';
		}
        makeRequestReplyComments(url,postValues);
	}
}
function makeRequestReplyComments(url, parameters) 
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) 
	{
	   url=url+"?query="+parameters;
	   url=url+"&sid="+Math.random();
	   xmlHttp.open("GET",url,true);
	   xmlHttp.onreadystatechange = addReplyComments; 
	   xmlHttp.send(null); 
	 }   
}

function addReplyComments() 
{	
	if (xmlHttp.readyState == 4) 
	{	 
	   sResponse = xmlHttp.responseText;
	   var aCommentArray  = new Array();
	   var aCommentArray  = sResponse.split(",");
	   var iCount         = aCommentArray[0];
	   var sWallPost      = aCommentArray[1];
	   var sFormName      = "frmComments"+iCount;
	   var objform        = $(sFormName);
	   $('wall'+iCount).style.display="block";
	   $('replyWall'+iCount).style.display="none";
	   $('wall'+iCount).innerHTML = sWallPost;
	   objform.action = "index.php";
	   objform.submit();
	   return true;
	} 
}

//My account Gender Display
function genderDisp(dispParam) 
{
	if(dispParam ==  1) $('gender').style.display = 'none';
	else if(dispParam ==  2) $('gender').style.display = 'block';
	
}

/* Method to open and close the overlay of the my360 advertisement section */
function openFundList(iIndex)
{
	sName = 'logPayment'+ iIndex;
	$(sName).style.display = "block";
}

function closeFundList(iIndex)
{
	sName = 'logPayment'+ iIndex;
	$(sName).style.display = "none";
}

function saveMemberProfile()
{
	var objform = $('frmUpdateProfile');
	var iMobNo  = $('txtMobile').value;
	if($('txtFirstName') && ($('txtFirstName').value == ''))
	{
		  alert ('Please fill up the First Name field.');
		  objform.txtFirstName.focus();
		  return false;
    }
    else if($('txtLastName') && ($('txtLastName').value == ''))
    {
		  alert ('Please fill up the Last Name field.');
		  objform.txtLastName.focus();
		  return false;
	}
	else if($('dmLocation') && ($('dmLocation').value == ''))
    {
		  alert ('Please select a City.');
		  objform.dmLocation.focus();
		  return false;
	}
	else if($('txtMobile') && $('txtMobile').value == '')
	{
		alert ('Please fill up Mobile field.');
		objform.txtMobile.focus();
		return false;
	}
	else if(($('txtMobile') && $('txtMobile').value != '') && (isNaN(iMobNo) || iMobNo.indexOf(" ")!=-1))
	{
		alert ('Please enter numeric values to Mobile field.');
		objform.txtMobile.focus();
		return false;
	}
	else if($('taAddress') && ($('taAddress').value == ''))
    {
		  alert ('Please fill up the Postal Address field.');
		  objform.taAddress.focus();
		  return false;
	}
	else if( !($('rbMale').checked) && !($('rbFemale').checked))
    {
	   alert ('Please specify your Gender.');
	   objform.rbMale.focus();
	   return false;
    }
    else
    {
        objform.submit();
    }
	
}
function showAdBanner()
{
	$iAdBannerType      = $('dmAdBannerType').value;
	if($iAdBannerType == 0)
	{
		$('displayFlash').style.display  = "none";
		$('displayImage').style.display  = "block";
	}
	else if($iAdBannerType == 1)
	{
		$('displayFlash').style.display  = "block";
		$('displayImage').style.display  = "none";
	}
	
}

function enlargeMemberPhoto(name, height, width, scrollbars, iPhotoId)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);
	new_window = window.open('http://www.odisha360.com/my360.php?ModuleParam=my-friends&EventParam=photo&PhotoId='+iPhotoId, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}

/* Method to validate the user inputs in the home page */
function submitMsg()
{
	$('errormessage').style.display = "block";
	var oForm        = $('frmContactUs');
	var sEmail       = $('frmContactUs').txtEmail.value;
	sCorrEmailVal    = validateEmail(sEmail);
    var nameMsg      = $('txtName').value;
    var emailMsg     = $('txtEmail').value;
    var telMsg       = $('txtPhone').value;
    var userContact  = $('hidContactEmail').value;
    var message      = $('taComments').value;
    var message      = nl2br_js(message);
    var securityCode = $('txtSecurity').value;

    if($('frmContactUs').txtName.value != "")
	{
		sErrFName = "";			
		$('txtName').style.borderWidth = "1px";
	  	$('txtName').style.borderColor = "#00CC00";
	  	$('txtName').style.borderStyle = "solid";			
	  	sErrFNameVal = '0';			 
	 }
	 if(($('frmContactUs').txtEmail.value != "") && (sCorrEmailVal == '1'))
	  {
		  sErrEmail = "";
		  $('txtEmail').style.borderWidth = "1px";
	      $('txtEmail').style.borderColor = "#00CC00";
	      $('txtEmail').style.borderStyle = "solid";
		  sErrEmailVal = '0';
	  } 
	  if($('frmContactUs').txtPhone.value != "")
	  {
		    sErrPhone = "";
			$('txtPhone').style.borderWidth = "1px";
		    $('txtPhone').style.borderColor = "#00CC00";
		    $('txtPhone').style.borderStyle = "solid";
			sErrPhoneVal = '0';
	  }
	  
	  if($('frmContactUs').txtName.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrFName = "<b>Error:</b> Please provide your Name.<br/>";
		  $('errormessage').innerHTML = sErrFName;
	      $('txtName').style.borderWidth 	= "1px";
	      $('txtName').style.borderColor 	= "red";
	      $('txtName').style.borderStyle 	= "solid";
	      var sErrFNameVal = '1';
		  oForm.txtName.focus();		  
	  }
	  else if($('frmContactUs').txtEmail.value == "")
	  {		  	  
		  $('errormessage').style.color 	= "red";
		  var sErrEmail = "<b>Error:</b> Please enter your Email Address.<br/>";
		  $('errormessage').innerHTML 		= sErrEmail;	  
	      $('txtEmail').style.borderWidth 	= "1px";
	      $('txtEmail').style.borderColor 	= "red";
	      $('txtEmail').style.borderStyle 	= "solid";
		  oForm.txtEmail.focus();
	  }
	  else if(($('frmContactUs').txtEmail.value != "") && (sCorrEmailVal == '0'))
	  {	   
		   $('errormessage').style.color 		= "red";
		   var sErrEmail1 = "<b>Error:</b> The Email should have correct format.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail1;
	       $('txtEmail').style.borderWidth 	= "1px";
	       $('txtEmail').style.borderColor 	= "red";
	       $('txtEmail').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
		   oForm.txtEmail.focus();
	  } 
	  else if($('frmContactUs').txtPhone.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrPassword = "<b>Error:</b> Please provide your Phone Number.<br/>";
		  $('errormessage').innerHTML = sErrPassword;
	      $('txtPhone').style.borderWidth 	= "1px";
	      $('txtPhone').style.borderColor 	= "red";
	      $('txtPhone').style.borderStyle 	= "solid";
	      sErrPasswordVal = '1';
		  oForm.txtPhone.focus();
	  }	  
	  else if($('frmContactUs').txtSecurity.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrSecCode = "<b>Error:</b> Please enter the security code.<br/>";
		  $('errormessage').innerHTML = sErrSecCode;
	      $('txtSecurity').style.borderWidth 	= "1px";
	      $('txtSecurity').style.borderColor 	= "red";
	      $('txtSecurity').style.borderStyle 	= "solid";
	      var sErrSecCodeVal = '1';
		  oForm.txtSecurity.focus();	  
	  }
	  else if($('txtSecurity').value != "")
  	  {
  	     var postValues = encodeURIComponent(nameMsg)+'^'+ encodeURIComponent(emailMsg)+'^'+ encodeURIComponent(telMsg)+'^'+encodeURIComponent(userContact)+'^'+encodeURIComponent(securityCode)+'^'+encodeURIComponent(message);
	     var url="./lib360/submit-msg.rem.php";
         makeRequestMsg(url,postValues);    
   	  }
}

// MAKE REQUEST CONTACT PAGE

function makeRequestMsg(url, parameters) { 
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateMsg; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

function updateMsg() {
	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) { 
	 if(xmlHttp.responseText == '<div>Error: The Security Code is incorrect.</div>')
	 {   
		 //Set the content of the DIV element with the response text
		   document.getElementById('errormessage').style.color = "red";
		   document.getElementById('errormessage').innerHTML = xmlHttp.responseText;
		   document.getElementById('txtSecurity').style.borderWidth = "1px";
		   document.getElementById('txtSecurity').style.borderColor = "red";
		   document.getElementById('txtSecurity').style.borderStyle = "solid";
		   //Get a reference to CAPTCHA image
		   img = document.getElementById('imgCaptcha'); 
		   //Change the image
		   img.src = './lib360/captcha.php?' + Math.random();			   
		      
	 }
	 else if(xmlHttp.responseText == '<div>Message sent.</div>')
	 {		 
	     //Set display of DIVs to none	
	     $('errormessage').style.color    = "#00CC00";  
	     $('errormessage').innerHTML      = "Your message has been sent successfully!";   
	     $('errormessage').style.fontSize = "12px";
	     $('submitForm').style.display    = "none";
		 //var oForm = eval($('frmContactUs'));
		 //oForm.submit();		 
	 }
	 else if(xmlHttp.responseText == '<div>Error sending Email.</div>')
	 {
		 $('errormessage').style.color = "red";
		 $('errormessage').innerHTML = xmlHttp.responseText;
     }    
 }
 
}

function showNewsTab()
{
	$('news').style.display = 'block';
	$('newstab').style.display = 'none';
	$('event').style.display = 'none';
	$('eventtab').style.display = 'block';
	$('classified').style.display = 'none';
	$('classifiedtab').style.display = 'block';
	$('classifiedtab').style.marginLeft = "9px";
	
	$('newsdiv').style.display = 'block';
	$('eventdiv').style.display = 'none';
	$('classifieddiv').style.display = 'none';
}
function showEventTab()
{
	$('eventtab').style.display = 'none';
	$('newstab').style.display = 'block';
	$('news').style.display = 'none';
	$('event').style.display = 'block';
	$('classified').style.display = 'none';
	$('classifiedtab').style.display = 'block';
	$('classifiedtab').style.marginLeft = "0px";
	$('newstab').style.marginRight = "0px";
	
	$('newsdiv').style.display = 'none';
	$('eventdiv').style.display = 'block';
	$('classifieddiv').style.display = 'none';
}
function showClassifiedTab()
{
	$('news').style.display = 'none';
	$('newstab').style.display = 'block';
	$('event').style.display = 'none';
	$('eventtab').style.display = 'block';
	$('classified').style.display = 'block';
	$('classifiedtab').style.display = 'none';
	$('classifiedtab').style.marginLeft = "0px";
	$('newstab').style.marginRight = "9px";
	
	$('newsdiv').style.display = 'none';
	$('eventdiv').style.display = 'none';
	$('classifieddiv').style.display = 'block';
}

function validateHomeEditWall(iCount,iUserId,iPostedId,iTypeId,iWallId,sWebsiteURL)
{
	var sFormName    = "frmComments"+iCount;
	var objform      = $(sFormName);
	var sTextArea    = "taComment"+iCount;
	var sCommentText = $(sTextArea).value;
	var sCommentText = nl2br_js(sCommentText);
	if($(sTextArea).value == '')
	{
		alert('Please fill up the comments fields');
		$(sTextArea).focus();
		return false;
	}
	else if($(sTextArea).value.length > 140)
	{
		alert('Your comments should be within 140 characters.');
		$(sTextArea).focus();
		return false;
	}
	else
	{
		//var postValues = encodeURIComponent(sCommentText)+'^'+ encodeURIComponent(iUserId)+'^'+ encodeURIComponent(iPostedId)+'^'+ encodeURIComponent(iTypeId)+'^'+ encodeURIComponent(iWallId)+'^'+ encodeURIComponent(iCount);
		var postValues = encodeURIComponent(iUserId)+'^'+ encodeURIComponent(iPostedId)+'^'+ encodeURIComponent(iTypeId)+'^'+encodeURIComponent(iWallId)+'^'+encodeURIComponent(iCount)+'^'+encodeURIComponent(sCommentText);
		var url = sWebsiteURL + '/lib360/edit-wall.rem.php';
		//var url = "./lib360/edit-wall.rem.php";
        makeRequestHomeEditWall(url,postValues);
	}
}

// MAKE REQUEST CONTACT PAGE

function makeRequestHomeEditWall(url, parameters) { 
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateHomeEditWall; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

function updateHomeEditWall() {
	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) { 
	 sResponse = xmlHttp.responseText;
	 sResponse1 = sResponse.substring(0,2);
	 if(sResponse1 == '1-')
	 {   
		 var iEnd      = sResponse.indexOf ("&");
		 var iCount    = sResponse.substring(2,iEnd);		   
		 var sWallPost = sResponse.substring(iEnd + 1);   
		 $('wall'+iCount).style.display     = "block";
		 $('editWall'+iCount).style.display = "none";
		 $('wall'+iCount).innerHTML         = sWallPost; 
	 }
	 else
	 {		 
	     //Set display of DIVs to none	
	       alert('You are not able to edit your wall post.');
	       var aCommentArray                  = new Array();
		   var aCommentArray                  = sResponse.split("&");
		   var iCount         			      = aCommentArray[0];
		   var sWallPost                      = aCommentArray[1];
		   $('wall'+iCount).style.display     = "block";
		   $('editWall'+iCount).style.display = "none";
		   $('wall'+iCount).innerHTML         = sWallPost; 	 
	 }	    
 } 
}

function validateHomeReplyWall(iCount,iUserId,iPostedId,iTypeId,iWallId,sWebsiteURL)
{
	var sFormName    = "frmReplyComments"+iCount;
	var objform      = $(sFormName);
	var sTextArea    = "taReplyToComment"+iCount;
	var sCommentText = $(sTextArea).value;
	var sCommentText = nl2br_js(sCommentText);
	if($(sTextArea).value == '')
	{
		alert('Please fill up the comments fields');
		$(sTextArea).focus();
		return false;
	}
	else if($(sTextArea).value.length > 140)
	{
		alert('Your comments should be within 140 characters.');
		$(sTextArea).focus();
		return false;
	}
	else
	{
		//var postValues = encodeURIComponent(sCommentText)+'^'+ encodeURIComponent(iUserId)+'^'+ encodeURIComponent(iPostedId)+'^'+ encodeURIComponent(iTypeId)+'^'+ encodeURIComponent(iWallId)+'^'+ encodeURIComponent(iCount);
		var postValues   = encodeURIComponent(iUserId)+'^'+ encodeURIComponent(iPostedId)+'^'+ encodeURIComponent(iTypeId)+'^'+encodeURIComponent(iWallId)+'^'+encodeURIComponent(iCount)+'^'+encodeURIComponent(sCommentText);
		var url          = sWebsiteURL + '/lib360/reply-wall.rem.php';
		//var url        = "./lib360/edit-wall.rem.php";
        makeRequestHomeReplyWall(url,postValues);
	}
}

// MAKE REQUEST CONTACT PAGE

function makeRequestHomeReplyWall(url, parameters) { 
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateHomeReplyWall; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

function updateHomeReplyWall() {
	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) { 
	 sResponse = xmlHttp.responseText;
	 sResponse1 = sResponse.substring(0,2);
	 if(sResponse1 == '1-')
	 {   
		 var iEnd      = sResponse.indexOf ("&");
		 var iCount    = sResponse.substring(2,iEnd);		   
		 var sWallPost = sResponse.substring(iEnd + 1);   
		 var sFormName      = "frmReplyComments"+iCount;
		 var objform        = $(sFormName);
		 $('wall'+iCount).style.display="block";
		 $('replyWall'+iCount).style.display="none";
		 objform.submit();
		 return true;	 
	 }
	 else
	 {		 
	     //Set display of DIVs to none	
	       alert('You are not able to edit your wall post.');
	       var aCommentArray  = new Array();
		   var aCommentArray  = sResponse.split(",");
		   var iCount         = aCommentArray[0];
		   var sWallPost      = aCommentArray[1];
		   var sFormName      = "frmReplyComments"+iCount;
		   var objform        = $(sFormName);
		   $('wall'+iCount).style.display="block";
		   $('replyWall'+iCount).style.display="none";
		   objform.submit();
		   return true;	 
	 }	    
 } 
}

function submitSettings()
{
	var objform = $('frmSettings');
	var count1 = 0;
	var k = document.getElementsByTagName('input');
	for(i=0;i<k.length;i++)
	{
		if(k[i].type == "checkbox")
		{
			if(k[i].checked == true)
			{
				count1++;
	        }
	    }
	}
	if($('txtBgClr1').value == '')
	{
		alert('Please select the General Background Colour.');
		objform.txtBgClr1.focus();
		return false;
	}
	else if($('txtBgClr2').value == '')
	{
		alert('Please select the Header Background Colour.');
		objform.txtBgClr2.focus();
		return false;
	}
	else if($('txtBgClr3').value == '')
	{
		alert('Please select the Header Font Colour.');
		objform.txtBgClr3.focus();
		return false;
	}
	else if($('txtBgClr4').value == '')
	{
		alert('Please select the Header Border Colour.');
		objform.txtBgClr4.focus();
		return false;
	}
	else if($('txtBgClr5').value == '')
	{
		alert('Please select the Header Link Colour.');
		objform.txtBgClr5.focus();
		return false;
	}
	 else if($('txtBgClr6').value == "")
	 {	 
		 alert('Please select the Body Background Colour.');
		  objform.txtBgClr6.focus();
		  return false;
	 }
	  else if($('txtBgClr7').value == "")
	  {
		    alert('Please select the Body Border Colour.');
		  	objform.txtBgClr7.focus();
		  	return false;
	  } 
	  else if($('txtBgClr8').value == "")
	  {
		  alert('Please select the Body Header Text Colour.');
		  objform.txtBgClr8.focus();
		  return false;
	  } 
	  else if($('txtBgClr9').value == "")
	  {
		  alert('Please select the Body Text Colour.');
		  objform.txtBgClr9.focus();
		  return false;
	  } 
	  else if($('txtBgClr10').value == "")
	  {
		  alert('Please select the Body Link Text Colour.');
		  objform.txtBgClr10.focus();
		  return false;
	  } 
	  else if(count1== 0)
	  {
	    	alert("Please select atleast one Menu Section for your Home Page.");
	    	$('frmSettings').chkMenu1.focus();
		    return false;
	  }
	  else if(($('chkMenu1').checked == true) && ($('txtMenu1').value == ""))
	  {
		    alert("Please provide the order of the Profile.");
	    	objform.txtMenu1.focus();
		    return false;
	  }
	  else if(($('chkMenu2').checked == true) && ($('txtMenu2').value == ""))
	  {
		    alert("Please provide the order of the News.");
	    	objform.txtMenu2.focus();
		    return false;
	  }
	  else if(($('chkMenu3').checked == true) && ($('txtMenu3').value == ""))
	  {
		    alert("Please provide the order of the Events.");
	    	objform.txtMenu3.focus();
		    return false;
	  }
	  else if(($('chkMenu4').checked == true) && ($('txtMenu4').value == ""))
	  {
		    alert("Please provide the order of the Classifieds.");
	    	objform.txtMenu4.focus();
		    return false;
	  }
	  else if(($('chkMenu5').checked == true) && ($('txtMenu5').value == ""))
	  {
		    alert("Please provide the order of the Products.");
	    	objform.txtMenu5.focus();
		    return false;
	  }
	  else if(($('chkMenu6').checked == true) && ($('txtMenu6').value == ""))
	  {
		    alert("Please provide the order of the Wall.");
	    	objform.txtMenu6.focus();
		    return false;
	  }
	  else if(($('chkMenu7').checked == true) && ($('txtMenu7').value == ""))
	  {
		    alert("Please provide the order of the Network.");
	    	objform.txtMenu7.focus();
		    return false;
	  }
	  else
	  {
			objform.action = "my360.php?ModuleParam=website-setting";
			objform.submit();
	  }
}

function sectionwiseSearch(formName,divName)
{
	$(divName).style.display = 'block';
	var iSectionType = $(formName).dmSection.selectedIndex;
	var sSectionName = $(formName).dmSection.value;
 	if(iSectionType == 1)
 	{
	 	getNewsSearch(formName,divName,1);
 	}
 	if(iSectionType == 2)
 	{
	 	getEventsSearch(formName,divName,2);
 	}
 	if(iSectionType == 3)
 	{
	 	getYellowPageSearch(formName,divName,3);
 	}
 	if(iSectionType == 4)
 	{
	 	getClassifiedSearch(formName,divName,4);
 	}
 	if(iSectionType == 5)
 	{
	 	getMarketplaceSearch(formName,divName,5);
 	}
 	if(iSectionType == 6)
 	{
	 	getMemberSearch(formName,divName,6);
 	}
 	if(iSectionType == 7)
 	{
	 	getInfopediaSearch(formName,divName,7);
 	}
 	if(iSectionType == 0)
 	{
	 	getHomeSearch(formName,divName,0);
 	}
}
function getNewsSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
 	$('newsSearch').style.display = 'block';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'none';
 	//var iSectionType = $("dmSection").selectedIndex;
 	var sSectionName = $("dmSection").value;
 	$("frmNewsSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getEventsSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'block';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'none';
 	var sSectionName = $("dmSection").value;
 	$("frmEventSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getHomeSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'block';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'none';
 	var sSectionName = $("dmSection").value;
 	$("frmSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getYellowPageSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'block';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'none';
 	var sSectionName = $("dmSection").value;
 	$("frmYPSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getClassifiedSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'block';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'none';
 	var sSectionName = $("dmSection").value;
 	$("frmClassifiedSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getMarketplaceSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'block';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'none';
 	var sSectionName = $("dmSection").value;
 	$("frmMPSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getMemberSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'block';
	$('infopediaSearch').style.display = 'none';
 	var sSectionName = $("dmSection").value;
 	$("frmMemberSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function getInfopediaSearch(formName,divName,iSectionType)
{
	$('homeSearch').style.display = 'none';
	$('newsSearch').style.display = 'none';
 	$('eventSearch').style.display = 'none';
 	$('ypSearch').style.display = 'none';
	$('classifiedSearch').style.display = 'none';
	$('marketplaceSearch').style.display = 'none';
	$('memberSearch').style.display = 'none';
	$('infopediaSearch').style.display = 'block';
 	var sSectionName = $("dmSection").value;
 	$("frmInfopediaSearch").dmSection.selectedIndex = iSectionType;
 	return true;
}
function showPhotoInHomePage(sMediumPhoto,photoTitle,iPhotoId,SlugUrl)
{
	$('mediumphoto').src = sMediumPhoto;
	$('nextPhoto').style.display = 'block';
	$('nextPhoto').innerHTML = photoTitle+'&nbsp;(<a href="../photos/photo.php?PhotoId='+iPhotoId+'&Slug='+SlugUrl+'">+ Enlarge</a>)';
	$('firstPhoto').style.display = 'none';
}

/* Method to validate the adbanner link url */
function validateLinkURL(sLinkURL)
{
    iValidUrl = sLinkURL.indexOf("http://");
	return iValidUrl;
}


/* FORM VALIDATION FOR MY ACCOUNT SECTION */
function saveandFillProfile(isIndividual)
{
	var objform = $('formBasicProfile');
	var iMobNo  = $('txtMobile').value;
	if($('txtFirstname').value == '')
	{
		alert ('Please provide your Firstname.');
		objform.txtFirstname.focus();
		return false;
	}
	else if($('txtLastname').value == '')
	{
		alert ('Please provide your Lastname.');
		objform.txtLastname.focus();
		return false;
	}
	else if($('dmCity').value == '')
	{
		alert ('Please select City field.');
		objform.dmCity.focus();
		return false;
	}
	else if($('txtMobile').value == '')
	{
		alert ('Please fill up Mobile field.');
		objform.txtMobile.focus();
		return false;
	}
	else if(isNaN(iMobNo) || iMobNo.indexOf(" ")!=-1)
	{
		alert ('Please enter numeric values to Mobile field.');
	}
	else if($('taAddress').value == '')
	{
		alert ('Please fill up Postal Address field.');
		objform.taAddress.focus();
		return false;
	}
	 else if($('dmDay').value == "")
	 {	 
		  alert ('Please provide the day of your birth.');
		  objform.dmDay.focus();
		  return false;
	 }
	  else if($('dmMonth').value == "")
	  {
		    alert ('Please provide the month of your birth.');
		  	objform.dmMonth.focus();
		  	return false;
	  } 
	  else if($('dmYear').value == "")
	  {
		  alert ('Please provide the year of your birth.');
		  objform.dmYear.focus();
		  return false;
	  } 
	 else if(isIndividual == '2' && (!($('rbMale').checked) && !($('rbFemale').checked)))
	  {
		 alert ('Please specify your Gender.');
		 objform.rbMale.focus();
		 return false;		 
	  }
	  else
	  {		  
			objform.action = "my360.php?ModuleParam=account&EventParam=add&Action=basicprofile&RedirectProfile=1";
			objform.submit();
	  }
}

function addAdFund()
{
	 var objform  = $('frmPay');
	 if($('dmAmount').value == "")
	 {	 
		  alert ('Please select an amount.');
		  objform.dmAmount.focus();
		  return false;
	 }
	 else
	 {
		var selIndex        = objform.dmAmount.selectedIndex;
	    iAmount             = objform.dmAmount.options[selIndex].value;
	    $('hidPrice').value = iAmount;
	    objform.submit();
	 }
}


/* Method to validate the user inputs in the home page */
function submitYPMsg()
{
	$('errormessage').style.display = "block";
	var oForm        = $('frmContactUs');
	var sEmail       = $('frmContactUs').txtEmail.value;
	sCorrEmailVal    = validateEmail(sEmail);
    var nameMsg      = $('txtName').value;
    var emailMsg     = $('txtEmail').value;
    var telMsg       = $('txtPhone').value;
    var userContact  = $('hidContactEmail').value;
    var message      = $('taComments').value;
    var message      = nl2br_js(message);
    var securityCode = $('txtSecurity').value;

    if($('frmContactUs').txtName.value != "")
	{
		sErrFName = "";			
		$('txtName').style.borderWidth = "1px";
	  	$('txtName').style.borderColor = "#00CC00";
	  	$('txtName').style.borderStyle = "solid";			
	  	sErrFNameVal = '0';			 
	 }
	 if(($('frmContactUs').txtEmail.value != "") && (sCorrEmailVal == '1'))
	  {
		  sErrEmail = "";
		  $('txtEmail').style.borderWidth = "1px";
	      $('txtEmail').style.borderColor = "#00CC00";
	      $('txtEmail').style.borderStyle = "solid";
		  sErrEmailVal = '0';
	  } 
	  if($('frmContactUs').txtPhone.value != "")
	  {
		    sErrPhone = "";
			$('txtPhone').style.borderWidth = "1px";
		    $('txtPhone').style.borderColor = "#00CC00";
		    $('txtPhone').style.borderStyle = "solid";
			sErrPhoneVal = '0';
	  }
	  
	  if($('frmContactUs').txtName.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrFName = "<b>Error:</b> Please provide your Name.<br/>";
		  $('errormessage').innerHTML = sErrFName;
	      $('txtName').style.borderWidth 	= "1px";
	      $('txtName').style.borderColor 	= "red";
	      $('txtName').style.borderStyle 	= "solid";
	      var sErrFNameVal = '1';
		  oForm.txtName.focus();		  
	  }
	  else if($('frmContactUs').txtEmail.value == "")
	  {		  	  
		  $('errormessage').style.color 	= "red";
		  var sErrEmail = "<b>Error:</b> Please enter your Email Address.<br/>";
		  $('errormessage').innerHTML 		= sErrEmail;	  
	      $('txtEmail').style.borderWidth 	= "1px";
	      $('txtEmail').style.borderColor 	= "red";
	      $('txtEmail').style.borderStyle 	= "solid";
		  oForm.txtEmail.focus();
	  }
	  else if(($('frmContactUs').txtEmail.value != "") && (sCorrEmailVal == '0'))
	  {	   
		   $('errormessage').style.color 		= "red";
		   var sErrEmail1 = "<b>Error:</b> The Email should have correct format.<br/>";
		   $('errormessage').innerHTML 		= sErrEmail1;
	       $('txtEmail').style.borderWidth 	= "1px";
	       $('txtEmail').style.borderColor 	= "red";
	       $('txtEmail').style.borderStyle 	= "solid";
	       var sCorrEmailVal = '0';
		   oForm.txtEmail.focus();
	  } 
	  else if($('frmContactUs').txtPhone.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrPassword = "<b>Error:</b> Please provide your Phone Number.<br/>";
		  $('errormessage').innerHTML = sErrPassword;
	      $('txtPhone').style.borderWidth 	= "1px";
	      $('txtPhone').style.borderColor 	= "red";
	      $('txtPhone').style.borderStyle 	= "solid";
	      sErrPasswordVal = '1';
		  oForm.txtPhone.focus();
	  }	  
	  else if($('frmContactUs').txtSecurity.value == "")
	  {	 
		  $('errormessage').style.color 		= "red";
		  var sErrSecCode = "<b>Error:</b> Please enter the security code.<br/>";
		  $('errormessage').innerHTML = sErrSecCode;
	      $('txtSecurity').style.borderWidth 	= "1px";
	      $('txtSecurity').style.borderColor 	= "red";
	      $('txtSecurity').style.borderStyle 	= "solid";
	      var sErrSecCodeVal = '1';
		  oForm.txtSecurity.focus();	  
	  }
	  else if($('txtSecurity').value != "")
  	  {
  	     var postValues = encodeURIComponent(nameMsg)+'^'+ encodeURIComponent(emailMsg)+'^'+ encodeURIComponent(telMsg)+'^'+encodeURIComponent(userContact)+'^'+encodeURIComponent(securityCode)+'^'+encodeURIComponent(message);
	     var url="../lib360/submit-msg.rem.php";
	     makeRequestYPMsg(url,postValues);    
   	  }
}

//MAKE REQUEST CONTACT PAGE

function makeRequestYPMsg(url, parameters) { 
//If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateYPMsg; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

function updateYPMsg() {
	
 //Check if our response is ready
 if (xmlHttp.readyState == 4) { 
	 if(xmlHttp.responseText == '<div>Error: The Security Code is incorrect.</div>')
	 {   
		 //Set the content of the DIV element with the response text
		   document.getElementById('errormessage').style.color = "red";
		   document.getElementById('errormessage').innerHTML = xmlHttp.responseText;
		   document.getElementById('txtSecurity').style.borderWidth = "1px";
		   document.getElementById('txtSecurity').style.borderColor = "red";
		   document.getElementById('txtSecurity').style.borderStyle = "solid";
		   //Get a reference to CAPTCHA image
		   img = document.getElementById('imgCaptcha'); 
		   //Change the image
		   img.src = '../lib360/captcha.php?' + Math.random();			   
		      
	 }
	 else if(xmlHttp.responseText == '<div>Message sent.</div>')
	 {		 
	     //Set display of DIVs to none	
	     $('errormessage').style.color    = "#00CC00";  
	     $('errormessage').innerHTML      = "Your message has been sent successfully!";   
	     $('errormessage').style.fontSize = "12px";
	     $('submitForm').style.display    = "none";
		 //var oForm = eval($('frmContactUs'));
		 //oForm.submit();		 
	 }
	 else if(xmlHttp.responseText == '<div>Error sending Email.</div>')
	 {
		 $('errormessage').style.color = "red";
		 $('errormessage').innerHTML = xmlHttp.responseText;
     }    
 }
 
}

function loadFlash(iBannerId,sWebsiteUrl)
{
var sFlowPlayer  = sWebsiteUrl+'/ext360/flowplayer-3.1.5.swf'; 
var sLink        = sWebsiteUrl+'/ad-click.php?AdId='+iBannerId;
flowplayer("player", sFlowPlayer, { 
	        play: null,
	        plugins: { 
             controls: null
           } 
           ,clip: { 
                linkUrl: sLink
            }
        });  
}

/*************AD func*************/
function getPriceSizeWise()
{
	var oForm = $('frmAddAdvertisements');
	var sAdBannerSize = oForm.dmAdBannerSize.value;
	var url     = './user360/app/display-price.rem.php';
	//Set up the parameters of our AJAX call
	var postStr = encodeURIComponent(sAdBannerSize);
	//Call the function that initiate the AJAX request
	makeRequestAdBanner(url, postStr);     
   	
}

//Check Username Exists
function makeRequestAdBanner(url, parameters) 
{
 //If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;
   url=url+"&sid="+Math.random();
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updatePrice; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updatePrice() {
 //Check if our response is ready
 if (xmlHttp.readyState == 4) 
 {	 
 	 sResponse  = xmlHttp.responseText;
	 sResponse1 = sResponse.substring(0,2);
 	 if (sResponse1 == '1-')
	 {  		
		 var iSecondEnd         = sResponse.indexOf ("&");
		 var fPayPerView        = sResponse.substring(2,iSecondEnd);
		 var fPayPerClick       = sResponse.substring(iSecondEnd + 1);
		 if(fPayPerView !=''){
		 var fPayPerViewAmount  = 'Rs.'+fPayPerView;
	     }
	     else
	     {
		     var fPayPerViewAmount  = 'Rs. 0.00';
	     }
		 if(fPayPerClick !=''){
		 var fPayPerClickAmount = 'Rs.'+fPayPerClick;
	     }
	     else
	     {
		     var fPayPerClickAmount  = 'Rs. 0.00';
	     }
		 /* Display payperiew and payperclick prices*/
		//Set the content of the DIV element with the response text
		$('payPerView').innerHTML = fPayPerViewAmount;
		$('payPerClick').innerHTML = fPayPerClickAmount;
		$('payadinfo').style.display  = "block";
		$('payperad').style.display  = "block";
 	 } 
 } 
}

function submitAdd()
{
	var oForm = $('frmAdd');	
    if($('frmAdd').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
    else if($('txtTitle').value.length > 120)
	{
		alert ('Title field should be 120 character of length.');
		oForm.txtTitle.focus();
		return false;
	}	
	else if($('frmAdd').taDescription.value == '')
	{
		alert ('Please fill up the Story field.');
		oForm.taDescription.focus();
		return false;
	}	
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=go-green&EventParam=add&Action=submit";
		oForm.submit();
	}
}

function  editSubmit(iGreenId)
{
	var oForm = $('frmEdit');	
    if($('frmEdit').txtTitle.value == '')
	{
		alert ('Please fill up the Title field.');
		oForm.txtTitle.focus();
		return false;
	}
	else if($('txtTitle').value.length > 120)
	{
		alert ('Title field should be 120 character of length.');
		oForm.txtTitle.focus();
		return false;
	}	
	else if($('frmEdit').taDescription.value == '')
	{
		alert ('Please fill up the Story field.');
		oForm.taDescription.focus();
		return false;
	}    
	else
	{
	   	document.frmEdit.action = "my360.php?ModuleParam=go-green&EventParam=edit&Action=submit&GreenId="+iGreenId;
		oForm.submit();
	}
}

function submitAddFeedback()
{
	var oForm = $('frmAdd');	
    if($('frmAdd').taFeedback.value == '')
	{
    	alert ('Please provide the Feedback.');
		oForm.taFeedback.focus();
		return false;
	}
    
	else if($('frmAdd').txtCompany.value == '')
	{
		alert ('Please provide the Company Name.');
		oForm.txtCompany.focus();
		return false;
	}	
	else
	{
	   	document.frmAdd.action = "my360.php?ModuleParam=my-feedback&EventParam=add&Action=submit";
		oForm.submit();
	}
}

function editFeedback(iFeedbackId)
{
	var oForm = $('frmEdit');	
	if($('frmEdit').taFeedback.value == '')
	{
    	alert ('Please provide the Feedback.');
		oForm.taFeedback.focus();
		return false;
	}
    
	else if($('frmEdit').txtCompany.value == '')
	{
		alert ('Please provide the Company Name.');
		oForm.txtCompany.focus();
		return false;
	}	
	else
	{
	   	document.frmEdit.action = "my360.php?ModuleParam=my-feedback&EventParam=edit&Action=submit&FeedbackId="+iFeedbackId;
		oForm.submit();
	}
}

