<!--hide this script from non-javascript-enabled browsers 
/*
####################################     
# File Name: user.js
# Created By: P.Kumaresan
# Created On: April 07 ,2009
# Updated By: P.Kumaresan
# This file contain all the user side javascript functions
####################################
*/

/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;
var returnVal='';

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;
}

function stripCharsInBag(s, bag){
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
    // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
    for (var i = 1; i <= n; i++) {
        this[i] = 31
        if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
        if (i==2) {this[i] = 29}
   } 
   return this
}

function addslashes( str ) {
    // Escapes single quote, double quotes and backslash characters in a string with backslashes  
    // 
    // version: 810.114
    // discuss at: http://phpjs.org/functions/addslashes
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ates Goral (http://magnetiq.com)
    // +   improved by: marrtins
    // +   improved by: Nate
    // +   improved by: Onno Marsman
    // *     example 1: addslashes("kevin's birthday");
    // *     returns 1: 'kevin\'s birthday'
 
    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}

function isDate(dtStr){
    var daysInMonth = DaysArray(12)
    var pos1=dtStr.indexOf(dtCh)
    var pos2=dtStr.indexOf(dtCh,pos1+1)
    var strMonth=dtStr.substring(0,pos1)
    var strDay=dtStr.substring(pos1+1,pos2)
    var strYear=dtStr.substring(pos2+1)
    strYr=strYear
    if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
    if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
    for (var i = 1; i <= 3; i++) {
        if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
    }
    month=parseInt(strMonth)
    day=parseInt(strDay)
    year=parseInt(strYr)
    if (pos1==-1 || pos2==-1){
      
        return false
    }
    if (strMonth.length<1 || month<1 || month>12){
       
        return false
    }
    if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
        
        return false
    }
    if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
     
        return false
    }
    if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
       
        return false
    }
return true
}
function fncCheckUserName(){
    d = document.frmUserInfo; 
    txtUserName = d.txtUserName.value;   
   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?txtUserName="+txtUserName;  

   xmlHttp.onreadystatechange= fnCheckUserName;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);    
}

 function fnCheckUserName(){
     if (xmlHttp.readyState==4)
   { 
     typeValue = Trim(xmlHttp.responseText).split('@@@');     
        recCount     = typeValue[0]     
        username     = typeValue[1]          
     
     if(recCount<=0){ 
     document.getElementById('partDivRed').innerHTML ='';                                                               
        document.getElementById('partDivGreen').innerHTML= username +" is available.  Click the SAVE button to select "+username+".";                                           
     }
     else{
     document.getElementById('partDivGreen').innerHTML ='';
       document.getElementById('partDivRed').innerHTML= username +" is not available.  Please try again.";                                                
     }                                          
   }  
 
 }

 function fnChkUserName(username){

	txtUserName = username;   
	document.getElementById('partDivGreen').innerHTML ='loading..';
   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?txtUserName="+txtUserName;  

   xmlHttp.onreadystatechange= fnChkUser;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);    
}

 function fnChkUser(){
     if (xmlHttp.readyState==4)
   { 
     typeValue = Trim(xmlHttp.responseText).split('@@@');     
        recCount     = typeValue[0]     
        username     = typeValue[1]          
     
     if(recCount<=0){ 
     document.getElementById('partDivRed').innerHTML ='';
	 document.getElementById('strUserName').value =1;
        document.getElementById('partDivGreen').innerHTML= username +" is available.";                                           
     }
     else{
     document.getElementById('partDivGreen').innerHTML ='';
	 document.getElementById('strUserName').value ='No';
	 document.getElementById('partDivRed').innerHTML= username +" is not available." ;                                                
     }                                          
   }  
 
 }


 function fnSaveAboutUs(businessId){

	 document.getElementById('currentClick').value ='aboutUs';

	var oEditor = FCKeditorAPI.GetInstance('about_us') ;

	txtAboutUs = oEditor.GetXHTML( true );  
	document.getElementById('about_us').value = txtAboutUs; 

	// All the fields we are serializing using jquery.
	var params = $('#businessProfilePage').serialize(true);	

	//txtAboutUs = txtAboutUs.replace("/&/g"," ");

	document.getElementById('showLoading').innerHTML ='loading..';
   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
  //var params = "txtAboutUs="+txtAboutUs+"&bid="+businessId; 

   xmlHttp.onreadystatechange= saveAboutUs;    
   xmlHttp.open("POST",url,true);
   xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   xmlHttp.setRequestHeader("Content-length", params.length);
   xmlHttp.setRequestHeader("Connection", "close");
   xmlHttp.send(params);    
}

function saveAboutUs(){
    if (xmlHttp.readyState==4)
   { 
		document.getElementById('showLoading').innerHTML ='About Us Updated.';	
		document.getElementById('aboutUsText').innerHTML = xmlHttp.responseText;
   }                                          
 
}



 function fnSaveHours(businessId){
	 document.getElementById('currentClick').value ='saveHours';

	// All the fields we are serializing using jquery.
	var params = $('#businessProfilePage').serialize(true);	


	document.getElementById('showLoadingHours').innerHTML ='loading..';
   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
  //var params = "txtAboutUs="+txtAboutUs+"&bid="+businessId; 

   xmlHttp.onreadystatechange= saveHours;    
   xmlHttp.open("POST",url,true);
   xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   xmlHttp.setRequestHeader("Content-length", params.length);
   xmlHttp.setRequestHeader("Connection", "close");
   xmlHttp.send(params);    
}

function saveHours(){
    if (xmlHttp.readyState==4)
   { 
		document.getElementById('showLoadingHours').innerHTML ='Hours of Operation Updated.';	
		document.getElementById('HoursText').innerHTML = xmlHttp.responseText;
   }                                          
 
}



 function fnSaveBusinessContact(businessId){

	document.getElementById('currentClick').value ='saveContacts';
	document.getElementById('showLoadingContact').innerHTML ='loading..';
	d = document.businessProfilePage; 
	 var msg ='';         
	 if( Trim(d.phone1.value)=='' || Trim(d.phone2.value)=='' || Trim(d.phone3.value)==''  ){ 
        msg =msg+"<li>Contact phone is Required."+"</li>"  ; 
   }
   if(Trim(d.phone1.value) !='' && Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="" ){       
        if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4  )
        {
                msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;   
        }
        if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value) )
        {
           msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;  
        }   
   }
   if(Trim(d.txtEmail.value) !=''){
     if(!isValidEmail(d.txtEmail.value)){                          
           msg =msg+"<li>Invalid Email Address."+"</li>"  ;     
     }  
   }     
   if(Trim(d.txtUrl.value) !=''){
       if(urlValidation(d.txtUrl.value)==false){
           msg =msg+"<li>Invalid Web Site URL ."+"</li>"  ;   
       
       }
   } 
    if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>"  
        scroll(0,300);  
        document.getElementById("showLoadingContact").innerHTML=msg;
        return false;
   }

		
	// All the fields we are serializing using jquery.
	var params = $('#businessProfilePage').serialize(true);	

   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
  //var params = "txtAboutUs="+txtAboutUs+"&bid="+businessId; 

   xmlHttp.onreadystatechange= saveBusinessContact;    
   xmlHttp.open("POST",url,true);
   xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   xmlHttp.setRequestHeader("Content-length", params.length);
   xmlHttp.setRequestHeader("Connection", "close");
   xmlHttp.send(params);    
}

function saveBusinessContact(){
    if (xmlHttp.readyState==4)
   { 
		document.getElementById('showLoadingContact').innerHTML ='Updated.';	
		 var result = Trim(xmlHttp.responseText);
		res     = result.split('-@@@-');
		phoneNo = res[0].replace(/^\s*|\s*$/g,'');
        document.getElementById('businessPhone').innerHTML =phoneNo;  
		document.getElementById('businessPhone2').innerHTML =phoneNo;
		document.getElementById('businessWebSite').innerHTML ='<a href="'+res[2]+'" target="_blank">'+res[2]+'</a>';  
		document.getElementById('businessEmail').innerHTML =res[1];  
   }                                          
 
}


 
 function fncStoreFacebookID(faceBookUserId){
          
   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?faceBookUserId="+faceBookUserId;  

   xmlHttp.onreadystatechange= fncAssignStoreFacebookID;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
 }
 function fncAssignStoreFacebookID(){
   if (xmlHttp.readyState==4)
   {   
     // window.location.href='fbConnection.php';  
	  window.location.href='social_connect.php';  
   }   
 } 
 
 

 function fnEventParticipation(eventPartId,parTtype){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?eventPartId="+eventPartId+"&parTtype="+parTtype;          
   xmlHttp.onreadystatechange= fnAssgnEventParticipation;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);      
 }
 
 function fnAssgnEventParticipation(){
   if (xmlHttp.readyState==4)
   {    
     if(Trim(xmlHttp.responseText)=='1'){                                                                
        document.getElementById('partDiv').innerHTML= "Your willingness has been sent successfully.<br>";                                           
     }
     else{
       document.getElementById('partDiv').innerHTML= "Error Occurred.<br>";                                                
     }                                          
   }   
 } 

function fncFilterClassified(cid,fname){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?visClassfiedId="+cid+"&visClassifiedFile="+fname;          
   xmlHttp.onreadystatechange= assignFilterClassified;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);
    
}
 function assignFilterClassified(){
   if (xmlHttp.readyState==4)
   {    
     if(Trim(xmlHttp.responseText)!=''){   
             var result = Trim(xmlHttp.responseText)
             window.location.href=result;  
     }   
   } 
 }

function fnEventDetails(eventid, urlEventView){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?eventId="+eventid+"&urlEventView="+urlEventView;          
   xmlHttp.onreadystatechange= fnViewEventDetails;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);
}
 function fnViewEventDetails(){
    if (xmlHttp.readyState==4)
   {    
     if(Trim(xmlHttp.responseText)!=''){   
             var result = Trim(xmlHttp.responseText)
             window.location.href=result;  
     }   
   }   
 }  
 
  function fnBecomeFollower(followBusinessid)   {   
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?followBusinessid="+followBusinessid;       
   xmlHttp.onreadystatechange= fnAssignBecomeFollower;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);   
  }
  
function fnAssignBecomeFollower(){
    if (xmlHttp.readyState==4)
    {      
        
        typeValue = Trim(xmlHttp.responseText).split('@@@');     
        busid     = typeValue[0]     
        conid     = typeValue[1]     

        sid ="spn"+busid; 
        if(conid>0)                  
            document.getElementById(sid).innerHTML ='Submitted Successfully!' ;          
        else if(conid == -1 )
            document.getElementById(sid).innerHTML ='You are already follower for this business!' ;                           
        else if(conid ==0 )
              document.getElementById(sid).innerHTML ='Error Occurred!' ;     
   }   
 } 
  
  

 function viewEvent(eDate,calenUrl){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?eventDate="+eDate+"&calenUrl="+calenUrl;       
   xmlHttp.onreadystatechange= fnViewEvent;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
 
 }
 function fnViewEvent(){
    if (xmlHttp.readyState==4)
   {    
     if(Trim(xmlHttp.responseText)!=''){   
             var result = Trim(xmlHttp.responseText)
             window.location.href=result;  
     }   
   }   
 }  
function clickThruCount(adid,banurl){    
   
    xmlHttp=GetXmlHttpObject();     
    if (xmlHttp==null)
    {
      alert("Your browser does not support AJAX!");
      return;
    } 
    var url="ajax_member.php";
    url=url+"?bannerAdId="+adid+'&banUrl='+banurl;
    

    xmlHttp.onreadystatechange= openInNewTab;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
    

   // window.open(url, "_blank");

}

 function openInNewTab(){
    if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){    
             window.open(Trim(xmlHttp.responseText), '_blank'); 
         }   
   }   
 }  

function fnVisitorSelectBusinessThruClick (adid,businessId){

    xmlHttp=GetXmlHttpObject();     
    if (xmlHttp==null)
    {
      alert("Your browser does not support AJAX!");
      return;
    } 
    var url="ajax_member.php";
    url=url+"?visbannerselected_busid="+businessId+'&banAdId='+adid;

    xmlHttp.onreadystatechange= selectBannerBusiness;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  
}


function selectBannerBusiness() 
{  
    if (xmlHttp.readyState==4)
    {               
       //window.location.href=Trim(xmlHttp.responseText);  
       window.open(Trim(xmlHttp.responseText), '_blank');      
    }

}  
 


function fnStatusCommentDelete(statusCommentId,placeId){

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?statusCommentId="+statusCommentId+"&placeId="+placeId;
   
   xmlHttp.onreadystatechange= fnStatusCommentDeleteResponse;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}



function fnStatusCommentDelete1(commentId){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?statusCommentIdfresh="+commentId;
   
   xmlHttp.onreadystatechange= fnStatusCommentDeleteResponse1;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
}




 function fnStatusCommentDeleteResponse(){
    if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){
			  myValue = xmlHttp.responseText;
			 myValue = myValue.replace(/^\s*|\s*$/g,'');
            commentId  =  "statusCommentInner"+myValue;      
     
            document.getElementById(commentId).innerHTML= "<p align='center' />Deleted Successfully!</p>";               
       
         }   
   }   
 }  
 function fnStatusCommentDeleteResponse1(){
   if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){
            commentId  =  "commentDiv"+Trim(xmlHttp.responseText);           
            document.getElementById(commentId).innerHTML= "<p align='center' />Deleted Successfully!</p>";     
         }   
   }   
 }  
 
 function changeMonth(calMonth,calYear){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?calMonth="+calMonth+"&calYear="+calYear;
   
   xmlHttp.onreadystatechange= assignChangeMonth;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);  
 }
 
 function  assignChangeMonth(){
 if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){                    
            document.getElementById('calDiv').innerHTML= Trim(xmlHttp.responseText);  
         }   
   }   
 }  
     
function fnLinkCommentDelete(linkCommentId,placeId){   
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?linkCommentId="+linkCommentId+"&linkplaceId="+placeId;
   
   xmlHttp.onreadystatechange= fnLinkCommentDeleteResponse;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);  
} 
function fnLinkCommentDelete1(commentId){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?linkCommentIdfresh="+commentId;
   
   xmlHttp.onreadystatechange= fnLinkCommentDeleteResponse1;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
}   
 function fnLinkCommentDeleteResponse(){
    if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){
			 pid = xmlHttp.responseText;
			pid = pid.replace(/^\s+|\s+$/g,"");
            commentId  =  "linkCommentInner"+pid;      
			
            document.getElementById(commentId).innerHTML= "<p align='center' />Deleted Successfully!</p>";               
       
         }   
   }   
 }  
 function fnLinkCommentDeleteResponse1(){
   if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){
			  pid = xmlHttp.responseText;
			pid = pid.replace(/^\s+|\s+$/g,"");
            commentId  =  "commentDiv"+pid;           
            document.getElementById(commentId).innerHTML= "<p align='center' >Deleted Successfully!</p>";     
         }   
   }   
 }  
 
        
 
 
function fnPhotoCommentDelete(photoCommentId,placeId,tblName){   
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?photoCommentId="+photoCommentId+"&photoplaceId="+placeId+'&tblName='+tblName;
   
   xmlHttp.onreadystatechange= fnPhotoCommentDeleteResponse;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);  
} 
function fnPhotoCommentDelete1(commentId,tblName){


    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?photoCommentIdfresh="+commentId+'&tblName='+tblName; 
   
   xmlHttp.onreadystatechange= fnPhotoCommentDeleteResponse1;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
}   
 function fnPhotoCommentDeleteResponse(){
    if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){
			pid = xmlHttp.responseText;
			pid = pid.replace(/^\s+|\s+$/g,"");
          commentId  =  "photoCommentInner"+pid;           
           document.getElementById(commentId).innerHTML= "<p align='center' >Deleted Successfully!</p>";                      
         }   
   }   
 }  
 function fnPhotoCommentDeleteResponse1(){
   if (xmlHttp.readyState==4)
   {    
         if(Trim(xmlHttp.responseText)!=''){
			 pid = xmlHttp.responseText;
			pid = pid.replace(/^\s+|\s+$/g,"");
            commentId  =  "commentDiv"+pid;     
            document.getElementById(commentId).innerHTML= "<p align='center' >Deleted Successfully!</p>";     
         }   
   }   
 }  
 
  function fnTerm(){
    if(document.getElementById('chkTerm').checked==true) 
       document.getElementById('txtTerm').value = 1;
    else if (document.getElementById('chkTerm').checked==false)
       document.getElementById('txtTerm').value = '';        
  }
  
   function fncNotification()
   {
        totalCount = document.getElementById('txtTotalSelect').value;
   
       if(document.getElementById('sall').checked){
            for(i=1;i<=totalCount;i++){
                chkid = 'chk'+i
                document.getElementById(chkid).checked=true;
                document.getElementById('txtTotal').value=8;
                
                
            }
       }       
       else 
          for(i=1;i<=totalCount;i++){
                chkid = 'chk'+i
                document.getElementById(chkid).checked=false;
                document.getElementById('txtTotal').value=0;   
            } 
           
   }
  function fncAddRemoveNotification(idVal){
     chk  = 'chk'+idVal        
     count   = document.getElementById('txtTotal').value ; 
     if( document.getElementById(chk).checked )
          document.getElementById('txtTotal').value  =  parseInt(count)+1;                    
     else 
          document.getElementById('txtTotal').value  =  count-1;          
          
     if(document.getElementById('txtTotal').value ==8)
        document.getElementById('sall').checked = true; 
     else  
        document.getElementById('sall').checked = false; 
          
     
  }
       
 
  function statusActivityDeletion(activityId){  
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?statusActivityId="+activityId; 
      
   xmlHttp.onreadystatechange= fnstatusActivityDeletion;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);     
  }
  
 function linkActivityDeletion(activityId){ 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?linkActivityId="+activityId; 
      
   xmlHttp.onreadystatechange= fnstatusActivityDeletion;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);     
 }
 
  function photoActivityDeletion(activityId){  
  
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?photoActivityId="+activityId; 
      
   xmlHttp.onreadystatechange= fnstatusActivityDeletion;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
  }
        
  function fnstatusActivityDeletion(){
   if (xmlHttp.readyState==4)
   {        
         if(Trim(xmlHttp.responseText)!=''){
            commentId  =  "postMessage"+parseInt(Trim(xmlHttp.responseText));           
            document.getElementById(commentId).innerHTML= "<p align='center' />Deleted Successfully!</p>";     
         }  
         
   }  
}
function fncSendPrivateMessage(msgFriendId,msgUrl){
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?msgFriendId="+msgFriendId+'&msgUrl='+msgUrl;       

   xmlHttp.onreadystatechange= fnAssignSendPrivateMessage
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);  

}
 function fnAssignSendPrivateMessage(){
  if (xmlHttp.readyState==4)
   {   
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
   }
 }
 
 function fncRemoveFriend(delFriendId){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?delFriendId="+delFriendId;       

   xmlHttp.onreadystatechange= fnAssignRemoveFriend
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 
 }
 
 function fnAssignRemoveFriend(){
   if (xmlHttp.readyState==4)
   {   
      var result = Trim(xmlHttp.responseText)
      fid = "assFriend"+parseInt(result);
      document.getElementById(fid).style.display  = "none" ; 
   }
 }


function fnAssignAvatarId(avatarId,avatarurl){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?avatarId="+avatarId+'&avatarurl='+avatarurl;       

   xmlHttp.onreadystatechange= fnAssignForumID
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);     
}

function fnAssignAvatarCategory(avatatCategoryId){

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?avatatCategoryId="+avatatCategoryId;         
   xmlHttp.onreadystatechange= fnAssignForumID
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);   
   
}     
 
function editPost(pid,filename){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumpostid="+pid+'&fileName='+filename;         
    xmlHttp.onreadystatechange= fnAssignForumID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);     
 }
 

 
 
function eventTypeSelection(type,urlFile){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?eventType="+type+'&urlFile='+urlFile;      
      
    xmlHttp.onreadystatechange= fnAssignEventSelection
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
}

 function fnAssignEventSelection(){
  if (xmlHttp.readyState==4)
   {   
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
   }
 }
 
 function fncReport(reportType,reportItemId){
 xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?reportType="+reportType+'&reportItemId='+reportItemId;            
    xmlHttp.onreadystatechange= fnAssignReport 
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
  
  }
  function fnAssignReport(){
    if (xmlHttp.readyState==4)
    {   
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
    }
  }
 
 
  function assignADId(adid,packtype,adurl){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?adid="+adid+'&packtype='+packtype+'&adurl='+adurl;            
    xmlHttp.onreadystatechange= fnAssignADId 
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
  
  }
  
 function fnAssignADId(){
  if (xmlHttp.readyState==4)
   {   
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
   }
 }
 
 function fnDayEventCalender(curEventDate,urlEvent){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?curEventDate="+curEventDate+"&urlEvent="+urlEvent;  
      
    xmlHttp.onreadystatechange= fnAssignDayEventSelection 
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
}
              
function fnAssignDayEventSelection(){
  if (xmlHttp.readyState==4)
   {   
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
   }
 }
 
 
function fnWeekEventCalender(curWeekEventStartDate,curWeekEventEndDate,traverseType,urlWeekEvent){              
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?curWeekEventStartDate="+curWeekEventStartDate+"&curWeekEventEndDate="+curWeekEventEndDate+"&traverseType="+traverseType+"&urlWeekEvent="+urlWeekEvent;  
         
    xmlHttp.onreadystatechange= fnAssignWeekEventSelection 
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 

}

function fnAssignWeekEventSelection(){
  if (xmlHttp.readyState==4)
   {   
        var result = Trim(xmlHttp.responseText)
        window.location.href=result;  
   }
 }

 
      
function assignForumId(fid,fileName){   
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumid="+fid+'&fileName='+fileName;      
      
    xmlHttp.onreadystatechange= fnAssignForumID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);    
}

function fnAssignForumID() 
{     
   if (xmlHttp.readyState==4)
   {  
     
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
   }       

} 

 function fnIncreaseViewCount(tid){
 
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumtid="+tid;         
    xmlHttp.onreadystatechange= increaseViewCount
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);   
 
 }
 
 function increaseViewCount() 
{  
   if (xmlHttp.readyState==4)
   {   
     return  true;  
   }

} 
 

 function fnAssignCategoryId(id,fileName){ 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumcatid="+id+'&catFileName='+fileName;   
    
    
    xmlHttp.onreadystatechange= fnAssignForumCategoryID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);    
 }
 
 
 
 function fnAssignForumCategoryID() 
{     
   if (xmlHttp.readyState==4)
   {                    
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
     
   }    

} 

function fnAssignTopicUnreadId(id,fileName,passid){ 
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumtoppassid="+id+'&filepassName='+fileName+'&passid='+passid;         
    xmlHttp.onreadystatechange= fnAssignForumID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  


} 


function fnAssignForumTopicId(id,fileName){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumplustopid="+id+'&forumfileName='+fileName;         
    xmlHttp.onreadystatechange= fnTopicForumID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  

}


function fnTopicForumID() 
{     
   if (xmlHttp.readyState==4)
   {      
     var result = Trim(xmlHttp.responseText)
     window.location.href=result;  
   }       

} 

 
function fnAssignTopicId(id,fileName){ 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?forumtopid="+id+'&fileName='+fileName;         
    xmlHttp.onreadystatechange= fnAssignForumID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  

}

function quoteReply(id,ownid,fileName){ 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?quotepostid="+id+'&ownid='+ownid+'&fileName='+fileName;    
    xmlHttp.onreadystatechange= fnAssignForumID
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  

}   

function assignValueForSurveyRadio(optValue,answerVal){
    txtQuesjsVal = "txtQuesjs"+optValue 
    txtAnsjsVal  = "txtAnsjs"+optValue 
    radValue             = "txtAnswerRad"+answerVal
    document.getElementById(txtQuesjsVal).value = 1;
    document.getElementById(txtAnsjsVal).value = answerVal;
    document.getElementById(radValue).value = answerVal;
                                
       
}

function fnParticpateSurvey(){
  var err = 0;
  totalQuestions  = document.getElementById('totalQuestionCount').value;   
  if(totalQuestions>0){
    for(i=1;i<totalQuestions;i++){  
       txtQues      =   "txtQuesjs"+i;
       txtQuesType  =   "txtQuestypejs"+i;
       errMsg = "err"+i  
       document.getElementById(errMsg).innerHTML =''
       
       txtQuesVal     = document.getElementById(txtQues).value;
       txtQuesTypeVal = document.getElementById(txtQuesType).value;
       
       if(txtQuesTypeVal=='C'){
            if(txtQuesVal==0){
                
                document.getElementById(errMsg).innerHTML = "Please answer for this question.";
                 return false;     
            } 
       }
       if(txtQuesTypeVal=='F'){      
            ans =  "txtAnswer"+ txtQuesVal
            if(Trim(document.getElementById(ans).value) == ''){
                  document.getElementById(errMsg).innerHTML = "Please answer for this question.";     
                  return false; 
            }
                 
       }   
    }
  }
    
}

function genSearchValidation(){
    d = document.genSearch;     

    
    if( Trim(d.txtGenSearch.value)!= 'Start Typing...'){
         
    msg1    =    "Processing... Please wait...";
    document.getElementById("errorSearchdiv").innerHTML='<font size="0.5">'+msg1+'</font>';
    var msg ='';  
    
        if(Trim(d.txtGenSearch.value)==''){          
            msg =msg+"keyword Required.";           
        }
        if(msg !=''){       
            document.getElementById("errorSearchdiv").innerHTML='<br><font size="0.1">'+Trim(msg)+'</font>';
            return false;
       }
        else{
            return true;
        }  
    }
    else {
    return false;   
    
    }
}

 function regAlbum(){
    d = document.addAlbum;
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';         
    if(Trim(d.txtAlbumName.value)==''){          
             msg =msg+"<li>Album is Required."+"</li>"  ;           
    }  
    if(validChar(d.txtAlbumName.value)==false){                  
           msg =msg+"<li>Invalid Album Title."+"</li>"  ;   
    }  
    /* 
    if(Trim(d.lstPrivacy.value)=='~'){          
        msg =msg+"<li>Privacy is Required."+"</li>"  ;              
    } */    
    if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>"  
        scroll(0,300);  
        document.getElementById("errordiv").innerHTML=msg;
        return false;
   }
    else{
        return true;
    }
 }
 
  function regProfileContact(){
  
    d = document.profile;
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
    if(Trim(d.txtWorkEmail.value) != ''){     
     if(!isValidEmail(d.txtWorkEmail.value) && Trim(d.txtWorkEmail.value) !=''){             
           msg =msg+"<li>Invalid Work Email Address."+"</li>"  ;
     }  
    }  
    if(Trim(d.txtHomeEmail.value) != ''){     
     if(!isValidEmail(d.txtHomeEmail.value) && Trim(d.txtHomeEmail.value) !=''){             
           msg =msg+"<li>Invalid Home Email Address."+"</li>"  ;
     }  
    }  
    
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>"  ;
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
     }
     else{
        return true;
     }  
  }
  
 
  function checkValidFriend(){
  
    d = document.searchForm;
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
  
    email = document.getElementById('txtEmail').value;    
    

    if(email !=''){    
    assignNonFriendSessionId(email,"friendRequest.php"); 
                      
    }   
    
     
  
 }   

function createTopic(){
    d = document.addTopic;
    document.getElementById('divTopicName').innerHTML ='';
    document.getElementById('divPost').innerHTML = ""; 
 
    if(Trim(d.txtTopicName.value)==''){   
  
  
         document.getElementById('divTopicName').innerHTML ="Topic is Required.";           
         return false ;
    }  
    tinyMCE.triggerSave(); 
    if(Trim(d.txtPost.value)==''){
        document.getElementById('divPost').innerHTML = "Post is Required.";       
        return false ;
    }   
    return true;
  
}
           
 function regPhoto (){
    d = document.addPhoto;
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
    
  if(Trim(d.txtPhoto.value)=='0'){    

    if(Trim(d.txtPhoto1.value)==''){
             msg =msg+"<li>Please select atleast one photo."+"</li>"  ;     
    }
    if(Trim(d.txtPhoto1.value)!=''){
            if (!/(\.(jpg|jpeg))$/i.test(d.txtPhoto1.value)){             
               msg =msg+"<li>Photo must be of type JPEG (*.jpg)."+"</li>"  ;  
            }
     }  
     
 }
      
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
     }
     else{
        return true;
     } 
 }


function addFun(val){
    divId = "div"+val;
    
    linkval        = parseInt(val)+1;             
    createdrow    = "<input type='file' name='txtPhoto"+val+"'     >"+"<a class='link' href='javascript:removeFun("+val+")'>&nbsp;<img src='images/icon_minimize.gif' border='0' alt='Remove' title='Remove'></a>";
    document.getElementById('likvalue').value =linkval; 
  
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);
     document.getElementById("div1").appendChild(eDIV);              
     document.getElementById(divId).innerHTML =createdrow;
    
}

function addBusineePhotoFun(val){
    divId = "div"+val;
    
    linkval        = parseInt(val)+1;             
    createdrow    = "<br><input type='file' name='txtPhoto"+val+"'     >"+"<a class='link' href='javascript:removeFun("+val+")'>&nbsp;<img src='images/icon_minimize.gif' border='0' alt='Remove' title='Remove'></a>";
    document.getElementById('likvalue').value =linkval; 
  
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);
     document.getElementById("div1").appendChild(eDIV);              
     document.getElementById(divId).innerHTML =createdrow;
    
}


function addAdditionalShedule(val){
	
    
if($('div[lang=dater] ul').length<21) {
	
	var $inputs = $('div[lang=dater]');

    // not sure if you wanted this, but I thought I'd add it.
    // get an associative array of just the values.
    var values = {};
    $inputs.each(function() {

		element_name=$(this).attr('alt');
		element_count=$(this).find('ul').length+1;
		createdrow    = '<ul class="datetime"><li><input type="text" lang="date" name="'+element_name+element_count+'"id="'+element_name+element_count+'"  class="tdtxt"  readonly /></li><li>to</li><li>	<input type="text" lang="date" name="'+element_name+"To"+element_count+'" id="'+element_name+"To"+element_count+'" class="tdtxt" readonly  /></li>						<li>Text msg :</li>	<li><input type="text" lang="msg" name="'+element_name+"Text"+element_count+'" id="'+element_name+"Text"+element_count+'" class="tdtxt" /> </li> </ul>';

       $(this).append(createdrow);
    });
 
	$("input[lang=date]").timePicker({  startTime: "00.00",    endTime: "23.45",    show24Hours: false,  separator:'.',  step: 15});

	document.getElementById('likvalue').value =$('div[alt=monday] ul').length; 
}
	/*linkval        = parseInt(val)+1;  
	
    
               
	if(linkval <= 3) { 
	
	document.getElementById('likvalue').value =linkval; 

  //  createdrowmonday    = "<div style='padding-top:10px'></div><input type='text' name='monday"+linkval+"'> to "+ "<input type='text' name='mondayTo"+linkval+"'> Text msg :"+ "<input type='text' name='mondayTo"+linkval+"'>";
 createdrowmonday    = '<ul class="datetime"><li><input type="text" lang="date" name="monday'+linkval+'" id="monday'+linkval+'"  class="tdtxt"  readonly /> </li><li>to</li><li><input type="text" lang="date" name="mondayTo'+linkval+'" id="mondayTo'+linkval+'" class="tdtxt" readonly  /></li>						<li>Text msg :</li>	<li><input type="text" lang="msg" name="mondayText'+linkval+'" id="mondayText'+linkval+'" class="tdtxt" /> </li> </ul>';

	createdrowtuesday    = '<ul class="datetime"><li><input type="text" lang="date" name="tuesday'+linkval+'" id="tuesday'+linkval+'"  class="tdtxt" readonly /> </li><li>to</li><li><input type="text" lang="date" name="tuesdayTo'+linkval+'" id="tuesdayTo'+linkval+'" class="tdtxt" readonly  /></li>	<li>Text msg :</li>	<li><input type="text"  lang="msg" name="tuesdayText'+linkval+'" id="tuesdayText'+linkval+'" class="tdtxt" /> </li>		</ul>';

	createdrowwednesday    = '<ul class="datetime"><li><input type="text" lang="date" name="wednesday'+linkval+'" id="wednesday'+linkval+'"  class="tdtxt" readonly /> </li><li>to</li><li><input type="text" lang="date" name="wednesdayTo'+linkval+'" id="wednesdayTo'+linkval+'" class="tdtxt" readonly  /></li>	<li>Text msg :</li>	<li><input type="text"  lang="msg" name="wednesdayText'+linkval+'" id="wednesdayText'+linkval+'" class="tdtxt" /> </li>		</ul>';

	createdrowthursday    = '<ul class="datetime"><li><input type="text" lang="date" name="thursday'+linkval+'" id="thursday'+linkval+'"  class="tdtxt" readonly /> </li><li>to</li><li><input type="text" lang="date" name="thursdayTo'+linkval+'" id="thursdayTo'+linkval+'" class="tdtxt" readonly  /></li>	<li>Text msg :</li>	<li><input type="text"  lang="msg" name="thursdayText'+linkval+'" id="thursdayText'+linkval+'" class="tdtxt" /> </li>	</ul>';

	createdrowfriday    = '<ul class="datetime"><li><input type="text" lang="date" name="friday'+linkval+'" id="friday'+linkval+'"  class="tdtxt" readonly /> </li><li>to</li><li><input type="text" lang="date" name="fridayTo'+linkval+' id="fridayTo'+linkval+'" class="tdtxt"  readonly /></li>	<li>Text msg :</li>	<li><input type="text"  lang="msg" name="fridayText'+linkval+'" id="fridayText'+linkval+'" class="tdtxt" /> </li>	</ul>';

	createdrowsaturday    = '<ul class="datetime"><li><input type="text" lang="date" name="saturday'+linkval+'" id="saturday'+linkval+'"  class="tdtxt" readonly /> </li><li>to</li><li><input type="text" lang="date" name="saturdayTo'+linkval+'" id="saturdayTo'+linkval+'" class="tdtxt"  readonly /></li>	<li>Text msg :</li>	<li><input type="text"  lang="msg" name="saturdayText'+linkval+'" id="saturdayText'+linkval+'" class="tdtxt" /> </li>	</ul>';

	createdrowsunday    = '<ul class="datetime"><li><input type="text" lang="date" name="sunday'+linkval+'" id="sunday'+linkval+'"  class="tdtxt" readonly /> </li><li>to</li><li><input type="text" lang="date" name="sundayTo'+linkval+' id="sundayTo'+linkval+'" class="tdtxt"  readonly /></li>	<li>Text msg :</li>	<li><input type="text"  lang="msg" name="sundayText'+linkval+'" id="sundayText'+linkval+'" class="tdtxt" /> </li>	</ul>';
    
	 divId = "div"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

     document.getElementById("div1").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowmonday;
	 


	 divId = "div22"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

	 document.getElementById("div22").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowtuesday;


	 divId = "div33"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

	  document.getElementById("div33").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowwednesday;

	 divId = "div44"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

	  document.getElementById("div44").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowthursday;

	 divId = "div55"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

	  document.getElementById("div55").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowfriday;

	 divId = "div66"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

	  document.getElementById("div66").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowsaturday;

	 divId = "div77"+linkval;
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);

	  document.getElementById("div77").appendChild(eDIV);
     document.getElementById(divId).innerHTML =createdrowsunday;

	 $("input[lang=date]").timePicker({  startTime: "00.00",    endTime: "23.45",    show24Hours: false,  separator:'.',  step: 15});


	}
    */
}



function removeAdditionalShedule(removeId) {
	
	if(removeId>1) {
		$('div[lang=dater] ul:last-child').remove();
		document.getElementById('likvalue').value =removeId-1; 
	}

    /*

var d = document.getElementById('div1');
var olddiv = document.getElementById("div"+removeId);
d.removeChild(olddiv);

var d = document.getElementById('div22');
var olddiv = document.getElementById("div22"+removeId);
d.removeChild(olddiv);

var d = document.getElementById('div33');
var olddiv = document.getElementById("div33"+removeId);
d.removeChild(olddiv);

var d = document.getElementById('div44');
var olddiv = document.getElementById("div44"+removeId);
d.removeChild(olddiv);

var d = document.getElementById('div55');
var olddiv = document.getElementById("div55"+removeId);
d.removeChild(olddiv);

var d = document.getElementById('div66');
var olddiv = document.getElementById("div66"+removeId);
d.removeChild(olddiv);

var d = document.getElementById('div77');
var olddiv = document.getElementById("div77"+removeId);
d.removeChild(olddiv);
*/
}




function addReviewPhotoFun(val){
    
	linkval        = parseInt(val)+1;  
	divId = "div"+linkval;
    
               
	if(linkval <= 5) { 
	
	document.getElementById('likvalue').value =linkval; 

    createdrow    = "<input type='file' name='txtPhoto"+linkval+"'     >"+"<a class='link' href=\"javascript:removeReviewFun("+linkval+", \'likvalue\',\'div\')\">&nbsp;<img src='images/icon_minimize.gif' border='0' alt='Remove' title='Remove'></a>";
    
  
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);
     document.getElementById("div1").appendChild(eDIV);              
     document.getElementById(divId).innerHTML =createdrow;
	}
    
}

function addReviewVideoFun(val){
    linkval        = parseInt(val)+1;    
	    divId = "videoDiv"+linkval;
		
	if(linkval <= 5) { 
    createdrow    = "<textarea cols='70%' rows='3%'  name='txtVideo"+linkval+"' id='txtVideo"+linkval+"'></textarea>"+"<a class='link' href=\"javascript:removeReviewFun("+linkval+", \'likvalue1\',\'videoDiv\')\">&nbsp;<img src='images/icon_minimize.gif' border='0' alt='Remove' title='Remove'></a><div>&nbsp;</div>";
    document.getElementById('likvalue1').value =linkval; 
  
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);
     document.getElementById("videoDiv1").appendChild(eDIV);              
     document.getElementById(divId).innerHTML =createdrow;
	}
    
}

function removeReviewFun(val,totalElement,divElement){
        divId = divElement+val;
		document.getElementById(totalElement).value = document.getElementById(totalElement).value-1; 
        d = document.getElementById(divElement+'1');
        olddiv = document.getElementById(divId);
        d.removeChild(olddiv);

} 

function removeVideoFun(val){
        divId = "videoDiv"+val;
        d = document.getElementById('videoDiv1');
        olddiv = document.getElementById(divId);
        d.removeChild(olddiv);

}   
        
function removeFun(val){
        divId = "div"+val;
        d = document.getElementById('div1');
        olddiv = document.getElementById(divId);
        d.removeChild(olddiv);

}   

function addPhotoFun(val){
    divId = "div"+val;               
    linkval        = parseInt(val)+1;             
    createdrow    = "<input type='file' name='txtPhoto"+val+"'     >"+"<a  class='link' href='javascript:removPhotoFun("+val+")'>&nbsp;<img src='images/icon_minimize.gif' border='0' alt='Remove' title='Remove'></a>";
    document.getElementById('likvalue').value =linkval; 
  
     eDIV             =     document.createElement("div");
     eDIV.setAttribute("id",divId);
     document.getElementById("div1").appendChild(eDIV);              
     document.getElementById(divId).innerHTML =createdrow;       
}
        
function removPhotoFun(val){
        divId = "div"+val;
        d = document.getElementById('div1');
        olddiv = document.getElementById(divId);
        d.removeChild(olddiv);

}  

 function fnMessageType(typeVal){
 

 
    if(typeVal==0){
    
        ids     = document.getElementById('txtUnread').value      
        if(Trim(ids) !=''){
            idsArr  = ids.split(',');     
            var iChkCount = idsArr.length;
                        
           
            
            for(i=0;i<idsArr.length;i++){
                 j= idsArr[i] 
                 ckid = "chk"+j; 
              document.getElementById(ckid).checked = true;
            } 
        }
            
        ids     = document.getElementById('txtRead').value
        if(Trim(ids) !=''){
            idsArr  = ids.split(',');     
            var iChkCount = idsArr.length;
            
            for(i=0;i<idsArr.length;i++){
                 j= idsArr[i] 
                 ckid = "chk"+j; 
              document.getElementById(ckid).checked = false;
            } 
        }     
           document.getElementById('unread').innerHTML ='Mark as Unread'  
           document.getElementById('read').innerHTML ='<a href="#" onclick="fnMessageAction(\'R\')">Mark as Read</a>'  
           document.getElementById('delete').innerHTML ='<a href="#" onclick="if(validate(\'Delete\')){fnMessageAction(\'D\')}">Delete</a>'            
       
          
        
                  
    }
    else if(typeVal==1){        
        ids     = document.getElementById('txtRead').value
        delCheckids     = document.getElementById('txtRead').value
        
        
        if(Trim(ids) !=''){
            idsArr  = ids.split(','); 
            
            var iChkCount = idsArr.length;
            
           
            for(i=0;i<idsArr.length;i++){
                 j= idsArr[i] 
                 ckid = "chk"+j; 
              document.getElementById(ckid).checked = true;
            }  
        }
            
        ids     = document.getElementById('txtUnread').value
        if(Trim(ids) !=''){  
            idsArr  = ids.split(','); 
            var iChkCount = idsArr.length;
            
            for(i=0;i<idsArr.length;i++){
                 j= idsArr[i] 
                 ckid = "chk"+j; 
              document.getElementById(ckid).checked = false;
            }
        }  
        
         if(delCheckids !='') {   
            document.getElementById('unread').innerHTML ='<a href="#" onclick="fnMessageAction(\'U\')">Mark as Unread</a>'  
            document.getElementById('read').innerHTML ='Mark as Read'   
            document.getElementById('delete').innerHTML ='<a href="#"  onclick="if(validate(\'Delete\')){fnMessageAction(\'D\')}">Delete</a>'                                                                                                                             
        }  
        else{
          document.getElementById('unread').innerHTML ='Mark as Unread'  
            document.getElementById('read').innerHTML ='Mark as Read'   
            document.getElementById('delete').innerHTML ='Delete'                                                                                                                             
        }
   
           
    }
    else if(typeVal==2){       
        ids     = document.getElementById('txtAll').value
        if(Trim(ids) !=''){
            idsArr  = ids.split(','); 
            var iChkCount = idsArr.length;
            
            for(i=0;i<idsArr.length;i++){
                  j = idsArr[i]
                 ckid = "chk"+j; 
              document.getElementById(ckid).checked = true;
            }  
      }
        
      document.getElementById('unread').innerHTML ='<a href="#"  onclick="fnMessageAction(\'U\')">Mark as Unread</a>'  
      document.getElementById('read').innerHTML ='<a href="#"  onclick="fnMessageAction(\'R\')">Mark as Read</a>'  
      document.getElementById('delete').innerHTML ='<a href="#"  onclick="if(validate(\'Delete\')){fnMessageAction(\'D\')}">Delete</a>'  
        
        
    }
    else if(typeVal==3){
        ids     = document.getElementById('txtAll').value
        if(Trim(ids) !=''){ 
            idsArr  = ids.split(','); 
            var iChkCount = idsArr.length;
            
            for(i=0;i<idsArr.length;i++){
                  j = idsArr[i]
                 ckid = "chk"+j; 
              document.getElementById(ckid).checked = false;
            } 
        }
        
       document.getElementById('unread').innerHTML ='Mark as Unread'  
       document.getElementById('read').innerHTML ='Mark as Read'  
       document.getElementById('delete').innerHTML ='Delete'  
          
    
    }
    else if(typeVal==4){
    
    }
 
 }  
 

 
 function fnMessageAction(val){     
   document.getElementById('txtActionType').value=val; 
   document.frmMessage.submit();      
 }
 
function fnEditBusinessEvent(){
 d = document.addEvent;   
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';
   var cond = 0;
   
   
   if(Trim(d.lstCategory.value)=='~'){
        msg =msg+"<li>Category is Required."+"</li>"  ;       
   }          
   if(Trim(d.txtTitle.value)==''){            
        msg =msg+"<li>Title is Required."+"</li>"  ;    
   }    
 
  
   
   if(Trim(d.txtLocation.value)==''){       
        msg =msg+"<li>Location is Required."+"</li>"  ;     
   }  
   if(Trim(d.lstCity1.value)=='~'){       
        msg =msg+"<li>City is Required."+"</li>"  ;     
   }  
   
   
      
   
   if(Trim(d.txtContactName.value)==''){       
       msg =msg+"<li>Contact Name is Required."+"</li>"  ;
   }
  
   if(Trim(d.phone1.value)=='' || Trim(d.phone2.value)=="" || Trim(d.phone3.value)=="")
   {    
         msg =msg+"<li>Contact phone is Required."+"</li>"  ;
   }
   if(Trim(d.phone1.value)!='' &&  Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="")   {
       
       if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
       { 
             msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }    
       if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
       {            
            msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }
       
   }
    if(Trim(d.txtEmail.value)==''){      
       msg =msg+"<li>Email is Required."+"</li>"  ; 
    }  
    if(Trim(d.txtEmail.value) !=''){  
        if(!isValidEmail(d.txtEmail.value) && Trim(d.txtEmail.value) !=''){             
           msg =msg+"<li>Invalid Email Address."+"</li>"  ;
        } 
    }
      
    if(Trim(d.lstPrivacy.value)=='~'){       
        msg =msg+"<li>Privacy is Required."+"</li>"  ;     
    } 
    if(Trim(d.txtShortDetails.value)==''){  
        msg =msg+"<li>Short Description is Required."+"</li>"  ;  
    }  
    if(Trim(d.txtDetails.value)==''){  
        msg =msg+"<li>Details is Required."+"</li>"  ;  
    } 
    if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
        return true;
   }
  
}
 
 function fnAddBusinessEvent(){
     d = document.addEvent;   
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';
   var cond = 0;
   
   
   if(Trim(d.lstCategory.value)=='~'){
        msg =msg+"<li>Category is Required."+"</li>"  ;       
   }          
   if(Trim(d.txtTitle.value)==''){            
        msg =msg+"<li>Title is Required."+"</li>"  ;    
   }    
   if(Trim(d.txtStartDate.value)==''){    
       msg =msg+"<li>Start date is Required."+"</li>"  ; 
   }   
   if(Trim(d.txtStartDate.value) !=''){  
        cd= d.txtStartDate.value
        dateArr = cd.split(" ")   
        sDate   = dateArr[0];     
         if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid Start Date."+"</li>"  ;           
         }
         else{
            if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (Start Date)."+"</li>"  ;                          
            }                
         }
    } 
    
    if(Trim(d.lstStartTime.value)=='~'){       
            msg =msg+"<li>Start Time is Required."+"</li>"  ;     
    }    
          
        
     if(Trim(d.txtCloseDate.value) !='' || Trim(d.lstEndTime.value)!='~' ){ 
        
        
        if(Trim(d.txtCloseDate.value)==''){       
            msg =msg+"<li>End date is Required."+"</li>"  ;     
       } 
       
        if(Trim(d.txtCloseDate.value) !=''){  
            cd= d.txtCloseDate.value
            dateArr = cd.split(" ")  
            cDate   = dateArr[0];          
             if(isDate(dateArr[0])==false){  
                msg =msg+"<li>Invalid End Date."+"</li>"  ;           
             }
             else{
                if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                       msg =msg+"<li>Please select later date (End Date)."+"</li>"  ;                          
                }  
                 else{
                     cond = 1; 
                 }              
             }
        }    
        
        if(Trim(d.lstEndTime.value)=='~'){       
            msg =msg+"<li>End Time is Required."+"</li>"  ;     
       } 
     }
        
    if(cond==1){        
       pubDate      =  sysDateFormat(sDate);
       closeDate    =  sysDateFormat(cDate);    

       if(pubDate>closeDate) {             
             msg =msg+"<li>End Date must be equal or after the Start Date."+"</li>"  ;                 
       }    
    }
      
  
   
   if(Trim(d.txtLocation.value)==''){       
        msg =msg+"<li>Location is Required."+"</li>"  ;     
   }  
   if(Trim(d.lstCity1.value)=='~'){       
        msg =msg+"<li>City is Required."+"</li>"  ;     
   }  
   
   
      
   
   if(Trim(d.txtContactName.value)==''){       
       msg =msg+"<li>Contact Name is Required."+"</li>"  ;
   }
   /*
   if(IsCharacter(d.txtContactName.value)==false){              
         msg =msg+"<li>Invalid Contact Name."+"</li>"  ;
   } */
   if(Trim(d.phone1.value)=='' || Trim(d.phone2.value)=="" || Trim(d.phone3.value)=="")
   {    
         msg =msg+"<li>Contact phone is Required."+"</li>"  ;
   }
   if(Trim(d.phone1.value)!='' &&  Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="")   {
       
       if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
       { 
             msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }    
       if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
       {            
            msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }
       
   }
    if(Trim(d.txtEmail.value)==''){      
       msg =msg+"<li>Email is Required."+"</li>"  ; 
    }  
    if(Trim(d.txtEmail.value) !=''){  
        if(!isValidEmail(d.txtEmail.value) && Trim(d.txtEmail.value) !=''){             
           msg =msg+"<li>Invalid Email Address."+"</li>"  ;
        } 
    }
 /*   if(Trim(d.txtURL.value)==''){       
       msg =msg+"<li>Website is Required."+"</li>"  ;
    } 
    if(urlValidation(d.txtURL.value)==false){        
      msg =msg+"<li>Invalid Website."+"</li>"  ;
    }         
    
    if(Trim(d.photo.value)==''){
             msg =msg+"<li>Photo is Required."+"</li>"  ;     
    }
    if(Trim(d.photo.value)!=''){
            if (!/(\.(jpg|jpeg))$/i.test(d.photo.value)){             
               msg =msg+"<li>Photo must be of type JPEG (*.jpg)."+"</li>"  ;  
            }
     } 
      */       
    if(Trim(d.lstPrivacy.value)=='~'){       
        msg =msg+"<li>Privacy is Required."+"</li>"  ;     
    } 
    if(Trim(d.txtShortDetails.value)==''){  
        msg =msg+"<li>Short Description is Required."+"</li>"  ;  
    }  
    if(Trim(d.txtDetails.value)==''){  
        msg =msg+"<li>Details is Required."+"</li>"  ;  
    } 
    if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
        return true;
   }
 
 }
 
function fnAddEvent(){
   d = document.addEvent;   
   msg1     =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';
   var cond = 0;   
   
   if(Trim(d.txtTitle.value)==''){            
        msg =msg+"<li>Title is Required."+"</li>"  ;    
   }   
   if(Trim(d.txtStartDate.value)==''){    
       msg =msg+"<li>Start date is Required."+"</li>"  ; 
   }  
   if(Trim(d.txtStartDate.value) !=''){  
        cd= d.txtStartDate.value
        dateArr = cd.split(" ")   
        sDate   = dateArr[0];     
        if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid Start Date."+"</li>"  ;           
        }
        else{
            if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (Start Date)."+"</li>"  ;                          
            }                
        }
   }
    if(Trim(d.txtCloseDate.value)!=''){   
       if(Trim(d.txtCloseDate.value)==''){       
            msg =msg+"<li>End date is Required."+"</li>"  ;     
       }
      
       if(Trim(d.txtCloseDate.value) !=''){  
            cd= d.txtCloseDate.value
            dateArr = cd.split(" ")  
            cDate   = dateArr[0];          
            if(isDate(dateArr[0])==false){  
                msg =msg+"<li>Invalid End Date."+"</li>"  ;           
            }
            else{
                if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                       msg =msg+"<li>Please select later date (End Date)."+"</li>"  ;                          
                }  
                else{
                     cond = 1; 
                }              
            }
        }  
   }  
    if(cond==1){        
       pubDate      =  sysDateFormat(sDate);
       closeDate    =  sysDateFormat(cDate); 
       if(pubDate>closeDate){             
             msg =msg+"<li>End Date must be equal or after the Start Date."+"</li>"  ;                 
       }    
    }     
    if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
        return true;
    } 
}
 
 /*
 function fnAddEvent(){
   d = document.addEvent;   
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';
   var cond = 0;
   
   
   if(Trim(d.lstCategory.value)=='~'){
        msg =msg+"<li>Category is Required."+"</li>"  ;       
   }          
   if(Trim(d.txtTitle.value)==''){            
        msg =msg+"<li>Title is Required."+"</li>"  ;    
   }    
   if(Trim(d.txtStartDate.value)==''){    
       msg =msg+"<li>Start date is Required."+"</li>"  ; 
   }   
   if(Trim(d.txtStartDate.value) !=''){  
        cd= d.txtStartDate.value
        dateArr = cd.split(" ")   
        sDate   = dateArr[0];     
         if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid Start Date."+"</li>"  ;           
         }
         else{
            if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (Start Date)."+"</li>"  ;                          
            }                
         }
    }    
       
    if(Trim(d.txtCloseDate.value)==''){       
        msg =msg+"<li>End date is Required."+"</li>"  ;     
   } 
   
    if(Trim(d.txtCloseDate.value) !=''){  
        cd= d.txtCloseDate.value
        dateArr = cd.split(" ")  
        cDate   = dateArr[0];          
         if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid End Date."+"</li>"  ;           
         }
         else{
            if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (End Date)."+"</li>"  ;                          
            }  
             else{
                 cond = 1; 
             }              
         }
    }    
    if(cond==1){        
       pubDate      =  sysDateFormat(sDate);
       closeDate    =  sysDateFormat(cDate);    

       if(pubDate>closeDate) {             
             msg =msg+"<li>End Date must be equal or after the Start Date."+"</li>"  ;                 
       }    
    }
      
  
   
   if(Trim(d.txtLocation.value)==''){       
        msg =msg+"<li>Location is Required."+"</li>"  ;     
   }  
   if(Trim(d.lstCity1.value)=='~'){       
        msg =msg+"<li>City is Required."+"</li>"  ;     
   }  
   
   
      
   
   if(Trim(d.txtContactName.value)==''){       
       msg =msg+"<li>Contact Name is Required."+"</li>"  ;
   }
   if(IsCharacter(d.txtContactName.value)==false){              
         msg =msg+"<li>Invalid Contact Name."+"</li>"  ;
   }
   if(Trim(d.phone1.value)=='' || Trim(d.phone2.value)=="" || Trim(d.phone3.value)=="")
   {    
         msg =msg+"<li>Contact phone is Required."+"</li>"  ;
   }
   if(Trim(d.phone1.value)!='' &&  Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="")   {
       
       if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
       { 
             msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }    
       if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
       {            
            msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }
       
   }
    if(Trim(d.txtEmail.value)==''){      
       msg =msg+"<li>Email is Required."+"</li>"  ; 
    }  
    if(Trim(d.txtEmail.value) !=''){  
        if(!isValidEmail(d.txtEmail.value) && Trim(d.txtEmail.value) !=''){             
           msg =msg+"<li>Invalid Email Address."+"</li>"  ;
        } 
    }
    if(Trim(d.txtURL.value)==''){       
       msg =msg+"<li>Website is Required."+"</li>"  ;
    } 
    if(urlValidation(d.txtURL.value)==false){        
      msg =msg+"<li>Invalid Website."+"</li>"  ;
    }        
    
    if(Trim(d.txtShortDetails.value)==''){  
        msg =msg+"<li>Short Description is Required."+"</li>"  ;  
    }  
    if(Trim(d.txtDetails.value)==''){  
        msg =msg+"<li>Details is Required."+"</li>"  ;  
    } 
    if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
        return true;
   } 
 }
 */
 
 
 function fnEditEvent(){
   d = document.addEvent;   
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';
   var cond = 1;
   
   
     if(Trim(d.txtTitle.value)==''){            
        msg =msg+"<li>Title is Required."+"</li>"  ;    
   }   
   if(Trim(d.txtStartDate.value)==''){    
       msg =msg+"<li>Start date is Required."+"</li>"  ; 
   }  
   if(Trim(d.txtStartDate.value) !=''){  
        cd= d.txtStartDate.value
        dateArr = cd.split(" ")   
        sDate   = dateArr[0];     
        if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid Start Date."+"</li>"  ;           
        }
        else{
            if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (Start Date)."+"</li>"  ;                          
            }                
        }
   }
    if(Trim(d.txtCloseDate.value)!=''){   
       if(Trim(d.txtCloseDate.value)==''){       
            msg =msg+"<li>End date is Required."+"</li>"  ;     
       }
      
       if(Trim(d.txtCloseDate.value) !=''){  
            cd= d.txtCloseDate.value
            dateArr = cd.split(" ")  
            cDate   = dateArr[0];          
            if(isDate(dateArr[0])==false){  
                msg =msg+"<li>Invalid End Date."+"</li>"  ;           
            }
            else{
                if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                       msg =msg+"<li>Please select later date (End Date)."+"</li>"  ;                          
                }  
                else{
                     cond = 1; 
                }              
            }
        }  
   }  
   
      
    if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
        return true;
   }
 
 }
	
         
function  regAuto(){    
    d = document.addAuto;  
    var dat = new Date(); 
    var curr_year = dat.getFullYear();   
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
    
    
    if(Trim(d.lstBodystyle.value)=='~'){
            msg =msg+"<li>Body Style is Required."+"</li>"  ;                       
    }  
    
    if(Trim(d.year.value)==''){
            msg =msg+"<li>Year is Required."+"</li>"  ;                       
    }   
    
    if(Trim(d.year.value)!=''){   
       if(!isInteger(d.year.value)){                 
            msg =msg+"<li>Invalid Year."+"</li>"  ;            
       } 
       if(d.year.value >curr_year){     
            msg =msg+"<li>Please select Year less than the current Year.</li>" ;             
       }   
    } 
    if(Trim(d.make.value)=='~'){
            msg =msg+"<li>Make is Required."+"</li>"  ;                       
    }      
    if(Trim(d.model.value)==''){
           msg =msg+"<li>Model is Required."+"</li>"  ; 
    } 
    if(Trim(d.model.value) !=''){ 
          if(validChar(d.model.value)==false){                    
                msg =msg+"<li>Invalid Model."+"</li>"  ;    
          }
    }
    if(Trim(d.ext_color.value)==''){  
            msg =msg+"<li>Exterior Color is Required."+"</li>"  ;    
    }   
    if(Trim(d.ext_color.value) !=''){ 
        if(validChar(d.ext_color.value)==false){                
               msg =msg+"<li>Invalid Exterior Color."+"</li>"  ;      
        }
    }
    if(Trim(d.int_color.value) ==''){        
          msg =msg+"<li>Interior Color is Required."+"</li>"  ;     
    }
    if(validChar(d.int_color.value)==false){                
        msg =msg+"<li>Invalid Interior Color."+"</li>"  ;    
    }     
    if(Trim(d.int_color.value) !=''){ 
       if(validChar(d.int_color.value)==false){    
            msg =msg+"<li>Invalid Interior Color."+"</li>"  ;    
        }
    }
    if(Trim(d.trim.value) !=''){ 
          if(validChar(d.trim.value)==false){                    
                msg =msg+"<li>Invalid Trim."+"</li>"  ;    
            }
    }
  
    if(!fnSelectConfirmation()){
         msg =msg+"<li> Features is Required."+"</li>"  ;    
    }
    
    if(Trim(d.additional_details.value)==''){       
          msg =msg+"<li>Additional Details is Required."+"</li>"  ;  
    }  
    if(Trim(d.mileage.value) !=''){       
         if(!commaSepNumcheck(d.mileage.value)){    
                msg =msg+"<li>Invalid Mileage."+"</li>"  ;                 
         }
    } 
    
    if(Trim(d.vin.value)!=''){
        if(validChar(d.vin.value)==false){                                  
            msg =msg+"<li>Invalid VIN."+"</li>"  ;    
        }
    }
    
    if(Trim(d.engine_size.value)!=''){
        if(validChar(d.engine_size.value)==false){    
              msg =msg+"<li>Invalid Engine Size."+"</li>"  ;      
        }
    }     
       
    if(Trim(d.asking_price.value) !=''){  
         if(!commaSepNumcheck(d.asking_price.value)){
                    msg =msg+"<li>Invalid Asking Price."+"</li>"  ;   
         } 
    }  
    
    /*
    if(Trim(d.close_date.value) ==''){        
            msg =msg+"<li>Close Date is Required."+"</li>"  ;   
          
    } 
    */
    if(Trim(d.close_date.value) !=''){                            
         if(isDate(d.close_date.value)==false){
            msg =msg+"<li>Invalid Close Date."+"</li>"  ;           
         }
    }    
    
    if(Trim(d.close_date1.value)==''){  
        if(Trim(d.close_date.value) !=''){ 
             valDate     =  d.close_date.value 
             if(!EFFECTIVE_DATE_OnChange(valDate)){
                   msg =msg+"<li>Please select later date."+"</li>"  ;                          
             } 
        }
        
        if(Trim(d.close_date.value) !=''){ 
            if(!fnFutureDateLimit(d.close_date.value,d.after_date.value)){
                msg =  msg+"<li>Please select less than or equal to 60 days."+"</li>"  ;  
            }
        }
    }
    
   
    
    if(Trim(d.lstState.value)=='~'){       
          msg =msg+"<li>State is Required."+"</li>"  ;  
    }  
    if(Trim(d.lstCity1.value)=='~'){
        msg =msg+"<li>City is Required."+"</li>"  ;  
    }  
     if(Trim(d.zip.value)==''){            
        msg =msg+"<li>Zip is Required."+"</li>"  ;                 
     }       
     if(!isInteger(d.zip.value)){                
        msg =msg+"<li>Invalid Zip."+"</li>"  ;     
     }
     if(Trim(d.contact_name.value)==''){ 
        msg =msg+"<li>Contact Name is Required."+"</li>"  ; 
     } 
     if(Trim(d.phone1.value)=='' && Trim(d.phone2.value)=="" && Trim(d.phone3.value)=="" && (Trim(d.contact_email.value)=='')  ){ 
        msg =msg+"<li>Contact phone or email is Required."+"</li>"  ; 
     }
     else{   
          if(Trim(d.contact_email.value) !=''){
             if(!isValidEmail(d.contact_email.value)){                          
                   msg =msg+"<li>Invalid Contact Email."+"</li>"  ;     
             }  
          }
          else{    
              if(Trim(d.phone1.value) !='' && Trim(d.phone2.value) !="" && Trim(d.phone3.value) !=""){       
                if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
                {
                        msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;   
                }
                if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
                {
                   msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;  
                }   
              }  
              
          }
     
  }                                                                      
  if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
  }
  else{
        return true;
  }
    
}

 function fncCloseThisAd(id,tableName,fieldName,statusNumber,condField ){   
   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?closeid="+id+'&closeTableName='+tableName+'&closeFieldName='+fieldName+'&statusNumber='+statusNumber+'&condField='+condField;  
   
   xmlHttp.onreadystatechange= fncCloseThisAdResponse;    
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);             
 }
 
function fncCloseThisAdResponse(){
	alert('');
   if (xmlHttp.readyState==4)
   {         
     if(xmlHttp.responseText == 1){      
        document.getElementById('closeDiv').innerHTML ='Closed successfully';
     }
     else{ 
     
        document.getElementById('closeDiv').innerHTML ='Error Occurred!';
     }
                                                   
   }  
 
 }

  function fncCouponInactive(cid,status ){   

   xmlHttp=GetXmlHttpObject();      
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?acitveCoupon="+cid+'&status='+status;  
    document.getElementById('status'+cid).innerHTML ='loading..';
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
	       document.getElementById('status'+cid).innerHTML =result;
	   }
   };    
  // alert('3');
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);             
 }


 function  regProperty(){
 
    var dat = new Date(); 
    var curr_year = dat.getFullYear();  
 
    d = document.addProperty;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
                              
    
    if(Trim(d.lstUnitType.value)=='~'){
            msg =msg+"<li>Unit Type is Required."+"</li>"  ;                       
    } 
    if(Trim(d.lstSaleType.value)=='~'){
            msg =msg+"<li>Sale Type is Required."+"</li>"  ;                       
    }  
      if(Trim(d.close_date.value) ==''){        
            msg =msg+"<li>Close Date is Required."+"</li>"  ;   
          
    } 
    if(Trim(d.close_date.value) !=''){                            
         if(isDate(d.close_date.value)==false){
            msg =msg+"<li>Invalid Close Date."+"</li>"  ;           
         }
    }    
    
    if(Trim(d.close_date1.value)==''){  
        if(Trim(d.close_date.value) !=''){ 
             valDate     =  d.close_date.value 
             if(!EFFECTIVE_DATE_OnChange(valDate)){
                   msg =msg+"<li>Please select later date."+"</li>"  ;                          
             } 
        }
        
        if(Trim(d.close_date.value) !=''){ 
            if(!fnFutureDateLimit(d.close_date.value,d.after_date.value)){
                msg =  msg+"<li>Please select close date less than or equal to 30 days."+"</li>"  ;  
            }
        }
    }
   
       
    if(Trim(d.address.value)==''){
            msg =msg+"<li>Address is Required."+"</li>"  ;                       
    }
    if(Trim(d.address.value) !=''){  
        if(validChar(d.address.value)==false){ 
             msg =msg+"<li>Invalid Address."+"</li>"  ; 
        } 
    }
    
    if(Trim(d.lstState.value)=='~'){       
          msg =msg+"<li>State is Required."+"</li>"  ;  
    }  
    if(Trim(d.lstCity1.value)=='~'){
        msg =msg+"<li>City is Required."+"</li>"  ;  
    }
    
    if(Trim(d.zip.value) !=''){ 
        if(!isInteger(d.zip.value)){     
               msg =msg+"<li>Invalid Zip."+"</li>"  ; 
        }    
    } 
    if(Trim(d.mls.value)!=''){ 
            if(!isInteger(d.mls.value)){   
               msg =msg+"<li>Invalid MLS #."+"</li>"  ;  
           }
    }
       
    if(Trim(d.price.value)==''){        
             msg =msg+"<li>Price is Required."+"</li>"  ;   
    } 
    if(Trim(d.price.value) !=''){     
        if(!commaSepNumcheck(d.price.value)){                 
                msg =msg+"<li>Invalid Price."+"</li>"  ;    
        }
    }  
    if(Trim(d.taxes.value)!=''){ 
        if(!commaSepNumcheck(d.taxes.value)){            
              msg =msg+"<li>Invalid Taxes."+"</li>"  ;     
        } 
    }
    if(Trim(d.deposit.value)!=''){ 
        if(!commaSepNumcheck(d.deposit.value)){     
                msg =msg+"<li>Invalid Deposit."+"</li>"  ;  
        } 
    }
    if(Trim(d.application_fee.value)!=''){ 
        if(!commaSepNumcheck(d.application_fee.value)){    
           msg =msg+"<li>Invalid Application Fee."+"</li>"  ;   
        } 
    }
    if(Trim(d.country.value)!=''){ 
       if(validChar(d.country.value)==false){                      
            msg =msg+"<li>Invalid Country."+"</li>"  ;     
        } 
    } 
    if(Trim(d.subdivision.value)!=''){ 
        if(validChar(d.subdivision.value)==false){      
                 msg =msg+"<li>Invalid Subdivision."+"</li>"  ;                 
        } 
    } 
    if(Trim(d.style.value)!=''){ 
        if(validChar(d.style.value)==false){                      
               msg =msg+"<li>Invalid Style."+"</li>"  ;    
        } 
    }
    if(Trim(d.square_footage.value)!=''){ 
        if(!commaSepNumcheck(d.square_footage.value)){ 
               msg =msg+"<li>Invalid Approx. Sq. Ft."+"</li>"  ;       
        } 
    }
    if(Trim(d.year_built.value)!=''){ 
        if(!isInteger(d.year_built.value)){                 
          msg =msg+"<li>Invalid Built Year."+"</li>"  ;   
        }  
        if(d.year_built.value>curr_year){                 
           msg =msg+"<li>Invalid Year."+"</li>"  ;    
        } 
    }
    if(Trim(d.exterior.value)!=''){ 
           if(validChar(d.exterior.value)==false){                      
                msg =msg+"<li>Invalid Exterior."+"</li>"  ;     
           } 
    }
    if(Trim(d.roof_age.value)!=''){ 
        if(!isInteger(d.roof_age.value)){ 
            msg =msg+"<li>Invalid Roof Age."+"</li>"  ;                                
        }  
    }
     if(Trim(d.acres.value)!=''){    
        if(!numCheck(d.acres.value)){     
            msg =msg+"<li>Invalid Acres."+"</li>"  ;   
        }
     }
     
    /*
   condition= 0;
   if(Trim(d.lstBedroom.value)!='0'){       
      condition = 1 ; 
   }
   if(Trim(d.lstBathRoomFull.value)!='0'){       
      condition = 1 ; 
   }
   if(Trim(d.lstBathRoomHalf.value)!='0'){       
      condition = 1 ; 
   }
   
   if(Trim(d.lstLivingArea.value)!='0'){       
      condition = 1 ; 
   }
   if(Trim(d.lstattached.value)!='0'){       
      condition = 1 ; 
   }
   if(Trim(d.lstFirePlace.value)!='0'){       
      condition = 1 ; 
   }
   if(Trim(d.lstdetached.value)!='0'){       
      condition = 1 ; 
   }
   if(Trim(d.lstDining.value)!='0'){       
      condition = 1 ; 
   }
   if(condition==0){  
    if(!fnSelectConfirmation()){                  
        msg =msg+"<li>Features is Required."+"</li>"  ;                             
    }
   }    */
   if(Trim(d.txtDetails.value)==''){            
        msg =msg+"<li>Details is Required."+"</li>"  ;   
   } 
   if(Trim(d.txtContactName.value)==''){        
        msg =msg+"<li>Contact Name is Required."+"</li>"  ;  
   }  
   if( Trim(d.phone1.value)=='' || Trim(d.phone2.value)=='' || Trim(d.phone3.value)==''  ){ 
        msg =msg+"<li>Contact phone is Required."+"</li>"  ; 
   }
   if(Trim(d.phone1.value) !='' && Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="" ){       
        if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4  )
        {
                msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;   
        }
        if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value) )
        {
           msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;  
        }   
   } 
   if(Trim(d.extension.value) !=''  ){
   
     if(!isValidNumber(d.extension.value)){
     msg =msg+"<li>Invalid Contact Phone (Extension)."+"</li>"  ;   
     }
   }
  
  if(Trim(d.txtContactEmail.value) !=''){
         if(!isValidEmail(d.txtContactEmail.value)){                          
               msg =msg+"<li>Invalid Contact Email."+"</li>"  ;     
         }  
  } 
  if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ; 
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
  }
  else{
        return true;
  }
 }
 
 
  function regBusinessTemplate(){       
    d = document.regProfile;     
    var phoneNum = 0;
    var faxNum = 0;
    
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';   
    
    var oEditor = FCKeditorAPI.GetInstance('about_us') ; 
    if(oEditor.GetXHTML( true ) == "") {
             msg =msg+"<li>About Us is Required."+"</li>"  ;  
            
    }
     /*
    var oEditor = FCKeditorAPI.GetInstance('txtHours') ;
   if(oEditor.GetXHTML( true ) == "") { 
            msg =msg+"<li>Hours of Operation is Required."+"</li>"  ;                       
    }
    var oEditor = FCKeditorAPI.GetInstance('txtSpecial') ;  
    if(oEditor.GetXHTML( true ) == "") { 
            msg =msg+"<li>Specials is Required."+"</li>"  ;                       
    }
    var oEditor = FCKeditorAPI.GetInstance('txtEmployeement') ; 
   
    if(oEditor.GetXHTML( true ) == "") {      
            msg =msg+"<li>Employment is Required."+"</li>"  ;                       
    }
    */
    
    if( Trim(d.phone1.value)=='' || Trim(d.phone2.value)=='' || Trim(d.phone3.value)==''  ){ 
        msg =msg+"<li>Contact phone is Required."+"</li>"  ; 
   }
   if(Trim(d.phone1.value) !='' && Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="" ){       
        if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4  )
        {
                msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;   
        }
        if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value) )
        {
           msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;  
        }   
   } 
   if(Trim(d.extension.value) !=''  ){
   
     if(!isValidNumber(d.extension.value)){
     msg =msg+"<li>Invalid Contact Phone (Extension)."+"</li>"  ;   
     }
   }
   
   if(Trim(d.fax1.value) !='' || Trim(d.fax2.value) !="" || Trim(d.fax3.value) !=""  ){       
    
        if(Trim(d.fax1.value).length!=3 || Trim(d.fax2.value).length!=3 || Trim(d.fax3.value).length!=4  )
        {
                faxNum =1 ; 
        }
        if(!isValidNumber(d.fax1.value) || !isValidNumber(d.fax2.value) || !isValidNumber(d.fax3.value))
        {
           faxNum =1
        }   
   } 
   
  
   if(faxNum==1){
     msg =msg+"<li>Invalid Fax Number."+"</li>"  ;   
   }  
   if(Trim(d.txtEmail.value) !=''){
     if(!isValidEmail(d.txtEmail.value)){                          
           msg =msg+"<li>Invalid Email Address."+"</li>"  ;     
     }  
   }     
   if(Trim(d.txtUrl.value) !=''){
       if(urlValidation(d.txtUrl.value)==false){
           msg =msg+"<li>Invalid Web Site URL ."+"</li>"  ;   
       
       }
   }     

       
   if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
  }
  else{
        return true;
  }
  
  }
  
   function regJob(){
   
    d = document.addJob;     
    var phoneNum = 0;
    var faxNum = 0;
    
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';   
    
   if(Trim(d.close_date.value) !=''){  
        cd= d.close_date.value
        dateArr = cd.split(" ")        
         if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid Close Date."+"</li>"  ;           
         }
         else {
              if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (Close Date)."+"</li>"  ;                          
              } 
         }
    } 
    if(Trim(d.position.value)==''){
        msg =msg+"<li>Position is Required."+"</li>"  ;      
    }  
    if(Trim(d.min_pay_range.value) !=''){       
         if(!numCheck(d.min_pay_range.value)){  
                msg =msg+"<li>Invalid Pay Range."+"</li>"  ;           
         }
    }
    if(Trim(d.max_pay_range.value) !=''){ 
          if(!numCheck(d.max_pay_range.value)){
                msg =msg+"<li>Invalid Pay Range."+"</li>"  ;           
          }
    } 
    if( (Trim(d.min_pay_range.value) !='') && (Trim(d.max_pay_range.value) !='') ){ 
     
        if((numCheck(d.max_pay_range.value)) && (numCheck(d.min_pay_range.value)) ){ 
           if(d.min_pay_range.value > d.max_pay_range.value){
                msg =msg+"<li>Invalid Pay Range."+"</li>"  ;  
           }
        }  
     
     }
     
      
    if(Trim(d.lstState.value)=='~'){
       msg =msg+"<li>Job State is Required."+"</li>"  ;     
    }
    if(Trim(d.lstCity1.value)=='~'){
      msg =msg+"<li>Job City is Required."+"</li>"  ;  
    }  
    /*
     if(!fnSelectConfirmation()){
         msg =msg+"<li> Benefits is Required."+"</li>"  ;    
    }  */
    
    if(Trim(d.additional_details.value)==''){
         msg =msg+"<li>Details is Required."+"</li>"  ;  
    }     
    if(Trim(d.phone1.value) !='' || Trim(d.phone2.value) !="" || Trim(d.phone3.value) !=""  ){    
        if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4  )
        {
                phoneNum =1 ; 
        }
        if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
        {
           phoneNum =1
        }   
    } 
    if(msg !=''){ 
            msg  = "<ul><br>"+msg+"</ul>" ;   
            scroll(0,300);                                          
            document.getElementById("errordiv").innerHTML=msg;      
            return false;
    }
    else{
            return true;
    }  
   }  
   
function regClassified(){
    d = document.addClassified;   
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
    
    
  
    
     
    
    if(Trim(d.close_date.value) !=''){  
        cd= d.close_date.value
        dateArr = cd.split(" ")        
         if(isDate(dateArr[0])==false){  
            msg =msg+"<li>Invalid Close Date."+"</li>"  ;           
         }
         else{
            if(!EFFECTIVE_DATE_OnChange(dateArr[0])){
                   msg =msg+"<li>Please select later date (Close Date)."+"</li>"  ;                          
            }
            
             if(Trim(d.close_date.value) !=''){ 
                    if(!fnFutureDateLimit(dateArr[0],d.after_date.value)){
                        msg =  msg+"<li>Please select less than or equal to 30 days."+"</li>"  ;  
                    }
             }    
         }
    }   
    if(Trim(d.txtTitle.value)==''){          
             msg =msg+"<li>Title is Required."+"</li>"  ;           
    } 
    if(Trim(d.lstCategory.value)=='~'){          
             msg =msg+"<li>Category is Required."+"</li>"  ;           
    }
    if(Trim(d.txtPrice.value) ==''){ 
        msg =msg+"<li>Price is Required."+"</li>"  ;   
    }
    
    if(Trim(d.txtPrice.value) !=''){  
         if(!commaSepNumcheck(d.txtPrice.value)){
                    msg =msg+"<li>Invalid Price."+"</li>"  ;   
         } 
    }
       
    if(Trim(d.additional_details.value)==''){       
          msg =msg+"<li>Additional Details is Required."+"</li>"  ;  
    }  
    if(Trim(d.contact_name.value)==''){ 
        msg =msg+"<li>Contact Name is Required."+"</li>"  ; 
    } 
    if(Trim(d.phone1.value)=='' && Trim(d.phone2.value)=="" && Trim(d.phone3.value)=="" && (Trim(d.contact_email.value)=='')  ){ 
        msg =msg+"<li>Contact phone or email is Required."+"</li>"  ; 
    }
     else{   
          if(Trim(d.contact_email.value) !=''){
             if(!isValidEmail(d.contact_email.value)){                          
                   msg =msg+"<li>Invalid Contact Email."+"</li>"  ;     
             }  
          }
          else{    
              if(Trim(d.phone1.value) !='' && Trim(d.phone2.value) !="" && Trim(d.phone3.value) !=""){       
                if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
                {
                        msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;   
                }
                if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
                {
                   msg =msg+"<li>Invalid Contact Phone."+"</li>"  ;  
                }   
              }  
              
          }
     
  }    
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
    
}

 function hideMyStatus(userid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?hideStatusUserId="+userid; 
    
    xmlHttp.onreadystatechange=  fnHideMyStatus
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

 }
 
  function fnHideMyStatus(){
    if (xmlHttp.readyState==4)
    {       
       var result = Trim(xmlHttp.responseText) 
       document.getElementById('status').innerHTML = '';
    }
  }

 function ChangeClassifiedCloseDate(txtDateValue){
 

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?txtDateValue="+txtDateValue; 
    
    xmlHttp.onreadystatechange=  fnSessionDateClassified
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

 
 }
 
  function fnSessionDateClassified(){
  if (xmlHttp.readyState==4)
   {   
       
       var result = Trim(xmlHttp.responseText) 
       document.getElementById('errordiv').innerHTML =result;
   }
  }

 function fnAssignSessionAuto(autosesid, desfile){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?autosesid="+autosesid+"&autodesfile="+desfile; 
    
    xmlHttp.onreadystatechange=  fnSessionClassified
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  } 


  function fnAssignSessionClassified(classfiedsesid, desfile){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?classfiedsesid="+classfiedsesid+"&classdesfile="+desfile;
    
    xmlHttp.onreadystatechange=  fnSessionClassified
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  } 
  
  function fnSessionClassified(){
   if (xmlHttp.readyState==4)
   {    
        var result = Trim(xmlHttp.responseText)
        window.location.href=result;     
   } 
  }    
  
function fnAssignSessionRealEstate(realestatesesid, desfile){          
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?realestatesesid="+realestatesesid+"&realdesfile="+desfile; 
    
    xmlHttp.onreadystatechange=  fnSessionClassified
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  } 

function fnCloseCommunity(id,type) {
   
	   xmlHttp=GetXmlHttpObject();     
	   if (xmlHttp==null)
	   {
		  alert("Your browser does not support AJAX!");
		  return;
	   } 
	   var url="ajax_member.php";
	   url=url+"?communityId="+id+"&type="+type;
	   
	   xmlHttp.onreadystatechange= function () {
		   if (xmlHttp.readyState==4)
		   {   
			   var result = Trim(xmlHttp.responseText) 
			   location.href='myClassifieds.php';
		   }
	   }; 
	   xmlHttp.open("GET",url,true);
	   xmlHttp.send(null); 


	 //document.getElementById('selectImage').innerHTML = "<img src='banner_ad/"+ImageName+"' />";
  }
    
  
  
   function regGalleryPhoto(){   
     d = document.regPhoto;   
     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 

     if(Trim(d.txtPhoto1.value)==''){   
            msg =msg+"<li>Photo is Required."+"</li>"  ; 
     }  
       
    if(Trim(d.txtPhoto1.value)!=''){
            if (!/(\.(jpg|jpeg))$/i.test(d.txtPhoto1.value)){             
               msg =msg+"<li>Photo must be of type JPEG (*.jpg)."+"</li>"  ;  
            }
     }    
     if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     } 
   }
   
function fnChangeAdBanner(){
    d = document.addimg; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
        
    if(Trim(d.txtFile.value)==''){
        msg =msg+"Banner image is Required." ;             
    }    
     if(msg !=''){ 
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     }         
}
   
function fnbusinessImage(){

  d = document.addimg;   
     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';   
       
    if(Trim(d.txtHeaderImage.value)!=''){
            if (!/(\.(jpg|jpeg|gif))$/i.test(d.txtHeaderImage.value)){             
               msg =msg+"<li>Header Image must be of type JPEG (.jpg) or GIF (.gif)."+"</li>"  ;  
            }
     }   
     
      if(Trim(d.txtLogo.value)!=''){
            if (!/(\.(jpg|jpeg|gif))$/i.test(d.txtLogo.value)){             
               msg =msg+"<li>Business Logo Image must be of type JPEG (.jpg) or GIF (.gif)."+"</li>"  ;  
            }
     } 
     
     
     if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     } 
}

 function fnChangePassword(){
    d = document.chgPassword; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
    
     
     if(Trim(d.oldpassword.value)==''){            
            msg =msg+"<li>Old Password is Required."+"</li>"  ;  
     }
    
    if(Trim(d.password.value)==''){            
            msg =msg+"<li>Password is Required."+"</li>"  ;  
     } 
     if(Trim(d.password.value) !=''){ 
         if(passwordValidation(d.password.value) ==false){                        
                 msg =msg+"<li>Invalid Password."+"</li>"  ;    
         }    
     }
  
     if(Trim(d.password_confirm.value)==''){
            msg =msg+"<li>Verify Password is Required."+"</li>"  ;           
     }     
         
     
     if(Trim(d.password_confirm.value)!='' &&  Trim(d.password.value) !=''){
         if( Trim(d.password.value) !='' && Trim(d.password_confirm.value) !='' ){ 
             if(d.password.value !=d.password_confirm.value){        
                     msg =msg+"<li>Password and Verify Password  are not same."+"</li>"  ;   
             } 
        }
     }
    
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
    
 }
 
 function regBusinessContact(){
     d = document.regContact; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
    
    if(Trim(d.lstContactType.value)=='~'){            
            msg =msg+"<li>Contact Type is Required."+"</li>"  ;  
    }   
    
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;   
            scroll(0,300);  
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
 }
 
  function businessSelect(){
   d = document.regBus; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
    
    if(Trim(d.lstBusiness.value)=='~'){            
            msg =msg+"<li>Business is Required."+"</li>"  ;  
    }   
    
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;   
            scroll(0,300);  
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
  }
 
 function fnResetPassword(){
 d = document.chgPassword; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';   
               
               
    if(Trim(d.email.value)==''){            
            msg =msg+"<li>E-Mail is Required."+"</li>"  ;  
    } 
    if(Trim(d.password.value)==''){            
            msg =msg+"<li>Password is Required."+"</li>"  ;  
     } 
     if(Trim(d.password.value) !=''){ 
         if(passwordValidation(d.password.value) ==false){                        
                 msg =msg+"<li>Invalid Password."+"</li>"  ;    
         }    
     }
  
     if(Trim(d.password_confirm.value)==''){
            msg =msg+"<li>Verify Password is Required."+"</li>"  ;           
     }     
         
     
     if(Trim(d.password_confirm.value)!='' &&  Trim(d.password.value) !=''){
         if( Trim(d.password.value) !='' && Trim(d.password_confirm.value) !='' ){ 
             if(d.password.value !=d.password_confirm.value){        
                     msg =msg+"<li>Password and Verify Password  are not same."+"</li>"  ;   
             } 
        }
     }
    
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;  
            scroll(0,300);   
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
 }
 
  function fnForgotpassword(){
  
    d = document.fogotPass; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
  
    if(d.email.value ==''){           
            msg =msg+"<li>Email is Required."+"</li>"  ;            
     } 
     if(!isValidEmail(d.email.value) && Trim(d.email.value) !=''){  
            msg =msg+"<li>Invalid Email Address."+"</li>"  ; 
     } 
      if(d.txtSecurityCode.value ==''){           
            msg =msg+"<li>Security Code is Required."+"</li>"  ;            
     } 
     
     
       if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ; 
            scroll(0,300);    
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
  
  }
  
 function regMessage(){
    d = document.messageSub;   
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
                    
    
    if(Trim(d.txtSearch.value)==''){          
        msg =   msg+"Send to is Required."+"<br>";      
         d.txtEmail.value=''; 
        
    }  
    if(Trim(d.txtSubject.value)==''){          
        msg =   msg+" Subject  is Required."+"<br>";       
    }  
    if(Trim(d.txtSearch.value)==''){          
        msg =   msg+"Message is Required."+"<br>";       
    }               
    if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;   
        scroll(0,300);    
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
          d.submit();
    } 
    
          
 }
 
function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}  



function checkAge(bDate){ 
        var today = new Date(); 
        var d = bDate;
        if (!/\d{4}\-\d{2}\-\d{2}/.test(d)) {   // check valid format
          msg = "Invalid Date";
          return msg;
        }

        d = d.split("-");
        var byr = parseInt(d[0]); 
        var nowyear = today.getFullYear();
        if (byr >= nowyear || byr < 1900) {  // check valid year
              msg = "Invalid Date";
          return msg;
        }
        var bmth = parseInt(d[1],10)-1;   // radix 10!
        if (bmth <0 || bmth >11) {  // check valid month 0-11
             msg = "Invalid Date";
          return msg;
        }
        var bdy = parseInt(d[2],10);   // radix 10!
        var dim = daysInMonth(bmth+1,byr);
        if (bdy <1 || bdy > dim) {  // check valid date according to month
             msg = "Invalid Date";
          return msg;
        }

        var age = nowyear - byr;
        var nowmonth = today.getMonth();
        var nowday = today.getDate();
        if (bmth > nowmonth) {age = age - 1}  // next birthday not yet reached
        else if (bmth == nowmonth && nowday < bdy) {age = age - 1}

        
        if (age < 13) {
              msg = "You must be 13 years of age to become a member."
              return  msg ;
        }
        else  {
             msg =''
             return  msg ;
        }
}


function daysInMonth(month,year) {  // months are 1-12
var dd = new Date(year, month, 0);
return dd.getDate();
} 




 function fnSignUp(){

 
    var d = new Date();
   var curr_date = d.getDate();
   var curr_month = d.getMonth()+1;
   var curr_year = d.getFullYear();
   var startyear = curr_year-100;
   var cyears = curr_year.toString();
   cyears = cyears.substr(2,2);
 
 
   d = document.signup;  
     
   
    
     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
    condition =1
      

      if(Trim(d.first_name.value)==''){          
             msg =msg+"<li> First Name is Required."+"</li>"  ;       
      }  
        
     if(IsCharacter(d.first_name.value) ==false){           
         msg =msg+"<li>Invalid First Name."+"</li>"  ;         
       
     }  
     if(Trim(d.last_name.value)==''){      
            msg =msg+"<li>Last Name is Required."+"</li>"  ;      
     }    
     if(IsCharacter(d.last_name.value) ==false){ 
            msg =msg+"<li>Invalid Last Name."+"</li>"  ;      
     }        
     if(d.email.value ==''){           
            msg =msg+"<li>Email is Required."+"</li>"  ;            
     } 
     if(!isValidEmail(d.email.value) && Trim(d.email.value) !=''){  
            msg =msg+"<li>Invalid Email Address."+"</li>"  ; 
     } 
     
     if(Trim(d.password.value)==''){            
            msg =msg+"<li>Password is Required."+"</li>"  ;  
     }  
     if(passwordValidation(d.password.value) ==false){                        
             msg =msg+"<li>Invalid Password."+"</li>"  ;    
     }    
  
     if(Trim(d.password_confirm.value)==''){
            msg =msg+"<li>Verify Password is Required."+"</li>"  ;           
     }
     if( Trim(d.password.value) !='' && Trim(d.password_confirm.value) !='' ){ 
         if(d.password.value !=d.password_confirm.value){        
                 msg =msg+"<li>Password and Verify Password  are not same."+"</li>"  ;   
         } 
    }
     if(Trim(d.lstState.value)=='~'){
             msg =msg+"<li>State is Required."+"</li>"  ;    
     }  
     if(Trim(d.lstCity1.value)=='~'){
            msg =msg+"<li>City is Required."+"</li>"  ;   
     } 
     if(Trim(d.gender.value)=='~'){
            msg =msg+"<li>Gender is Required."+"</li>"  ;   
     }  

     
  if(d.txtBirthMonth.value=='~'){
         msg =msg+"<li>Birth Date is Required."+"</li>"  ;   
         condition=0;      
  }     
  if( condition== 1){  
       bDate= d.txtBirthYear.value+'-'+d.txtBirthMonth.value+'-'+d.txtBirthDay.value;  
       msg1 =  checkAge(bDate)
       if(msg1 !='')
        msg =msg+"<li>"+msg1+"</li>";
  }
   
   
   if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;   
            scroll(0,300);    
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     } 
	
       
 }
 
 
  function termValidation(){
    d = document.frmTerm; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
    if(Trim(d.txtTerm.value)=='0'){          
             msg =msg+"<li> Please read and agree the terms of use ."+"</li>"  ;       
    }
    if(Trim(d.txtSecurityCode.value)==''){
        msg =msg+"<li> Security Code is Required."+"</li>"  ;   
    }     
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,500);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
    
  }
  
  function fncAdContact(){    
    d = document.addContact; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
   
    
    if(Trim(d.txtName.value)==''){          
             msg =msg+"<li>Name is Required."+"</li>"  ;       
    }
    if(Trim(d.txtEmail.value)==''){          
             msg =msg+"<li>E-mail is Required."+"</li>"  ;       
    }
    
    if(Trim(d.txtEmail.value) !=''){  
        if(!isValidEmail(d.txtEmail.value) && Trim(d.txtEmail.value) !=''){             
           msg =msg+"<li>Invalid Email Address."+"</li>"  ;
        } 
    }
    
    
    if(Trim(d.txtOffice.value)==''){          
             msg =msg+"<li>Office number is Required."+"</li>"  ;       
    }
 
    if(Trim(d.txtCompany.value)==''){          
             msg =msg+"<li>Company Name is Required."+"</li>"  ;       
    }   
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
    
  }  
  function regBusiness(){
    d = document.regBus; 
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
    
   
     if(Trim(d.txtCompanyName.value)==''){          
             msg =msg+"<li> Company Name is Required."+"</li>"  ;       
     }
    
     if(Trim(d.lstCategory.value)=='~'){          
             msg =msg+"<li> Category is Required."+"</li>"  ;       
     }
      if(Trim(d.lstEmployee.value)=='~'){          
             msg =msg+"<li> Number of Employees is Required."+"</li>"  ;       
     } 
     if(Trim(d.txtStreet1.value)==''){          
             msg =msg+"<li> Street1 is Required."+"</li>"  ;       
     } 
     if(Trim(d.lstState.value)=='~'){          
             msg =msg+"<li> State is Required."+"</li>"  ;       
     }      
     if(Trim(d.lstCity1.value)=='~'){          
             msg =msg+"<li> City is Required."+"</li>"  ;       
     } 
     if(Trim(d.zip.value)==''){          
             msg =msg+"<li> Zip is Required."+"</li>"  ;       
     } 
     else if(!isInteger(d.zip.value)){   
        msg =msg+"<li>Invalid Zip ."+"</li>"  ; 
     }
     
    if(Trim(d.phone1.value)=='' || Trim(d.phone2.value)=="" || Trim(d.phone3.value)=="" )
    {
        msg =msg+"<li> Phone number is Required."+"</li>"  ;              
    }
    else if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
    {
          msg =msg+"<li> Invalid  phone."+"</li>"  ;   
    } 
    else if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
     {
        msg =msg+"<li> Invalid  phone."+"</li>"  ;          
     }   
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
  }
  
  function regStory(){
   d = document.regFrm; 
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg =''; 
   
    if(Trim(d.txtTitle.value)==''){          
             msg =msg+"<li> Title is Required."+"</li>"  ;       
    }
    
    if(Trim(d.txtURL.value)==''){          
             msg =msg+"<li> URL is Required."+"</li>"  ;       
    }
    if(Trim(d.txtNotes.value)==''){          
             msg =msg+"<li> Notes is Required."+"</li>"  ;       
    }   
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
    }
    else{
            return true;
    } 
  }
  
  function counterUpdate(opt_countedTextBox, opt_countBody, opt_maxSize) {
        var countedTextBox = opt_countedTextBox ? opt_countedTextBox : "counttxt";
        var countBody = opt_countBody ? opt_countBody : "countBody";
        var maxSize = opt_maxSize ? opt_maxSize : 1024;

        var field = document.getElementById(countedTextBox);

        if (field && field.value.length >= maxSize) {
                field.value = field.value.substring(0, maxSize);
        }
        var txtField = document.getElementById(countBody);
                if (txtField) { 
                txtField.innerHTML = field.value.length;
        }
}
 
 
  function fnBasicInfo(){  
    var d = new Date();
   var curr_date = d.getDate();
   var curr_month = d.getMonth()+1;
   var curr_year = d.getFullYear();
   var startyear = curr_year-100;
   var cyears = curr_year.toString();
   cyears = cyears.substr(2,2);
 
 
     d = document.regBasic;       
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';  
    condition =1
      

      if(Trim(d.first_name.value)==''){          
             msg =msg+"<li> First Name is Required."+"</li>"  ;       
      }  
        
     if(IsCharacter(d.first_name.value) ==false){           
         msg =msg+"<li>Invalid First Name."+"</li>"  ;         
       
     }  
     if(Trim(d.last_name.value)==''){      
            msg =msg+"<li>Last Name is Required."+"</li>"  ;      
     }    
     if(IsCharacter(d.last_name.value) ==false){ 
            msg =msg+"<li>Invalid is Required."+"</li>"  ;      
     }        
     if(d.email.value ==''){           
            msg =msg+"<li>Email is Required."+"</li>"  ;            
     } 
     if(!isValidEmail(d.email.value) && Trim(d.email.value) !=''){  
            msg =msg+"<li>Invalid Email Address."+"</li>"  ; 
     } 
     
    
     if(Trim(d.lstState.value)=='~'){
             msg =msg+"<li>State is Required."+"</li>"  ;    
     }  
     if(Trim(d.lstCity1.value)=='~'){
            msg =msg+"<li>City is Required."+"</li>"  ;   
     } 
     if(Trim(d.gender.value)=='~'){
            msg =msg+"<li>Gender is Required."+"</li>"  ;   
     }  
     
    if(d.txtBirthMonth.value=='~'){
         msg =msg+"<li>Birth Date is Required."+"</li>"  ;   
         condition=0;      
   }     
   if( condition== 1){  
       bDate= d.txtBirthYear.value+'-'+d.txtBirthMonth.value+'-'+d.txtBirthDay.value;  
       msg1 =  checkAge(bDate)
       if(msg1 !='')
        msg =msg+"<li>"+msg1+"</li>";
   }   
   if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     } 
  }
  
  function fnProfilePhoto(){
    d = document.photoUpoload;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';        
    
    if(Trim(d.photo.value)==''){ 
        msg =msg+"<li>Photo is Required."+"</li>"  ;  
    } 
    if(Trim(d.photo.value)!=''){
            if (!/(\.(jpg|jpeg))$/i.test(d.photo.value)){
             msg =msg+"<li>Photo must be of type JPEG (*.jpg)."+"</li>"  ; 
            }
     }  
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
     }
     else{
        return true;
     }  
  }
  
   function fnSubProfileCheck(){
    d = document.frmUserInfo;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("partDivRed").innerHTML=msg1;
    var msg ='';     
    
    
      
    if(Trim(d.txtUserName.value)==''){
            msg =msg+"<li>Username is Required."+"</li>"  ;    
    }        
    if(passwordValidation(d.txtUserName.value) ==false){      
            msg =msg+"<li>Invalid Username."+"</li>"  ; 
    }
   
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        document.getElementById("partDivRed").innerHTML=msg;
        return false;
     }
     else{
        return true;
     }  
  
   
   }
  
  function fnSubProfileInfo(){
   d = document.frmUserInfo;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';     
    
    
    if(Trim(d.txtTerm.value)=='0'){
            msg =msg+"<li>Review & Agree to the Terms of Service (TOS) ."+"</li>"  ;    
    }     
    if(Trim(d.txtUserName.value)==''){
            msg =msg+"<li>Username is Required."+"</li>"  ;    
    }        
    if(passwordValidation(d.txtUserName.value) ==false){      
            msg =msg+"<li>Invalid Username."+"</li>"  ; 
    }
   
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
     }
     else{
        return true;
     }  
  
   
  }
    function fnSubProfilePhotoInfo(){  
    
      d = document.photoUpoload;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';   
      
  
    
    if(Trim(d.photo.value)==''){ 
        msg =msg+"<li>Photo is Required."+"</li>"  ;  
    } 

    if(Trim(d.photo.value)!=''){
            if (!/(\.(jpg|jpeg))$/i.test(d.photo.value)){
             msg =msg+"<li>Photo must be of type JPEG (*.jpg)."+"</li>"  ; 
            }
     }  
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
     }
     else{
        return true;
     }  
  
  }
  
  
  function fnAboutMeInfo(){
     d = document.regAbout;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg =''; 
    
    if(Trim(d.lstRelation.value)=='~'){ 
        msg =msg+"<li>Relationship Status is Required."+"</li>"  ;  
    }   
     if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
     }
     else{
        return true;
     } 
  
  
  }
 
  function userLogin(){    
    d = document.regLogin;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
    
   
    
    if(d.email.value ==''){           
            msg =msg+"<li>Email is Required."+"</li>"  ;            
    }     
    if(!isValidEmail(d.email.value) && Trim(d.email.value) !=''){  
            msg =msg+"<li>Invalid Email Address."+"</li>"  ; 
    } 
     
    if(Trim(d.password.value)==''){            
            msg =msg+"<li>Password is Required."+"</li>"  ;  
    }  
    if(passwordValidation(d.password.value) ==false){                        
             msg =msg+"<li>Invalid Password."+"</li>"  ;    
    }   
    
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     } 
  }

  function fnCheckFacebook() {
	d = document.frmname;
	if(d.postFacebook.checked==true || d.postFacebook1.checked==true){
		document.getElementById('fstatus').value=1;
	}
	else {
		document.getElementById('fstatus').value=0;
	}

 }

  function fnCheckTwitter() {
	d = document.frmname;
	if(d.postTwitter.checked==true){
		document.getElementById('tstatus').value=1;
	}
	else {
		document.getElementById('tstatus').value=0;
	}
  }
  
   function fnRegPostMessage(){
    d = document.frmname;     
	
	limitText(d.txtMessage,d.countdown,140);

    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
  
	
    txtCategory = document.getElementById('txtCategory').value;  

	 if(document.getElementById('txtCategory').value =='LINK'){     
        if(Trim(document.getElementById('txtPreLink').value) == ''){   
             document.getElementById('txtCategory').value = '';
        }
    }
    
   if(document.getElementById('txtCategory').value =='PHOTO'){     
        if(Trim(document.getElementById('txtPostPhoto').value) == ''){   
             document.getElementById('txtCategory').value = '';
        }
    }  
    
    if(txtCategory==''){
        if(Trim(d.txtMessage.value)==''){            
                msg =msg+"My Post is Required."  ;  
        }     
    }     

	                 
    if(msg !=''){   
        msg  = "<ul>"+msg+"</ul>" ; 
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;      
    }
    else{     
        d.submit();
    } 
   }
   
   function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function limitTextReview(limitField, limitCount, limitNum) {

	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		document.getElementById(limitCount).innerHTML = limitNum - limitField.value.length;
	}
}

  
  
  function fnAddAnotherJobOption(val){
        var listbox=''
        divId = "div"+val; 
        
        linkval        = parseInt(val)+1;   
        
         var dat = new Date(); 
         var curr_year = dat.getFullYear(); 
         startYear  = curr_year-100;
         for(i=startYear;i<=curr_year;i++ ){
            listbox =listbox+"<option value='"+i+"'>"+i+'</option>';
          
         }   
        createdrow    = '<a onclick="removeAnotherJob('+val+')" id="link_jobform2" href="#photoref" style="background-image: url(images/icon_minimize.gif); display: block; width: 195px; background-repeat: no-repeat; background-position: 104px 4px;">Remove this Job</a><div id="jobform2_container" style="display: block;"><label for="company2" id="label_company2">Company: </label><textarea rows="5" cols="" name="txtCompany'+val+'" id="txtCompany'+val+'"></textarea><div class="clear"></div><label for="job_title2" id="label_job_title2">Job Title: </label><input type="text" id="txtTitle'+val+'" name="txtTitle'+val+'" /><div class="clear"></div><label for="time_period2" id="time_period2">Time Period: </label><select id="lstFrom'+val+'" name="lstFrom'+val+'"><option value="0">Select</option>'+listbox+'</select><p class="selectText">to</p><select id="lstTo'+val+'" name="lstTo'+val+'"><option value="0">Select</option>'+listbox+'</select><div class="clear"></div>  <label for="description2" id="label_description2"> Description: </label><textarea rows="5" cols="" name="txtDesc'+val+'" id="txtDesc'+val+'"></textarea><div class="clear"></div></div>';
        
    
        
        document.getElementById('likvalue').value =linkval; 
     
         eDIV             =     document.createElement("div");
         eDIV.setAttribute("id",divId);
         document.getElementById("div1").appendChild(eDIV);        
       
      document.getElementById('div2').innerHTML =createdrow;
       
    
    }
        
    function removeAnotherJob(val){
            divId = "div"+val;
            d = document.getElementById('div1');
            olddiv = document.getElementById(divId);
            d.removeChild(olddiv);

    }    
    
    
  function fnAddAnotherEducationOption(val){
       
        var divId = "divedu"+val; 
		var linkval        = parseInt(val)+1;    
		
		var abc = '<a onclick="fnRemoveAnotherEducationOption('+val+')" id="link_collegeform2" href="#eduref" style="background-image: url(images/icon_minimize.gif); display: block; width: 195px; background-repeat: no-repeat; background-position: 184px 4px;">Remove this College/University</a>';
                  
        var createdrow    = '<img src="images/close.gif" onclick="fnRemoveAnotherEducationOption('+val+')" alt="Remove this College/University"/><div id="collegeform2_container" style="display: block;"><label for="university2" id="label_university2">College University: </label><textarea rows="5" cols="" name="txtUniversity'+val+'" id="txtUniversity'+val+'"></textarea><div class="clear"></div><label for="class_year2" id="label_class_year2">Class Year: </label><input type="text" id="txtClassYear'+val+'" name="txtClassYear'+val+'" value="" maxlength="4" /><div class="clear"></div><label for="degree" id="label_degree">Degree: </label><input type="text" id="txtDegree'+val+'" name="txtDegree'+val+'" value="" /><div class="clear"></div></div>';
        document.getElementById('eduvalue').value =linkval; 
      
        var eDIV             =     document.createElement("div");
         eDIV.setAttribute("id",divId);
         document.getElementById("divedu1").appendChild(eDIV);        
      
      document.getElementById(divId).innerHTML =createdrow;
    
    }        
    
     function fnRemoveAnotherEducationOption(val){            
            divId = "divedu"+val; 
            d = document.getElementById('divedu1');
            olddiv = document.getElementById(divId);
            d.removeChild(olddiv);

    }  
    
    function fnAddAnotherSchoolOption(val){     
        divId = "divschool"+val; 
        linkval        = parseInt(val)+1;       
        createdrow    = '<a onclick="fnRemoveAnotherSchoolOption('+val+')" id="link_highSchoolForm2" href="#schoolref" style="background-image: url(images/icon_minimize.gif); display: block; width: 195px; background-repeat: no-repeat; background-position: 152px 4px;">Remove this High School</a><div id="highSchoolForm2_container" style="display: block;"><label for="password_confirm" id="label_password_confirm">High School: </label><input type="text" id="txtHighSchool'+val+'" name="txtHighSchool'+val+'" value="" /><div class="clear"></div> <label for="password_confirm" id="label_password_confirm">Class year: </label><input type="text" id="txtSchoolClassYear'+val+'" name="txtSchoolClassYear'+val+'" value="" maxlength="4"/><div class="clear"></div></div>';
        document.getElementById('schoolvalue').value =linkval;       
        eDIV             =     document.createElement("div");
        eDIV.setAttribute("id",divId);
        document.getElementById("divschool1").appendChild(eDIV);              
        document.getElementById(divId).innerHTML =createdrow;    
    }  
    
      function fnRemoveAnotherSchoolOption(val){      
            divId = "divschool"+val;
            d = document.getElementById('divschool1');
            olddiv = document.getElementById(divId);
            d.removeChild(olddiv);

    }  

               
 
   function BIRTH_DATE_OnChange(effDateChar)
    {
    
          var bufArray = effDateChar.split("/");     
          var effDateMonth = bufArray[0];   
          var effDateDay = bufArray[1];                        
          var effDateYear = bufArray[2];  
    
            firstDate = new Date(effDateYear, effDateMonth, effDateDay);
            fDate = new Date();
            y2=fDate.getFullYear();
            m2=fDate.getMonth()+1;
            d2=fDate.getDate();
            todayDate = new Date(y2,m2,d2);
            msPerDay = 24 * 60 * 60 * 1000;
            dayDiff = Math.floor((firstDate-todayDate)/ msPerDay);
            if(dayDiff>0)
            {
                return true;
            }
            else
            {
                return false;
            }
    }
 
 
 
 
function IsCharacter(sText)
{
   var ValidChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'";   
   var IsChar=true;
   var Char; 
   for (i = 0; i < sText.length && IsChar == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
             IsChar = false;
         }
      }
   return IsChar;
}


function passwordValidation(sText)
{
  
   var IsChar=true;
   var Char; 
   for (i = 0; i < sText.length && IsChar == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (Char == "'" || Char == '"') 
         {
             IsChar = false;
         }
      }
   return IsChar;
}
 
      

 function incrementCount(total){ 
    
var cValue = document.getElementById('curCount').value   ;

 cCount  = parseInt(cValue);
 
    if(cCount<total){
        newCount    =  cCount+1;  
        document.getElementById("curCountID").innerHTML=newCount; 
        document.getElementById("curCount").value=newCount; 
    } 

    
 }
 
  function degrementCount(){ 
    cValue    =  document.getElementById('curCount').value; 
    cCount  = parseInt(cValue);   
    if(cCount>1){
        newCount    =  cCount-1;  
        
        document.getElementById("curCountID").innerHTML=newCount; 
        document.getElementById("curCount").value=newCount; 
    }  
 }
 
 function sortingAdmin(field,sortorder){
         document.getElementById('hidSortField').value =field ;
         document.getElementById('hidSortOrder').value =sortorder ;         
         document.frmname.submit(); 
 }
 
 function scrollBarRightClick(){
     clickVal =  document.getElementById('scrollBarClick').value ;
     clickVal  = parseInt(clickVal)+1;
     if(clickVal>0){   
        document.getElementById('scrollBarClick').value = clickVal; 
        document.getElementById("secondaryBoxRight").style.display  = "none" ;    
        document.getElementById("secondaryBoxLeft").style.display = "block" ;  
    }   
 }

 function attachButtonDisable(){
    document.getElementById("actualBtn").style.display  = "none" ;   
    document.getElementById("finalBtn").style.display  = "block" ;   
 } 

 function fncSwithTabs(tabNum){
  if(tabNum =='1'){
     document.getElementById("basic").style.display   = "Block" ;   
     document.getElementById("contact").style.display = "none" ; 
     document.getElementById("about").style.display   = "none" ; 
     
     document.getElementById("tab1").style.display   = "Block" ;   
     document.getElementById("tab2").style.display   = "none" ;   
     document.getElementById("tab3").style.display   = "none" ;   
       
  }
  else if( tabNum =='2'){
    document.getElementById("basic").style.display   = "none" ;   
    document.getElementById("contact").style.display = "block" ; 
    document.getElementById("about").style.display   = "none" ; 
    
    document.getElementById("tab1").style.display   = "none" ;   
    document.getElementById("tab2").style.display   = "Block" ;   
    document.getElementById("tab3").style.display   = "none" ;   
  }
  else if( tabNum =='3'){
    document.getElementById("basic").style.display   = "none" ;   
    document.getElementById("contact").style.display = "none" ; 
    document.getElementById("about").style.display   = "block" ; 
    
     document.getElementById("tab1").style.display   = "none" ;   
    document.getElementById("tab2").style.display   = "none" ;   
    document.getElementById("tab3").style.display   = "block" ;   
  }
     
 }        
 
  function scrollBarLeftClick(){
    clickVal =  document.getElementById('scrollBarClick').value ;
    clickVal  = parseInt(clickVal)-1;
     if(clickVal>=0){  
        document.getElementById('scrollBarClick').value = clickVal; 
        document.getElementById("secondaryBoxRight").style.display  = "block" ;    
        document.getElementById("secondaryBoxLeft").style.display = "none" ;  
    }   
 }
 
    /*
 
  function  regAdvertisement(){
    d = document.regAd;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
    var  condCheck = 1 ; 
    
    
    if(Trim(d.txtAdOption.value) ==''){
         msg =msg+"<li>Advertising options is Required."+"</li>"  ;      
    }
    if(Trim(d.txtAdOption.value) !=''){
        if(Trim(d.txtAdOption.value) =='B' ){
            if(Trim(d.lstBase.value)=='~'){
                msg =msg+"<li>Base Package is Required."+"</li>"  ;  
                condCheck = 0;
            }       
        }
        else if(Trim(d.txtAdOption.value) =='A' ) {
            if(Trim(d.lstAddOn.value)=='~'){
                msg =msg+"<li>Add-On Package is Required."+"</li>"  ;
                condCheck = 0; 
            }   
        }
        else if(Trim(d.txtAdOption.value) =='S' ) {
            if(Trim(d.lstStandAlone.value)=='~'){
                msg =msg+"<li>Stand Alone Package is Required."+"</li>"  ; 
                condCheck = 0;
            }      
        }  
        
        if(condCheck ==1){ 
           if(d.lstPlanType.value==''){
                msg =msg+"<li>Please select Package again ."+"</li>"  ;                
           }  
           if(Trim(d.lstPlanType.value) == 0){     
                if(Trim(d.txtLocationType.value)=='B'){       
                   if(Trim(d.lstLocationBanner.value)=='~'){
                         msg =msg+"<li>Ad Location selection is Empty."+"</li>"  ;                       
                   }   
               }   
               else if(Trim(d.txtLocationType.value)=='B')
               {
                 if(Trim(d.lstLocationSquare.value)=='~'){
                         msg =msg+"<li>Ad Location selection is Empty."+"</li>"  ;                       
                   }  
               }
           }     
           if(d.txtClickOption.value==''){       
                msg =msg+"<li>Please select Click-Thru Link Option ."+"</li>"  ;                  
           }       
           if( (d.txtClickOption.value=='1') && (Trim(d.txtClickThru.value)=='')){
                msg =msg+"<li>Please enter Link to URL."+"</li>"  ;          
           } 
           if(Trim(d.txtStartDate.value) =='')  {
              msg =msg+"<li>Start Date is Empty."+"</li>"  ;   
           }   
           if(Trim(d.lstPayOption.value)=='~'){
                msg =msg+"<li>Payment Option is Empty."+"</li>"  ;              
           }
           if(Trim(d.txtAmountToPay.value)=='' ||  Trim(d.txtAmountToPay.value)=='0'){
                msg =msg+"<li>Please Re-select Payment Option."+"</li>"  ;       
           }
           if(Trim(d.txtFile.value)==''){
           
                msg =msg+"<li>Please select banner file."+"</li>"  ;       
           }  
           if(Trim(d.txtFile.value)!=''){
                if (!/(\.(gif|jpg|jpeg|bmp|png))$/i.test(d.txtFile.value)){
                        msg =msg+"<li>Valid banner/file types gif,jpg,jpeg,bmp or png."+"</li>"  ;    
                }
           }  
       }                           
    }          
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     }    
  }
    */
    
function fnExtendAd(){
    d = document.regAd;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';     
    
   if(Trim(d.lstPayOption.value)=='~'){
        msg =msg+"<li>Payment Option is Empty."+"</li>"  ;              
   }
   if(Trim(d.txtAmountToPay.value)=='' ||  Trim(d.txtAmountToPay.value)=='0'){
        msg =msg+"<li>Please Select Payment Option."+"</li>"  ;       
   }
   if(Trim(d.txtAmountToPay.value)=='' ||  Trim(d.txtAmountToPay.value)=='0'){
        msg =msg+"<li>Amount is Required."+"</li>"  ;       
   }            
   if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;    
            scroll(0,300); 
            document.getElementById("errordiv").innerHTML=msg;
            return false;
   }
   else{
            return true;
   }  
} 

 function funcReport(){
  d = document.addReport;     
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg =''; 
   if(Trim(d.txtMessage.value)==''){
        msg =msg+"<li>Message is Empty."+"</li>"  ;              
   } 
   if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;  
        scroll(0,300);   
        document.getElementById("errordiv").innerHTML=msg;
        return false;
   }
   else{
        return true;
   }  
 }

 function findFriends(){
   d = document.addFriend;     
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg =''; 
   if(Trim(d.txtEmail.value)==''){
        msg =msg+"<li>Email is Empty."+"</li>"  ;              
   } 
   else	 {
	  var typeValue = d.txtEmail.value.split(',');  
	  var email_array = typeValue.length;
	  
		for (var i = 0; i < email_array; i++)
		{   
			if(typeValue[i] != ''){             
						   
			 if(!isValidEmail(typeValue[i])){             
				   msg =msg+"<li>Invalid Email Address."+"</li>"  ;

			   } 
			}
			//alert(typeValue[i]);
			
		}
	//	return false;

	 }
   if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
   }
   else{
        return true;
   }  
      
 }
  
  
  function fncClickThru(){    
    d = document.regAd;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
     if(d.txtClickOption.value==''){       
                msg =msg+"<li>Please select Click-Thru Link Option ."+"</li>"  ;                  
    }       
    if( (d.txtClickOption.value=='1') && (Trim(d.txtClickThru.value)=='')){
        msg =msg+"<li>Please enter Link to URL."+"</li>"  ;          
    }      
    if(msg !=''){ 
        msg  = "<ul>"+msg+"</ul>" ;     
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
   }
   else{
        return true;
   }  
  }
  
  function  regAdvertisement(){
    d = document.regAd;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';
    var  condCheck = 1 ; 
    
    
    if(Trim(d.txtAdOption.value) ==''){
         msg =msg+"<li>Advertising options is Required."+"</li>"  ;      
    }
    if(Trim(d.txtAdOption.value) !=''){
        if(Trim(d.txtAdOption.value) =='B' ){
            if(Trim(d.lstBase.value)==''){
                msg =msg+"<li>Base Package is Required."+"</li>"  ;  
                condCheck = 0;
            }       
        }
        else if(Trim(d.txtAdOption.value) =='A' ) {
            if(Trim(d.lstAddOn.value)==''){
                msg =msg+"<li>Add-On Package is Required."+"</li>"  ;
                condCheck = 0; 
            }   
        }
        else if(Trim(d.txtAdOption.value) =='S' ) {
            if(Trim(d.lstStandAlone.value)==''){
                msg =msg+"<li>Stand Alone Package is Required."+"</li>"  ; 
                condCheck = 0;
            }      
        }  
        
        if(condCheck ==1){ 
           if(d.lstPlanType.value==''){
                msg =msg+"<li>Please select Package again ."+"</li>"  ;                
           }  
           if(Trim(d.lstPlanType.value) == 0){     
                if(Trim(d.txtLocationType.value)=='B'){       
                   if(Trim(d.lstLocationBanner.value)=='~'){
                         msg =msg+"<li>Ad Location selection is Empty."+"</li>"  ;                       
                   }   
               }   
               else if(Trim(d.txtLocationType.value)=='B')
               {
                 if(Trim(d.lstLocationSquare.value)=='~'){
                         msg =msg+"<li>Ad Location selection is Empty."+"</li>"  ;                       
                   }  
               }
           }     
           if(d.txtClickOption.value==''){       
                msg =msg+"<li>Please select Click-Thru Link Option ."+"</li>"  ;                  
           }       
           if( (d.txtClickOption.value=='1') && (Trim(d.txtClickThru.value)=='')){
                msg =msg+"<li>Please enter Link to URL."+"</li>"  ;          
           }
		   
		   if(Trim(d.datepicker.value)==''){
                msg =msg+"<li>Please select Start Date."+"</li>"  ;          
           }

		   if(Trim(d.additionalMonth.value)=='~'){
				 msg =msg+"<li>Please select Months to Purchase."+"</li>"  ;                       
		   } 

           if(Trim(d.txtStartDate.value) =='')  {
              msg =msg+"<li>Start Date is Empty."+"</li>"  ;   
           }   
           if(Trim(d.lstPayOption.value)=='~'){
                msg =msg+"<li>Payment Option is Empty."+"</li>"  ;              
           }
           if(Trim(d.txtAmountToPay.value)=='' ||  Trim(d.txtAmountToPay.value)=='0'){
                msg =msg+"<li>Please Re-select Payment Option."+"</li>"  ;       
           }
           if(Trim(d.txtFile.value)==''){
           
                msg =msg+"<li>Please select banner file."+"</li>"  ;       
           }  
           if(Trim(d.txtFile.value)!=''){
                if (!/(\.(gif|jpg|jpeg|bmp|png))$/i.test(d.txtFile.value)){
                        msg =msg+"<li>Valid banner/file types gif,jpg,jpeg,bmp or png."+"</li>"  ;    
                }
           }  
       }                           
    }          
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     }    
  }
  
  
 function fnAddressChange(){
           
 
   if( document.getElementById('chkTerm').checked == true ){
     
        document.getElementById('txtAddress').value         =   document.getElementById('txtAddressHid').value;
        document.getElementById('lstState').selectedIndex   =   Trim(document.getElementById('lstStateHid').value);  
        document.getElementById('txtCity').value            =   document.getElementById('txtCityHid').value;     
        document.getElementById('txtZip').value             =   document.getElementById('txtZipHid').value;     
      
   }                      
   else {
        document.getElementById('txtAddress').value         =  '';
        document.getElementById('lstState').selectedIndex   =  '~'
        document.getElementById('txtCity').value            =  '';
        document.getElementById('txtZip').value             =  '';
   }
    
 }

 /*-----------------------------------------*/
// Created by Rajmohan.

var ccErrorNo = 0;
var ccErrors = new Array ()

ccErrors [0] = "Unknown card type";
ccErrors [1] = "No card number provided";
ccErrors [2] = "Credit card number is in invalid format";
ccErrors [3] = "Credit card number is invalid";
ccErrors [4] = "Credit card number has an inappropriate number of digits";

function fncheckCreditCard (cardnumber, cardname) {
     
  // Array to hold the permitted card characteristics
  var cards = new Array();

  // Define the cards we support. You may add addtional card types.
  
  //  Name:      As in the selection box of the form - must be same as user's
  //  Length:    List of possible valid lengths of the card number for the card
  //  prefixes:  List of possible prefixes for the card
  //  checkdigit Boolean to say whether there is a check digit
  
  cards [0] = {name: "Visa", 
               length: "13,16", 
               prefixes: "4",
               checkdigit: true};
  cards [1] = {name: "MasterCard", 
               length: "16", 
               prefixes: "51,52,53,54,55",
               checkdigit: true};
  cards [2] = {name: "DinersClub", 
               length: "14,16", 
               prefixes: "305, 36, 38, 54,55",
               checkdigit: true};
  cards [3] = {name: "CarteBlanche", 
               length: "14", 
               prefixes: "300,301,302,303,304,305",
               checkdigit: true};
  cards [4] = {name: "AmEx", 
               length: "15", 
               prefixes: "34,37",
               checkdigit: true};
  cards [5] = {name: "Discover", 
               length: "16", 
               prefixes: "6011,622,64,65",
               checkdigit: true};
  cards [6] = {name: "JCB", 
               length: "16", 
               prefixes: "35",
               checkdigit: true};
  cards [7] = {name: "enRoute", 
               length: "15", 
               prefixes: "2014,2149",
               checkdigit: true};
  cards [8] = {name: "Solo", 
               length: "16,18,19", 
               prefixes: "6334, 6767",
               checkdigit: true};
  cards [9] = {name: "Switch", 
               length: "16,18,19", 
               prefixes: "4903,4905,4911,4936,564182,633110,6333,6759",
               checkdigit: true};
  cards [10] = {name: "Maestro", 
               length: "12,13,14,15,16,18,19", 
               prefixes: "5018,5020,5038,6304,6759,6761",
               checkdigit: true};
  cards [11] = {name: "VisaElectron", 
               length: "16", 
               prefixes: "417500,4917,4913,4508,4844",
               checkdigit: true};
  cards [12] = {name: "LaserCard", 
               length: "16,17,18,19", 
               prefixes: "6304,6706,6771,6709",
               checkdigit: true};
               
  // Establish card type
  var cardType = -1;
  for (var i=0; i<cards.length; i++) {

    // See if it is this card (ignoring the case of the string)
    if (cardname.toLowerCase () == cards[i].name.toLowerCase()) {
      cardType = i;
      break;
    }
  }
  
  // If card type not found, report an error
  if (cardType == -1) {
     ccErrorNo = 0;
     return false; 
  }
   
  // Ensure that the user has provided a credit card number
  if (cardnumber.length == 0)  {
     ccErrorNo = 1;
     return false; 
  }
    
  // Now remove any spaces from the credit card number
  cardnumber = cardnumber.replace (/\s/g, "");
  
  // Check that the number is numeric
  var cardNo = cardnumber
  var cardexp = /^[0-9]{13,19}$/;
  if (!cardexp.exec(cardNo))  {
     ccErrorNo = 2;
     return false; 
  }
       
  // Now check the modulus 10 check digit - if required
  if (cards[cardType].checkdigit) {
    var checksum = 0;                                  // running checksum total
    var mychar = "";                                   // next char to process
    var j = 1;                                         // takes value of 1 or 2
  
    // Process each digit one by one starting at the right
    var calc;
    for (i = cardNo.length - 1; i >= 0; i--) {
    
      // Extract the next digit and multiply by 1 or 2 on alternative digits.
      calc = Number(cardNo.charAt(i)) * j;
    
      // If the result is in two digits add 1 to the checksum total
      if (calc > 9) {
        checksum = checksum + 1;
        calc = calc - 10;
      }
    
      // Add the units element to the checksum total
      checksum = checksum + calc;
    
      // Switch the value of j
      if (j ==1) {j = 2} else {j = 1};
    } 
  
    // All done - if checksum is divisible by 10, it is a valid modulus 10.
    // If not, report an error.
    if (checksum % 10 != 0)  {
     ccErrorNo = 3;
     return false; 
    }
  }  

  // The following are the card-specific checks we undertake.
  var LengthValid = false;
  var PrefixValid = false; 
  var undefined; 

  // We use these for holding the valid lengths and prefixes of a card type
  var prefix = new Array ();
  var lengths = new Array ();
    
  // Load an array with the valid prefixes for this card
  prefix = cards[cardType].prefixes.split(",");
      
  // Now see if any of them match what we have in the card number
  for (i=0; i<prefix.length; i++) {
    var exp = new RegExp ("^" + prefix[i]);
    if (exp.test (cardNo)) PrefixValid = true;
  }
      
  // If it isn't a valid prefix there's no point at looking at the length
  if (!PrefixValid) {
     ccErrorNo = 3;
     return false; 
  }
    
  // See if the length is valid for this card
  lengths = cards[cardType].length.split(",");
  for (j=0; j<lengths.length; j++) {
    if (cardNo.length == lengths[j]) LengthValid = true;
  }
  
  // See if all is OK by seeing if the length was valid. We only check the 
  // length if all else was hunky dory.
  if (!LengthValid) {
     ccErrorNo = 4;
     return false; 
  };   
  
  // The credit card is in the required format.
  return true;
}



function fuCheckPaymentDetails(){
   d = document.payment_details;   
   msg1     =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';
   var cond = 0;   
   
   if(Trim(d.nameOnCard.value)==''){            
        msg =msg+"<li>Name on Card is Required."+"</li>"  ;    
   }   
   if(Trim(d.creditCardNumber.value)==''){    
       msg =msg+"<li>Credit Card Number Required."+"</li>"  ; 
   }
   else	{
		//fncheckCreditCard(d.creditCardNumber.value, d.CardType.value);
			if (fncheckCreditCard(d.creditCardNumber.value, d.CardType.value)) {
			//	msg =msg+"<li>Credit card has a valid format."+"</li>"  ;
			} 
			else {
				  msg =msg+"<li>"+ccErrors[ccErrorNo]+"</li>"  ;
			};
	}
	if(Trim(d.expMonth.value)==''){    
       msg =msg+"<li>Expiry Month Required."+"</li>"  ; 
	}

	if(Trim(d.expYear.value)==''){    
       msg =msg+"<li>Expiry Year Required."+"</li>"  ; 
	}
	if(Trim(d.verificationCode.value)==''){    
       msg =msg+"<li>Verification Code Required."+"</li>"  ; 
	}
   if(!checkccDate(d.expYear.value, d.expMonth.value)){
		 msg =msg+"<li>Invalid Expiration Date!."+"</li>" ;
   }
   
    
      
    if(msg !=''){ 
        msg  = "<ul><br>"+msg+"</ul>"  
        scroll(0,300);
        document.getElementById("errordiv").innerHTML=msg;
        return false;
    }
    else{
		d.submit();
        return true;
    } 
}

function checkccDate(iYear, iMonth){
   var d = new Date();
   var msg = '';
   var iyear = iYear;
   var imonth = iMonth;
   if(iyear==d.getFullYear()) {
      if(imonth<(d.getMonth()+1)) {
      return  false; 

      }
   }
   if(iyear<d.getFullYear()) {
	return  false  ; 
   }
   return true;
}


 /*------------------------------------------*/
  
 /*
 // ORIGINAL CODE BEFORE CREDIT AMOUNT CAME IN

 function fnPayInfoValidation(){
    d = document.regAd;     
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';     
    
    txtPreviousPayID = document.getElementById('txtPreviousPayID').value;
    fDate = new Date();
    y2=fDate.getFullYear();
    
    if(txtPreviousPayID ==''){        
        if(Trim(d.payOptionType.value) =='C'){
            if(Trim(d.txtFirstName.value)==''){
                msg =msg+"<li>First Name is Required."+"</li>"  ;                  
            }  
            
            if(Trim(d.txtLastName.value)==''){
                msg =msg+"<li>Last Name is Required."+"</li>"  ;                  
            } 
            if(Trim(d.txtAddress.value)==''){
                msg =msg+"<li>Address is Required."+"</li>"  ;                  
            } 
            if(Trim(d.txtCity.value)==''){
                msg =msg+"<li>City is Required."+"</li>"  ;                  
            } 
            if(Trim(d.lstState.value)=='~'){
                msg =msg+"<li>State is Required."+"</li>"  ;                  
            } 
            if(Trim(d.txtZip.value)==''){
                msg =msg+"<li>Zip is Required."+"</li>"  ;                  
            } 
          
            if(Trim(d.txtCardNumber.value)==''){
                msg =msg+"<li>Card Number is Required."+"</li>"  ;                  
            }  
            if(Trim(d.txtMonth.value)==''){
                msg =msg+"<li>Month is Required."+"</li>"  ;                            
            }       
            else if(!isInteger(d.txtMonth.value)){    
                    msg =msg+"<li>Invalid Month."+"</li>"  ;   
            }
            else if(d.txtMonth.value =='00' || d.txtMonth.value >12 ){    
                    msg =msg+"<li>Invalid Month."+"</li>"  ;   
            }                   
            if(Trim(d.txtYear.value)=='0000'){
                msg =msg+"<li>Year is Required."+"</li>"  ;                            
            }       
            else if(!isInteger(d.txtYear.value)){    
                    msg =msg+"<li>Invalid Year ."+"</li>"  ;   
            }
            else if(d.txtYear.value < y2){    
                    msg =msg+"<li>Invalid Year."+"</li>"  ;   
            }
            
            if(Trim(d.txtCVV2.value)==''){
                msg =msg+"<li>CVV2 is Required."+"</li>"  ;                            
            }   
               
        }
        else if(Trim(d.payOptionType.value) =='B'){    
            if(Trim(d.txtFirstName.value)==''){
                msg =msg+"<li>First Name is Required."+"</li>"  ;                  
            }
            
            if(Trim(d.txtLastName.value)==''){
                msg =msg+"<li>Last Name is Required."+"</li>"  ;                  
            } 
            if(Trim(d.txtRoutingNumber.value)==''){
                msg =msg+"<li>Routing Number is Required."+"</li>"  ;                            
            }  
            if(Trim(d.txtAccountNumber.value)==''){
                msg =msg+"<li>Account Number is Required."+"</li>"  ;                            
            }
            if(Trim(d.txtBankName.value)==''){
                msg =msg+"<li>Bank Name is Required."+"</li>"  ;                            
            }
               
        } 
    }       
    if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
     }
     else{
            return true;
     }    
 }
 */


// Created By Raj commented ORIGINAL function and added few extra validation for credits.

 function fnPayInfoValidation(){
    d = document.regAd;     

	msg1    =    "Processing... Please wait...";
	document.getElementById("errordiv").innerHTML=msg1;
	var msg =''; 

	if(d.checkCredit.checked){
		var totAmount = document.getElementById('txtAmountToPay').value;
		var creditAmount = document.getElementById('creditAmount').value;

		if(creditAmount == '') {
			msg =msg+"<li>Please enter the credit Amount."+"</li>"  ; 
		}
		else {
				
				

			if(parseFloat(totAmount) < parseFloat(creditAmount)) {
				msg =msg+"<li>Credit Amount is Greater than Total Amount."+"</li>"  ; 
			}
			else if(parseFloat(totAmount) > parseFloat(creditAmount)) { // Here they have entered lesser amount than total Amount so business member must have to enter credit card or Bank details.
				msg = fnValidateCardInfo();
				if(msg != '') { // This is additional message saying remaining amount should be used card.
					var payIt ="<li>Remaining amount you have to pay using Credit Card or Bank Account ."+"</li>"  ;    
					msg = payIt + msg;
				}
			}
		}
	}
	else { //If the business member not using the Credit amount assigned by admin then.. only credit card validation only.

			msg = fnValidateCardInfo(); 
	 }
	 if(msg !=''){ 
			msg  = "<ul>"+msg+"</ul>" ;     
			scroll(0,300);
			document.getElementById("errordiv").innerHTML=msg;
			return false;
	 }
	 else{
			return true;
	 }  
 }

 function fnValidateCardInfo() {
	 var msg =''; 
	 txtPreviousPayID = document.getElementById('txtPreviousPayID').value;
			fDate = new Date();
			y2=fDate.getFullYear();
			if(txtPreviousPayID ==''){        
				if(Trim(d.payOptionType.value) =='C'){

					if(Trim(d.txtFirstName.value)==''){
						msg =msg+"<li>First Name is Required."+"</li>"  ;                  
					}  					
					if(Trim(d.txtLastName.value)==''){
						msg =msg+"<li>Last Name is Required."+"</li>"  ;                  
					} 
					if(Trim(d.txtAddress.value)==''){
						msg =msg+"<li>Address is Required."+"</li>"  ;                  
					} 
					if(Trim(d.txtCity.value)==''){
						msg =msg+"<li>City is Required."+"</li>"  ;                  
					} 
					if(Trim(d.lstState.value)=='~'){
						msg =msg+"<li>State is Required."+"</li>"  ;                  
					} 
					if(Trim(d.txtZip.value)==''){
						msg =msg+"<li>Zip is Required."+"</li>"  ;                  
					} 
				  
					if(Trim(d.txtCardNumber.value)==''){
						msg =msg+"<li>Card Number is Required."+"</li>"  ;                  
					}  
					if(Trim(d.txtMonth.value)==''){
						msg =msg+"<li>Month is Required."+"</li>"  ;                            
					}       
					else if(!isInteger(d.txtMonth.value)){    
							msg =msg+"<li>Invalid Month."+"</li>"  ;   
					}
					else if(d.txtMonth.value =='00' || d.txtMonth.value >12 ){    
							msg =msg+"<li>Invalid Month."+"</li>"  ;   
					}                   
					if(Trim(d.txtYear.value)=='0000'){
						msg =msg+"<li>Year is Required."+"</li>"  ;                            
					}       
					else if(!isInteger(d.txtYear.value)){    
							msg =msg+"<li>Invalid Year ."+"</li>"  ;   
					}
					else if(d.txtYear.value < y2){    
							msg =msg+"<li>Invalid Year."+"</li>"  ;   
					}
					
					if(Trim(d.txtCVV2.value)==''){
						msg =msg+"<li>CVV2 is Required."+"</li>"  ;                            
					}   
				}
				else if(Trim(d.payOptionType.value) =='B'){    
					if(Trim(d.txtFirstName.value)==''){
						msg =msg+"<li>First Name is Required."+"</li>"  ;                  
					}
					
					if(Trim(d.txtLastName.value)==''){
						msg =msg+"<li>Last Name is Required."+"</li>"  ;                  
					} 
					if(Trim(d.txtRoutingNumber.value)==''){
						msg =msg+"<li>Routing Number is Required."+"</li>"  ;                            
					}  
					if(Trim(d.txtAccountNumber.value)==''){
						msg =msg+"<li>Account Number is Required."+"</li>"  ;                            
					}
					if(Trim(d.txtBankName.value)==''){
						msg =msg+"<li>Bank Name is Required."+"</li>"  ;                            
					}
				} 
			}
			return msg;	
 }

 function checkEnteredCreditAmount() {
	 var creditAmount = document.getElementById('creditAmount').value;
	  d = document.regAd;  
		 xmlHttp=GetXmlHttpObject();     
		   if (xmlHttp==null)
		   {
			  alert("Your browser does not support AJAX!");
			  return;
		   } 
		   var url="ajax_member.php";
		   url=url+"?checkCreditAmount="+creditAmount;
		   xmlHttp.onreadystatechange= function () {
			var msg='';
			   if (xmlHttp.readyState==4)
			   {   
				   var result = Trim(xmlHttp.responseText) 
					   result = result.replace(/^\s*|\s*$/g,'');
				   if(result == '1') {
					   msg =msg+"<li>Credit Amount is Greater than Available amount."+"</li>"  ; 
						//msg  = "<ul>"+msg+"</ul>" ;     
				   }
				   else {
						msg='';
						 returnVal = fnPayInfoValidation();
						 
				   }
					if(msg !=''){ 
							msg  = "<ul>"+msg+"</ul>" ;     
							scroll(0,300);
							document.getElementById("errordiv1").innerHTML=msg;
							returnVal = false;
					 }
					 else{
						 document.getElementById("errordiv1").innerHTML=msg;
						
						//	returnVal = true;
					 } 
				   if(returnVal == true) {
					  document.regAd.submit();
				   }
			   }
		   }; 
		   xmlHttp.open("GET",url,true);
		   xmlHttp.send(null); 
		  // return false;

 }
 
 function fncFeedBack(){
 
   d = document.regFeed;     
   msg1    =    "Processing... Please wait...";
   document.getElementById("errordiv").innerHTML=msg1;
   var msg ='';     
   if(Trim(d.lstSuggestType.value)=='~'){
                msg =msg+"<li>Request type is Required."+"</li>"  ;                  
   } 
   if(Trim(d.txtName.value)==''){
                msg =msg+"<li>Name is Required."+"</li>"  ;                  
   } 
   if(Trim(d.txtEmail.value)==''){
                msg =msg+"<li>Email is Required."+"</li>"  ;                  
   }
   if(!isValidEmail(d.txtEmail.value) && Trim(d.txtEmail.value) !=''){             
       msg =msg+"<li>Invalid Email Address."+"</li>"  ;
   }
	
	if(Trim(d.phone1.value)!='' &&  Trim(d.phone2.value) !="" && Trim(d.phone3.value) !="")   {
       
       if(Trim(d.phone1.value).length!=3 || Trim(d.phone2.value).length!=3 || Trim(d.phone3.value).length!=4)
       { 
             msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }    
       if(!isValidNumber(d.phone1.value) || !isValidNumber(d.phone2.value) || !isValidNumber(d.phone3.value))
       {            
            msg =msg+"<li>Invalid Contact phone."+"</li>"  ;
       }
       
   }
   else {
			msg =msg+"<li>Invalid Phone."+"</li>"  ;
   }


   if(Trim(d.txtMessage.value)==''){
                msg =msg+"<li>Message    is Required."+"</li>"  ;                  
   }                 
   
   
   if(msg !=''){ 
            msg  = "<ul>"+msg+"</ul>" ;     
            scroll(0,300);
            document.getElementById("errordiv").innerHTML=msg;
            return false;
   }
   else{
            return true;
   } 
 
 }
 /*
 function findPackageType(adType){     
      document.getElementById("txtAdOption").value= adType; 
     if(adType =='B' || adType =='A' ){           
      
      document.getElementById("primary").style.display  = "block" ;   
      document.getElementById("standAlone").style.display  = "none" ;  
                  
     } 
     else if(adType =='S'){
        document.getElementById("primary").style.display  = "none" ;   
      document.getElementById("standAlone").style.display  = "block" ;  
     } 
  }
  */
  function findPackageType(adType, packageID){     
      document.getElementById("txtAdOption").value= adType; 
             
      if(adType=='B')  {
             document.getElementById("lstBase").value   = packageID ;
             document.getElementById("lstAddOn").value   = '' ;
             document.getElementById("lstStandAlone").value   = '' ;
			 document.getElementById("lstSpecial").value  ='';
      }
      else if(adType=='A') {
        document.getElementById("lstAddOn").value       =  packageID ;
        document.getElementById("lstBase").value  ='';
        document.getElementById("lstStandAlone").value   = '' ;   
		document.getElementById("lstSpecial").value  ='';
      }
      else if(adType=='S') {
        document.getElementById("lstStandAlone").value  =   packageID;
        document.getElementById("lstBase").value  ='';  
        document.getElementById("lstAddOn").value =''; 
		document.getElementById("lstSpecial").value  ='';
      }

	  else if(adType=='SS') {  // Special Pricing.,.
        document.getElementById("lstSpecial").value  =   packageID;
        document.getElementById("lstStandAlone").value  =  '';
        document.getElementById("lstBase").value  ='';  
        document.getElementById("lstAddOn").value ='';

		 xmlHttp=GetXmlHttpObject();     
		   if (xmlHttp==null)
		   {
			  alert("Your browser does not support AJAX!");
			  return;
		   } 
			var url="ajax_member.php";
			url=url+"?purchasePackage="+findPackageType; 
			
			xmlHttp.onreadystatechange=  fnPurchasePack
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}
      
      
 }

function fnPurchasePack(){
   if (xmlHttp.readyState==4)
   {     
     //   var result = Trim(xmlHttp.responseText)
      //  window.location.href=result;  

          
   } 
}
   function selectPlanType(adplanpackid){ 
    
        if((adplanpackid !='') && (adplanpackid!='~')){               
            xmlHttp=GetXmlHttpObject();          
            if (xmlHttp==null)
            {
                alert("Your browser does not support AJAX!");
                return;
            } 
            var url="ajax_member.php";
            url=url+"?adplanpackid="+adplanpackid;
            xmlHttp.onreadystatechange=  assignPlanType;
            xmlHttp.open("GET",url,true);
            xmlHttp.send(null);
        }        
   }
   
     function changeLinkThru( val) {
        if(val == 1 )    {
            document.getElementById("divLink").style.display = "block"
            document.getElementById("txtClickOption").value = val;
        }
        else{        
            document.getElementById("divLink").style.display = "none"
            document.getElementById("txtClickOption").value = val;
        }
    }   
   
    function  assignPlanType(){
        if (xmlHttp.readyState==4)
        {   
           typeValue = Trim(xmlHttp.responseText).split('@@@');   
           document.getElementById("planToshow").innerHTML =  "<br>&nbsp;&nbsp;&nbsp;&nbsp;"+typeValue[0];  
           document.getElementById("pageToshow").innerHTML =  "<br>&nbsp;&nbsp;&nbsp;&nbsp;"+typeValue[2];  
           document.getElementById("costToshow").innerHTML =  "<br>&nbsp;&nbsp;&nbsp;&nbsp;$"+typeValue[4];  
           document.getElementById("adStartDate").innerHTML=  "<br>&nbsp;&nbsp;&nbsp;&nbsp;"+typeValue[5];    
           bannerWidthHeight =  typeValue[6]+'X'+typeValue[7]    ;           
           document.getElementById("bannerWidthHeight").innerHTML=  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+bannerWidthHeight;   
           
           document.getElementById("txtStartDate").value = typeValue[5] ; 
           document.getElementById("lstPlanType").value = typeValue[1] ; 
           document.getElementById("lstPlanTypeVal").value = typeValue[0] ; 
           document.getElementById("txtPlanCost").value = typeValue[4] ; 
           document.getElementById("txtOnPage").value = typeValue[2] ; 
           
           
           
           document.getElementById("txtAmountToPay").value = '' ; 
           
           document.getElementById("showPlanType").style.display  = ""     
           document.getElementById("showClick").style.display  = ""     
           document.getElementById("showDate").style.display  = ""     
                        
           if(typeValue[1]==0)  {
               document.getElementById("fixedPlan").style.display  = ""
               document.getElementById("txtFixedPlan").value =  0 ;
               
           }
           else{ 
               document.getElementById("fixedPlan").style.display  = "none"   
               document.getElementById("txtFixedPlan").value =  1 ;
           }               
    
          if(typeValue[3]=='B') {      
                document.getElementById("squareLocation").style.display  = "none"
                document.getElementById("banLocation").style.display  = "block"    
              //  document.getElementById("squareLocation").innerHTML = ""   ;
          }
          else{ 
                document.getElementById("squareLocation").style.display  = ""
                document.getElementById("banLocation").style.display  = "none"    
               // document.getElementById("banLocation").innerHTML = ""   ;   
          }
                                                                                 
           //document.getElementById('txtName').value=xmlHttp.responseText;
        }
    }
    
    
    
   function calulateTotalAmount(payOption){
   
   pakageCost   =  document.getElementById('txtPlanCost').value   ; 
     if( pakageCost != '' ){
            if(Trim(document.getElementById('txtStartDate').value) !='')  {      
                valDate     =  document.getElementById('txtStartDate').value ;        
                              
                   xmlHttp=GetXmlHttpObject();          
                   if (xmlHttp==null)
                    {
                        alert("Your browser does not support AJAX!");
                        return;
                    } 
                    var url="ajax_member.php";                                                                                                  
                    url=url+"?adStartDate="+valDate+"&pakageCost="+pakageCost+"&adPayOption="+payOption;                                                                                                                                   
                    xmlHttp.onreadystatechange=  assignAdEndDate;
                    xmlHttp.open("GET",url,true);
                    xmlHttp.send(null);                                                    
            }           
            
        } 
          
   }

  function calculatePackageAmount(cost, totMonth, oneMonth){
	 
	document.getElementById('showEndDate').style.display='none' ;

	var startDate = document.getElementById('datepicker').value;

	if(startDate == '') {
		document.getElementById('showError').innerHTML ='Select Date';
		return false;
	}
	else {
		document.getElementById('txtStartDate').value = startDate;
	}

	

	  // The same logic needs to validated in server side as well. :)
   var chosenMonth  = document.getElementById('additionalMonth').value; 
   var existValue = chosenMonth;
 //  var startDate = document.getElementById('txtStartDate1').value;
  // var currentAmount = parseFloat(cost)/parseFloat(totMonth);
   var currentAmount = parseFloat(cost);
   var amount  = (chosenMonth * currentAmount ).toFixed(2) ; 

	if(chosenMonth != '~'){
		document.getElementById('showLoading').innerHTML='Loading.....' ;
	   document.getElementById('txtAmountToPay').value = amount;
	   document.getElementById('txtPlanCost').value = amount;
	}
	else {
	   document.getElementById('txtAmountToPay').value = cost;
	   document.getElementById('txtPlanCost').value = cost;
	   
	   document.getElementById('endDate').innerHTML ='<br>&nbsp;&nbsp;&nbsp;&nbsp;'+oneMonth;
	   document.getElementById('txtEndDate').value =oneMonth;
	   return;
	}


    xmlHttp=GetXmlHttpObject();          
   if (xmlHttp==null)
	{
		alert("Your browser does not support AJAX!");
		return;
	} 
	var url="ajax_member.php";   
	url=url+"?selectedPkgMonth="+chosenMonth+"&startMonth="+startDate;      
	
	xmlHttp.onreadystatechange=  function () {
		   if (xmlHttp.readyState==4)
		   {   
			   var result = Trim(xmlHttp.responseText) 
				  
			   document.getElementById('endDate').innerHTML ='<br>&nbsp;&nbsp;&nbsp;&nbsp;'+result;
			   document.getElementById('txtEndDate').value =result;
			   document.getElementById('showEndDate').style.display='block' ;
			   document.getElementById('showLoading').innerHTML = '';

			  // location.href='changeAdBanner.php';
		   } 
	   };
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
    
          
   }
   
  function calulateTotalAmountToExtend(payExOption){
   pakageExCost   =  document.getElementById('txtPlanCost').value   ; 
     if( pakageCost != '' ){
            if(Trim(document.getElementById('txtStartDate').value) !='')  {      
                adExStartDate     =  document.getElementById('txtStartDate').value ;        
                              
                   xmlHttp=GetXmlHttpObject();          
                   if (xmlHttp==null)
                    {
                        alert("Your browser does not support AJAX!");
                        return;
                    } 
                    var url="ajax_member.php";                                                                                                  
                    url=url+"?adExStartDate="+adExStartDate+"&pakageExCost="+pakageExCost+"&payExOption="+payExOption;          
                    
                    xmlHttp.onreadystatechange=  assignAdEndDate;
                    xmlHttp.open("GET",url,true);
                    xmlHttp.send(null);                                                    
            }           
            
        } 
          
   }  
   

            
   
function assignAdEndDate(){
    if (xmlHttp.readyState==4)
    {         
       
       typeValue = Trim(xmlHttp.responseText).split('@@@');   
   
       document.getElementById("txtAmountToPay").value =  typeValue[0];  
       
       document.getElementById("txtEndDate").value     = typeValue[1]; 
       document.getElementById("endDate").innerHTML    =  "<br>&nbsp;&nbsp;&nbsp;&nbsp;"+typeValue[1];  
       
    }
}
    
 function fnPayFormChange(typeValue){                             
    document.getElementById("payOptionType").value =typeValue; 
     if(typeValue=='C') {
        document.getElementById("creditShow").style.display = "block" ; 
        document.getElementById("bankShow").style.display   = "none" ;     
        document.getElementById("cPrevious").style.display  = "block" ;     
        document.getElementById("bPrevious").style.display  = "none" ;   
        
            
     }
     else if(typeValue=='B') {
        document.getElementById("creditShow").style.display = "none" ; 
        document.getElementById("bankShow").style.display   = "block" ;
        document.getElementById("cPrevious").style.display  = "none" ;      
        document.getElementById("bPrevious").style.display  = "block" ;   
        document.getElementById("flName").style.display     = "block" ;   
        document.getElementById("txtPreviousPayID").value   =  ''; 
        document.getElementById('lstCPayID').selectedIndex  ='~';
        document.getElementById('lstBPayID').selectedIndex  ='~';
     } 
 }
 
 function fnUsingPrevious(selectedval){ 
   typeValue = document.getElementById('payOptionType').value ; 
     
    if(typeValue=='C') {  
       if(selectedval !='~' ){
       
            document.getElementById("txtPreviousPayID").value =  selectedval;
            document.getElementById("creditShow").style.display   = "none" ;  
            document.getElementById("flName").style.display     = "none" ;  
       }
       else {
           document.getElementById("txtPreviousPayID").value =  '';   
           document.getElementById("creditShow").style.display   = "block" ;  
           document.getElementById("flName").style.display    = "block" ;  
       
       }
    
    }
    else if(typeValue=='B') {
       if(selectedval !='~' ){
            document.getElementById("txtPreviousPayID").value =  selectedval;   
            document.getElementById("bankShow").style.display   = "none" ;  
            document.getElementById("flName").style.display     = "none" ;  
       }
       else {
           document.getElementById("txtPreviousPayID").value =  '';   
           document.getElementById("bankShow").style.display   = "block" ;  
           document.getElementById("flName").style.display    = "block" ;  
       
       }
        
    
    }
 
 }

 function fnShowCouponOption(selectedval){ 
  // typeValue = document.getElementById('payOptionType').value ; 
     
   if(selectedval == '1'){
	  // document.getElementById('show_coupon_option').style.display=='block';
	  $(".show_coupon_option").show();
	  $("#image_size_msg").html('(265px x 210px or less)');
	  $("#show_image").html('<p>Upload logo and input coupon details(265px x 210px) </p><img  src="images/logo_w_text_sample.jpg" border="0">');
   }
   else if(selectedval == '2') {
	  // document.getElementById('show_coupon_option').style.display=='none';
	  $(".show_coupon_option").hide();
	  $("#image_size_msg").html('(545px x 265px or less)');
	   $("#show_image").html('<p>Upload graphical coupon (545px x 265px) </p><img  src="images/logo_only.jpg" border="0">');

   }
 }
  
 
 
 function pendingFriendShowHide(divid)
 {
       did =  "reqCont"+divid;
       sid =  "spn"+divid;
 
      if(document.getElementById(did).style.display=='none'){
        document.getElementById(did).style.display ='block'   ;   
        document.getElementById(sid).innerHTML ='Hide'   ;   
      }
      else {
       document.getElementById(did).style.display ='none'   ;   
       document.getElementById(sid).innerHTML ='Show'   ;     
      }
  
 }
 
 function messageHide(did){
 
  if(document.getElementById(did).style.display=='none'){
        document.getElementById(did).style.display ='block'   ;     
      }
      else {
       document.getElementById(did).style.display ='none'   ;   
       
      }
 
 }
 
 
 function selectPostOption(catType){
           document.getElementById('txtCategory').value =catType;   
    if(catType=='LINK'){
       
       document.getElementById('LINK').style.display ='block';   
       document.getElementById('PHOTO').style.display ='none';   
       document.getElementById('VIDEO').style.display ='none';   
       
       identity=document.getElementById('SLINK');  
       identity.className='selected'; 
       
       identity1=document.getElementById('SPHOTO');  
       identity1.className=''; 
       /*
       identity2=document.getElementById('SVIDEO');  
       identity2.className='';*/ 
       
       document.getElementById('enableBtn').style.display ='block'   ; 
       document.getElementById('disableBtn').style.display ='none'   ; 
       
     
        
        
  
                                                                       
    }
    else if(catType=='PHOTO'){
  
  
       document.getElementById('LINK').style.display ='none'   ;   
       document.getElementById('PHOTO').style.display ='block' ;   
       document.getElementById('VIDEO').style.display ='none'   ; 
       
       identity=document.getElementById('SLINK');  
       identity.className=''; 
       
       identity1=document.getElementById('SPHOTO');  
       identity1.className='selected'; 
       
       /*
       identity2=document.getElementById('SVIDEO');  
       identity2.className='';  
       */
       
       document.getElementById('disableBtn').style.display ='block'   ;    
       document.getElementById('enableBtn').style.display ='none'   ;    
    }
    else if(catType=='VIDEO'){ 
       document.getElementById('LINK').style.display ='none'   ;   
       document.getElementById('PHOTO').style.display ='none' ;   
       document.getElementById('VIDEO').style.display ='block'   ;  
       
       identity=document.getElementById('SLINK');  
       identity.className=''; 
       
       identity1=document.getElementById('SPHOTO');  
       identity1.className=''; 
       
       identity2=document.getElementById('SVIDEO');  
       identity2.className='selected';   
        
    }
 
 
 }
 
 function changeEnableDisable(){ 
 
  catType = document.getElementById('txtCategory').value ;   
    if(catType=='LINK'){
       
       document.getElementById('LINK').style.display ='block';   
       document.getElementById('PHOTO').style.display ='none';   
       document.getElementById('VIDEO').style.display ='none';   
       
       identity=document.getElementById('SLINK');  
       identity.className='selected'; 
       
       identity1=document.getElementById('SPHOTO');  
       identity1.className=''; 
      /* 
       identity2=document.getElementById('SVIDEO');  
       identity2.className='';    */
       
       document.getElementById('enableBtn').style.display ='block'   ; 
       document.getElementById('disableBtn').style.display ='none'   ; 
         
                                                                       
    }
 
     
 }
 
 
  /*
 function communityPhotoDegreement(){
   curr  =  document.getElementById('curPhotoCount').value;
   total = document.getElementById('totalPhotoCount').value;
        
 }  
 */
 
 function communityPhotoIncremnet(){
    total = document.getElementById('totalPhotoCount').value; 
    curr  =  parseInt(document.getElementById('curPhotoCount').value); 
    if(curr>=1){
         document.getElementById("leftNavCommunity").style.display  = "block" ;
    }
   
    if((curr+1)==total){
    
        document.getElementById("rightNavCommunity").style.display  = "none" ;                  
    }
    else{
        document.getElementById("leftNavCommunity").style.display  = "block" ; 
        
    } 
    document.getElementById('curPhotoCount').value = parseInt(curr)+1;  
 }
 
  function communityPhotoDegreement(){
    total = document.getElementById('totalPhotoCount').value; 
    curr  =  parseInt(document.getElementById('curPhotoCount').value);   
   
    
    
    if((curr-1)==1){  
        document.getElementById("leftNavCommunity").style.display  = "none" ;                  
        document.getElementById("rightNavCommunity").style.display  = "block" ;  
    }
    else{
        document.getElementById("rightNavCommunity").style.display  = "block" ; 
        
    }  
    document.getElementById('curPhotoCount').value = parseInt(curr)-1;    
 }
            

function getCityList()
{                      
    statecode = document.getElementById('lstState').value ;  
    document.getElementById('lstCity1').focus();
    xmlHttp=GetXmlHttpObject(); 
    
    loadimg = "<img src='images/loading.gif'>" ; 
    document.getElementById('divState').innerHTML=loadimg; 
                   
    
   if (xmlHttp==null)
  {
  alert("Your browser does not support AJAX!");
  return;
  } 
        var url="admin/ajax_common.php";
        url=url+"?statecode1="+statecode;
        xmlHttp.onreadystatechange=calledFunction;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
} 

function getModel(make,model)
{       
//alert(make);               
//alert(model);               
if(model != '')
	{
		var model = '&Model='+model;
		//alert(model);
	}
else
	{
		var model = '';
	}


   // statecode = document.getElementById('make').value ;  
   // document.getElementById('model').focus();
    xmlHttp=GetXmlHttpObject(); 
    
    loadimg = "<img src='images/loading.gif'>" ; 
    document.getElementById('divState').innerHTML=loadimg; 
                   
    
   if (xmlHttp==null)
  {
  alert("Your browser does not support AJAX!");
  return;
  } 
        var url="admin/ajax_common.php";
        url=url+"?Make="+make+model;
        xmlHttp.onreadystatechange=calledFunction;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
}

function clearText(currentvalue,standardvalue,fieldname)  
{
//alert(currentvalue);
//alert(standardvalue);

    if(currentvalue == standardvalue) {
    
        document.getElementById(fieldname).value = '';
       // this.value = '';
    }
    if(currentvalue == '')
    {
        document.getElementById(fieldname).value = standardvalue;
    }
}

       
function calledFunction() 
{  
    if (xmlHttp.readyState==4)
    {   
           
        document.getElementById('replacediv').innerHTML=xmlHttp.responseText;
        document.getElementById('divState').innerHTML='';  
     //   document.getElementById('lstCity1').focus();   
         
    }

} 

/*  
function searchWeb(){
  
    xmlHttp=GetXmlHttpObject();     
    linkVal = document.getElementById('txtPreLink').value ;  
    document.getElementById('txtLink').value =document.getElementById('txtPreLink').value;
    loadimg = "<img src='images/loading.gif'>" ; 
    document.getElementById('attPos').innerHTML=loadimg; 
  
   if (xmlHttp==null)
  {
  alert("Your browser does not support AJAX!");
  return;
  } 
        var url="ajax_member.php"; 
        url=url+"?weblinkVal="+linkVal;
        
        xmlHttp.onreadystatechange=fnWebLinkResult;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);  
}
*/

function searchWeb(){  

     //   alert(document.getElementById('txtCategory').value);
    if(document.getElementById('txtCategory').value =='LINK'){  
    
        if(Trim(document.getElementById('txtPreLink').value) != ''){
              
            xmlHttp=GetXmlHttpObject();     
            linkVal = document.getElementById('txtPreLink').value ;  
            document.getElementById('txtLink').value =document.getElementById('txtPreLink').value;
            loadimg = "<img src='images/loading.gif'>" ; 
             

            document.getElementById('popup').style.visibility =  'hidden';
            document.getElementById('optSelect').innerHTML=loadimg; 
			

            if (xmlHttp==null)
            {
            alert("Your browser does not support AJAX!");
            return;
            } 
            var url="ajax_member.php"; 
            url = url+"?weblinkVal="+linkVal;

            xmlHttp.onreadystatechange=fnWebLinkResult;
            xmlHttp.open("GET",url,true);
            xmlHttp.send(null); 
        }
        else{        
        document.getElementById('errordiv').innerHTML = "Link is Required.";    
        }   
    }
    if(document.getElementById('txtCategory').value =='PHOTO'){     
        if(Trim(document.getElementById('txtPostPhoto').value) != ''){ 
        
         
        
             photoval = Trim(document.getElementById('txtPostPhoto').value)            
          
            xmlHttp=GetXmlHttpObject();     
            linkVal = document.getElementById('txtPostPhoto').value;  

            loadimg = "<img src='images/loading.gif'>" ; 

			 document.getElementById('popup').style.visibility =  'hidden';
            document.getElementById('optSelect').innerHTML=loadimg; 

            if (xmlHttp==null)
            {
            alert("Your browser does not support AJAX!");
            return;
            } 
            var url="ajax_member.php"; 
            url = url+"?txtPostPhoto="+photoval;
      
            
    

            xmlHttp.onreadystatechange=fnPhotoResult;
            xmlHttp.open("GET",url,true);
            xmlHttp.send(null); 
           
        }
        else{        
        document.getElementById('errordiv').innerHTML = "Photo is Required.";    
        } 
        
    
    }
}


function fnWebLinkResult() 
{  
    if (xmlHttp.readyState==4)
    { 
        /*
        if(document.getElementById("btnSub").disabled == true)  {        
         var submitObj = document.getElementById('btnSub');  
            submitObj.disabled = false;   
            submitObj.className = "yellow_button"; 

        }   
        */     
        document.getElementById('optSelect').innerHTML=Trim(xmlHttp.responseText);  
                                                                                          
    }  
} 
 function fnPhotoResult(){
    if (xmlHttp.readyState==4)
    { 
    
     
        /*
        if(document.getElementById("btnSub").disabled == true)  {        
         var submitObj = document.getElementById('btnSub');  
            submitObj.disabled = false;   
            submitObj.className = "yellow_button"; 

        }   
        */     
        document.getElementById('optSelect').innerHTML=Trim(xmlHttp.responseText);  
                                                                                          
    }  
 
 }

function requestfriend(id, fid,placeID){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?requestMemberId="+id+'&requestFriendid='+fid+'&requestPlaceID='+placeID;         
    xmlHttp.onreadystatechange= fnRequestFriend;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);    
}


function fnRequestFriend() 
{  
    if (xmlHttp.readyState==4)
    {  
       
       typeValue = Trim(xmlHttp.responseText).split('@@@');           
           
       placeid= 'place'+Trim(typeValue[1]);                               
            
       document.getElementById(placeid).innerHTML='<font style="color:#FF0000;font-weight:lighter">'+typeValue[0]+'</font>'  ;      
        
   
    }

}          
function freiendRequest(id, fid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?memberid="+id+'&friendid='+fid;         
    xmlHttp.onreadystatechange= fnFriendRequest
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);    
}

function fnFriendRequest() 
{  
    if (xmlHttp.readyState==4)
    {        
        
    
       if(Trim(xmlHttp.responseText) =='F')
            document.getElementById('replacediv').innerHTML='Error Occurred While processing your request!';  
       else if(Trim(xmlHttp.responseText)=='T')      
            document.getElementById('replacediv').innerHTML='Your Request Sent Successfully!';  
       else if(Trim(xmlHttp.responseText)=='E')      
            document.getElementById('replacediv').innerHTML='Already your request is pending!';  
       else if(Trim(xmlHttp.responseText)=='N')      
            document.getElementById('replacediv').innerHTML='Already you are friend!';   
   
    }

} 


function freiendSearchRequest(id, fid){ 
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?memberid="+id+'&friendid='+fid;         
    xmlHttp.onreadystatechange= fnFriendSearchRequest
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  

}

function fnFriendSearchRequest() 
{  
    if (xmlHttp.readyState==4)
    {   
       if(Trim(xmlHttp.responseText) =='F')
            document.getElementById('replacediv').innerHTML='Error Occurred While processing your request!';  
       else if(Trim(xmlHttp.responseText)=='T'){      
            document.getElementById('replacediv').innerHTML='Your Request Sent Successfully!';  
            window.location.href='myFriends.php';  
       }
       else if(Trim(xmlHttp.responseText)=="E") {     
            
            document.getElementById('replacediv').innerHTML='Already your request is pending!';  
       }
       else if(Trim(xmlHttp.responseText)=='N'){      
            document.getElementById('replacediv').innerHTML='Already you are friend!';                 
            document.getElementById('search').value="";  
       }

  }
}

function fnGetMutualFriends(usid,id){     
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url     =   url+"?mutualuser_id="+usid+"&divid="+id;          
    xmlHttp.onreadystatechange= muthalFriendAssign;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);        
}

 function muthalFriendAssign(){
   if (xmlHttp.readyState==4)
    {                           
       // document.getElementById('friendListing').innerHTML = xmlHttp.responseText;
       
        res       = xmlHttp.responseText;         
   
        arrRes    = res.split('@@@');        
        divid     = 'AllfriendListing'+arrRes[1];         
        
        document.getElementById(divid).innerHTML = arrRes[0];
          
    }
 } 
 
 function fnGetAllFriends(uid,id){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url     =   url+"?alluser_id="+uid+"&divid="+id;          
    xmlHttp.onreadystatechange= allFriendAssign;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  
    
 
 }
 
  function allFriendAssign(){
   if (xmlHttp.readyState==4)
    {   
        res       = xmlHttp.responseText;         
   
        arrRes    = res.split('@@@');        
        divid     = 'AllfriendListing'+arrRes[1];         
        
        document.getElementById(divid).innerHTML = arrRes[0];
          
    }
 }
 
 
  function fnAssignSessionAlbumWithUser(userid,albid,desfile){
     xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?albidsesid="+albid+"&desfile="+desfile+"&photouserid="+userid; 
    
    xmlHttp.onreadystatechange=  fnSessionPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
 }
 
 
 
 function fnAssignSessionAlbum(albid,desfile){
     xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?albidsesid="+albid+"&desfile="+desfile; 
    
    xmlHttp.onreadystatechange=  fnSessionPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
 }
 
 function fnAssignSessionWithUserPhoto(userid,photosesid, desfile){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?photosesid="+photosesid+"&desfile="+desfile+"&alphoto="+userid; 
    
    xmlHttp.onreadystatechange=  fnSessionPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
 }
 
 function fnAssignSessionSurvey(nextSurveyId,surDesFile){
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?nextSurveyId="+nextSurveyId+"&surDesFile="+surDesFile;    
    xmlHttp.onreadystatechange=  fnSessionSurvey
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 }
 
   function fnSessionSurvey(){
   if (xmlHttp.readyState==4)
   {     
        var result = Trim(xmlHttp.responseText)
        window.location.href=result;  
           
   } 
  }
  
 function fnAssignSessionSurveyHistory(suveyPassDate,surDesFile){ 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?suveyPassDate="+suveyPassDate+"&surHisDesFile="+surDesFile;  
    xmlHttp.onreadystatechange=  fnSessionSurveyHistory
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 }    
 
function fnSessionSurveyHistory(){
   if (xmlHttp.readyState==4)
   {     
        var result = Trim(xmlHttp.responseText)
        window.location.href=result;
   } 
}

function fnAssignSessionAutoPhoto(autosesphotoid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    loadimg = "<img src='images/barloading.gif'>" ; 
    document.getElementById('photo_slide').innerHTML=loadimg; 
   
    var url="ajax_member.php";
    url=url+"?autosesphotoid="+autosesphotoid; 
    
    xmlHttp.onreadystatechange=  fnSessionAutoPhoto;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function fnSessionAutoPhoto(){
    if (xmlHttp.readyState==4)
     {     
        var result = Trim(xmlHttp.responseText)
        
        document.getElementById('photo_slide').innerHTML =result;  
           
   }   
  }
  
  
  function fnAssignSessionPropertyPhoto(propertysesphotoid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    loadimg = "<img src='images/barloading.gif'>" ; 
    document.getElementById('photo_slide').innerHTML=loadimg; 
  
   
    var url="ajax_member.php";
    url=url+"?propertysesphotoid="+propertysesphotoid;     
    xmlHttp.onreadystatechange=  fnSessionPropertyPhoto;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function fnSessionPropertyPhoto(){
    if (xmlHttp.readyState==4)
     {     
        var result = Trim(xmlHttp.responseText)
      
        document.getElementById('photo_slide').innerHTML =result;  
           
   }   
}
  
  


 function fnAssignSessionClassifiedPhoto(classifiedsesphotoid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   loadimg = "<img src='images/barloading.gif'>" ; 
   document.getElementById('photo_slide').innerHTML=loadimg; 
  
   
    var url="ajax_member.php";
    url=url+"?classifiedsesphotoid="+classifiedsesphotoid; 
    
    xmlHttp.onreadystatechange=  fnSessionClassifiedPhoto;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 }
 
  function fnSessionClassifiedPhoto(){
    if (xmlHttp.readyState==4)
     {     
        var result = Trim(xmlHttp.responseText)
        document.getElementById('photo_slide').innerHTML =result;  
           
   }   
  }
 
 
 
  function fnAssignSessionPhoto(photosesid, desfile){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?photosesid="+photosesid+"&desfile="+desfile; 
    
    xmlHttp.onreadystatechange=  fnSessionPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  } 
  
  function fnSessionPhoto(){
   if (xmlHttp.readyState==4)
   {     
        var result = Trim(xmlHttp.responseText)
        window.location.href=result;  

          
   } 
  }



function fnAssignReviewSession(fileid, reviewId, filetype){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   loadimg = "<img src='images/barloading.gif'>" ; 
   document.getElementById(filetype).innerHTML=loadimg; 
  
   
    var url="ajax_member.php";
	if(filetype == 'photo_slide') {
		url=url+"?reviewsesphotoid="+fileid+"&reviewId="+reviewId+"&filetype="+filetype;
	}
	else if(filetype == 'video_slide') {
		url=url+"?reviewsesvideoid="+fileid+"&reviewId="+reviewId+"&filetype="+filetype;
	}
    
    xmlHttp.onreadystatechange=  fnSessionReview;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 }
 
  function fnSessionReview(){
    if (xmlHttp.readyState==4)
     {     
        var result = Trim(xmlHttp.responseText)
			res     = result.split('-@@@-');
		myValue = res[0].replace(/^\s*|\s*$/g,'');
        document.getElementById(myValue).innerHTML =res[1];  
           
   }   
  }
 



  
   function fnCommunityPhotoComment(commentuser, activity, textareaid,limitPhotoCnt,comAlbumID ){  
    textId  = "txtComment"+textareaid
    txtComment= document.getElementById(textId).value;    
	document.getElementById('showLoading'+textareaid).innerHTML ="<img src='images/loading.gif'>";
    xmlHttp=GetXmlHttpObject();     
    if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?postCommuntyPhotoComment="+txtComment+"&commentuser="+commentuser+"&activity="+activity+"&textareaid="+textareaid+"&limitPhotoCnt="+limitPhotoCnt+"&comAlbumID="+comAlbumID; 
    
    xmlHttp.onreadystatechange=  fnSessionStatusComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  }    
  
  function fnPostPhotoComment(commentuser, activity, textareaid ){ 
  
    
    textId  = "txtComment"+textareaid
    txtComment= document.getElementById(textId).value;    
	document.getElementById('showLoading'+textareaid).innerHTML ="<img src='images/loading.gif'>";
    xmlHttp=GetXmlHttpObject();     
    if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?postPhotoComment="+txtComment+"&commentuser="+commentuser+"&activity="+activity+"&textareaid="+textareaid; 
    
    xmlHttp.onreadystatechange=  fnSessionStatusComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  }    
  
  
  
  function fnLinkComment(commentuser, activity, textareaid ){ 
  
    
    textId  = "txtComment"+textareaid
    txtComment= document.getElementById(textId).value;    
	document.getElementById('showLoading'+textareaid).innerHTML ="<img src='images/loading.gif'>";
    xmlHttp=GetXmlHttpObject();     
    if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?linkComment="+txtComment+"&commentuser="+commentuser+"&activity="+activity+"&textareaid="+textareaid; 
    
    xmlHttp.onreadystatechange=  fnSessionStatusComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  
  }    
  
  function fnStatusComment(commentuser, activity, textareaid ){
    textId  = "txtComment"+textareaid
    txtComment= document.getElementById(textId).value;    
	document.getElementById('showLoading'+textareaid).innerHTML ="<img src='images/loading.gif'>";
    xmlHttp=GetXmlHttpObject();     
    if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?statusComment="+txtComment+"&commentuser="+commentuser+"&activity="+activity+"&textareaid="+textareaid; 
    
    xmlHttp.onreadystatechange=  fnSessionStatusComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    
     
  }       
   function fnSessionStatusComment(){
     if (xmlHttp.readyState==4)                                
     { 
      
  
      result  = Trim(xmlHttp.responseText);    
      res     = result.split('-@@@-');  

		myValue = res[0].replace(/^\s*|\s*$/g,'');
	  document.getElementById('showLoading'+myValue).innerHTML ='';
     
      eDIV       =     document.createElement("div");
      commentDiv  = 'commentDiv'+parseInt(Trim(res[1]));
      
      eDIV.setAttribute("id",commentDiv);
      eDIV.setAttribute("style", "display: ;")
      targetDiv = "comment"+parseInt(Trim(res[0]));   
                                              
      document.getElementById(targetDiv).appendChild(eDIV);        
      document.getElementById(commentDiv).innerHTML =  res[2];
      
      disobj="layer"+parseInt(Trim(res[0]));   
      disableOnlyLayer(disobj);          
       
     }
   
   }
   


  function disableOnlyLayer(obj){      

    obj = document.getElementById(obj);                                      
    obj.style.visibility =  'hidden';
    obj.style.display = 'block';    
 }

  
  function showAdImage(ImageName,defaultAd) {
   
	   xmlHttp=GetXmlHttpObject();     
	   if (xmlHttp==null)
	   {
		  alert("Your browser does not support AJAX!");
		  return;
	   } 
	   var url="ajax_member.php";
	   url=url+"?showAdsImage="+ImageName+"&defaultAd="+defaultAd;
	   
		document.getElementById('selectImage').innerHTML ="<img src='images/loading.gif'>";
	   xmlHttp.onreadystatechange= function () {
		   if (xmlHttp.readyState==4)
		   {   
			   var result = Trim(xmlHttp.responseText) 
				  
			   document.getElementById('selectImage').innerHTML ="<img src='banner_ad/"+ImageName+"' />";
			   location.href='changeAdBanner.php';
		   }
	   }; 
	   xmlHttp.open("GET",url,true);
	   xmlHttp.send(null); 


	 //document.getElementById('selectImage').innerHTML = "<img src='banner_ad/"+ImageName+"' />";
  }
  
  function fnPhotoComment(commentuser, photoid){
   txtComment= document.getElementById('txtComment').value;
  
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?txtComment="+txtComment+"&commentuser="+commentuser+"&commentphotoid="+photoid; 
    
    xmlHttp.onreadystatechange=  fnSessionPhotoComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
  
  function fnSinglePhotoComment(commentuser, photoid){
   txtComment= document.getElementById('txtComment').value;
  
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?txtCommentSingle="+txtComment+"&commentuserSingle="+commentuser+"&commentphotoidSingle="+photoid; 
    
    xmlHttp.onreadystatechange=  fnSessionPhotoComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
     
  
  function fnSessionPhotoComment(){
     if (xmlHttp.readyState==4)                                
     {   
         document.getElementById('txtComment').value='';
         result  = xmlHttp.responseText; 
         res     = result.split('@@@');                 
         eDIV       =     document.createElement("div");
         commentDiv  = 'commentDiv'+res[1];
         
         eDIV.setAttribute("id",commentDiv);
         eDIV.setAttribute("style", "display: ;")
         document.getElementById("postListing1").appendChild(eDIV);        
         document.getElementById(commentDiv).innerHTML =  res[0];
         
     }
  }
  
  function delComment(delid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?commentdelid="+delid; 
    
    xmlHttp.onreadystatechange=  fndeleteComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);   
  }
  
  function delPostComment(delid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?commentpostdelid="+delid; 
    
    xmlHttp.onreadystatechange=  fndeleteComment
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);   
  }
  
  
  
  
   function fndeleteComment(){
     if (xmlHttp.readyState==4)
     { 
        var result = Trim(xmlHttp.responseText)   
        commentDiv  = 'commentDiv'+result;  
        document.getElementById(commentDiv).style.display  = "none" ;  
         
      
     }
   }
   
    function fnMessageReply1(){
       if(document.getElementById('messagePosting').style.display == "none"){    
                         
        } 
        else{
            document.getElementById('messagePosting').style.display = "none"     
                 
        }
    }
   
 function fnMessageReply(){ 
        if(document.getElementById('profileCont1').style.display == "none"){    
            document.getElementById('profileCont1').style.display = "block"               
            document.getElementById('messageCont').style.display = "block"               
        } 
        else{
            document.getElementById('profileCont1').style.display = "none"     
            document.getElementById('messageCont').style.display = "none"         
        }
 }
 

  
  
 
 function fnViewPhoto( userId,PhotoId ,desfile){
 
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?photouid="+userId+"&PhotoId="+PhotoId+"&desfile="+desfile; 
    
    xmlHttp.onreadystatechange=  fnAssignViewPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
 
 }          
 
  function fnAssignViewPhoto(){
   if (xmlHttp.readyState==4)
    {     
        var result = Trim(xmlHttp.responseText)
        window.location.href=result;  

          
    }
  
  
  }


 function fnFriendAction(action,cat,memid,requestorid,filename){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?action="+action+"&cat="+cat+"&memberid="+memid+'&requestorid='+requestorid+'&filename='+filename; 
    
    xmlHttp.onreadystatechange= friendAct
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);  
 
 } 
 function friendAct(){ 
     if (xmlHttp.readyState==4)
    {      
       if(Trim(xmlHttp.responseText) !=''){  
           res = Trim(xmlHttp.responseText).split("~") 
                                                           

            if(res[0]=='A')
              document.getElementById('replacediv').innerHTML="Accepted successfully!"
            if(res[0]=='D') 
              document.getElementById('replacediv').innerHTML="Denied Accessfully!"
              
            window.location.href=res[1];  
       }
    }
    
 }
 
 function fnSesMessage(id,status,fname){  
     
 
 xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   
    var url="ajax_member.php";
    url=url+"?messesid="+id+"&fname="+fname+"&status="+status;   

    
  
    xmlHttp.onreadystatechange= fnSessionMessageAssign
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    
 
 }
 
  function fnSessionMessageAssign(){
    if (xmlHttp.readyState==4)
    {  
  
         var result = Trim(xmlHttp.responseText)
        window.location.href=result;  

          
    }
  
  }
  
       
 function getUserInfo(messageuserid, formid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   
    var url="ajax_member.php";
    url=url+"?messageuserid="+messageuserid+"&formid="+formid;   

    
  
    xmlHttp.onreadystatechange= fnAssignFirstLastName
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 }
 
 function fnAssignFirstLastName(){
    if (xmlHttp.readyState==4)
    {                       
      var res = Trim(xmlHttp.responseText);  
      
       resArr = res .split('@')
       formid      = 'txtTo'+resArr[1];              
      
      document.getElementById(formid).value=resArr[0] ;
      
    }
 }   
  
  function messageSubmission(id){    
  subject    = document.getElementById('txtSubject'+id).value; 
  txtMessage = document.getElementById('txtMessage'+id).value;  
  user_id  = document.getElementById('txtUserId'+id).value; 
  loadimg = "<img src='images/loading.gif'>" ; 
  document.getElementById('msgSuc'+id).innerHTML=loadimg; 
  
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   
    var url="ajax_member.php";      
    url=url+"?msgFID="+id+"&msgUserId="+user_id+"&msgMessage="+txtMessage+"&msgSubject="+subject;   
    xmlHttp.onreadystatechange= fnFriendMessageSubmission
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
   
  }
  
  
function fnFriendMessageSubmission(){
   if (xmlHttp.readyState==4)
    {      
      var result = Trim(xmlHttp.responseText);    
       resArr = result.split('@');  
        
       cancelInvisible(resArr[1])
       divid = 'msgSuc'+resArr[1] 
         
       
       if (Trim(resArr[0])== 'F'){ 
       document.getElementById(divid).innerHTML = 'Error!';    
         
       }
       else {
            document.getElementById(divid).innerHTML    = 'Sent Successfully!';  
           // document.getElementById(divid).innerHTML = resArr[0];  
       }
              
      
    }
}
  
  
  
function fnmessageSubmission(){
   if (xmlHttp.readyState==4)
    {   
      
      var result = Trim(xmlHttp.responseText);    
       resArr = result.split('@');
       
         
       cancelInvisible(resArr[1])
       divid = 'msgSuc'+resArr[1] 
       
       
       
       if (Trim(resArr[0])== 'F'){ 
       document.getElementById(divid).innerHTML = 'Error!';    
         
       }
       else {
            document.getElementById(divid).innerHTML    = 'Sent Successfully!';  
           // document.getElementById(divid).innerHTML = resArr[0];  
       }
      
    }
}

 function linkSubmission(){
 txLink    = document.getElementById('txLink').value; 


  
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   
    var url="ajax_member.php";      
    url=url+"?txLink="+txLink;   
    xmlHttp.onreadystatechange= fnmessageSubmission
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
 }
 
 

function assignSessionId(id,filename){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?sesid="+id+'&filename='+filename;         
    xmlHttp.onreadystatechange= fnSessionAssign
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}



 
 
 function assignFriendSessionId(id,filename){        
 
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?frndsesid="+id+'&filename='+filename;         
    xmlHttp.onreadystatechange= fnSessionAssign
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
 } 
 function fnSessionAssign(){
     if (xmlHttp.readyState==4)
    {                       
      var result = Trim(xmlHttp.responseText);  
           
              
        window.location.href=result;      
    }
 }   
 
 function assignNonFriendSessionId (id,filename){ 

 
  xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?nonfrndsesid="+id+'&filename='+filename;         
    xmlHttp.onreadystatechange= fnSessionAssign
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
 
 }
 
 
  function photoDelete(id,folderDiff,fileName){
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   

    var url="ajax_member.php";
    url=url+"?photoid="+id+'&folderDiff='+folderDiff+'&fileName='+fileName;         
    xmlHttp.onreadystatechange= fnDeletionPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
       
  }
  
  function fnDeletionPhoto(){
    if (xmlHttp.readyState==4)
    {  
      result = Trim(xmlHttp.responseText);      
      
        
      paramArr = result.split("~")   
   
   
      if(paramArr[1]=='T')
           window.location.href=paramArr[0];   
      else  
        document.getElementById('errdiv').innerHTML = "Error Occurred!";     
                                                 
        //window.location.href=result;      
    }
  }
  
            
  function albumDelete(id,folderDiff,fileName){  
  
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   

    var url="ajax_member.php";
    url=url+"?albumid="+id+'&folderDiff='+folderDiff+'&fileName='+fileName;         
    xmlHttp.onreadystatechange= fnDeletionPhoto
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
  function fnSelectVisitorJob(jobid){
  
    xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?selected_visjobid="+jobid;

    xmlHttp.onreadystatechange= selectJob;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
  function fnSelectJob(jobid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?selected_jobid="+jobid;
   
    xmlHttp.onreadystatechange= selectJob;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}          


function fnSelectBusinessJob(jobid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?selected_busjobid="+jobid;
   
    xmlHttp.onreadystatechange= selectJob;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}  


function selectJob() 
{  
    if (xmlHttp.readyState==4)
    {    
              
       window.location.href=Trim(xmlHttp.responseText);  
    }

} 
  
function fnSelectBusiness(busid){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?selected_busid="+busid;
   
    xmlHttp.onreadystatechange= selectBusiness;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}  
  

function fnVisitorSelectBusiness(busid){
   
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?visselected_busid="+busid;
   
    xmlHttp.onreadystatechange= selectBusiness;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function selectBusiness() 
{  
    if (xmlHttp.readyState==4)
    {               
       window.location.href=Trim(xmlHttp.responseText);  
    }

}  

 function fnBusinessReview(){
    d = document.business_review;
    msg1    =    "Processing... Please wait...";
    document.getElementById("errordiv").innerHTML=msg1;
    var msg ='';         
    if(Trim(d.reviewTitle.value)==''){   
             msg =msg+"<li>Review Title Required."+"</li>"  ;           
    } 
	else {
		d.reviewTitle.value = d.reviewTitle.value.replace(/^\s+|\s+$/g,"");
	}
    if(Trim(d.reviewDesc.value)==''){                  
           msg =msg+"<li>Review Description Required."+"</li>"  ;   
    } 
	else {
		d.reviewDesc.value = d.reviewDesc.value.replace(/^\s+|\s+$/g,"");
	}
     
    if(msg !=''){
        msg  = "<ul>"+msg+"</ul>"  
        scroll(0,300);  
        document.getElementById("errordiv").innerHTML=msg;
        return false;
   }
    else{
        return true;
    }
 }

function fnPhotoDelete(delPhotoId,folderpath,fileName,tableName){
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?delPhotoId="+delPhotoId+"&folderpath="+folderpath+"&fileName="+fileName+"&tableName="+tableName; 
    xmlHttp.onreadystatechange= fnPhotoDeleteResult;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function fnPhotoDeleteResult(){
 if (xmlHttp.readyState==4)
 {
    window.location.href=Trim(xmlHttp.responseText);            
 }
}
         
function addWatch(memid,memtype,type,recorid,processtype){  
 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?memid="+memid+"&memtype="+memtype+"&type="+type+"&recorid="+recorid+'&processtype='+processtype;
   
    xmlHttp.onreadystatechange= watchfunction;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
     
}   
function watchfunction() 
{  
    if (xmlHttp.readyState==4)
    {  
                    
       window.location.href=Trim(xmlHttp.responseText);    
        
    }

}               

function removeWatch(memid,memtype,type,recorid,processtype){  
 
   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
    var url="ajax_member.php";
    url=url+"?memid="+memid+"&memtype="+memtype+"&type="+type+"&recorid="+recorid+'&processtype='+processtype;
   
    xmlHttp.onreadystatechange= watchfunction;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
     
}   



function fnSelectConfirmation()
{                          
    var iChkCount = document.getElementsByName("features[]").length;
    var iCount = 0;
    for (i=1; i<=iChkCount; i++)
    if(eval("document.getElementById('features" + i + "')").checked)
            iCount++;

          
  
    if (iCount == 0)
    {  
        return false;
    } 
    return  true;  
 
            
 }  

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;
}

function validChar(sText){
    var IsChar=true;
   var Char; 
   for (i = 0; i < sText.length && IsChar == true; i++) 
      { 
      Char = sText.charAt(i); 
      if ( Char == '"') 
         {
             IsChar = false;
         }
      }
   return IsChar;
}


   function EFFECTIVE_DATE_OnChange(effDateChar)
    {
    
          var bufArray = effDateChar.split("/");     
          var effDateMonth = bufArray[0];   
          var effDateDay = bufArray[1];                        
          var effDateYear = bufArray[2];  
    
            firstDate = new Date(effDateYear, effDateMonth, effDateDay);
            fDate = new Date();
            y2=fDate.getFullYear();
            m2=fDate.getMonth()+1;
            d2=fDate.getDate();
            todayDate = new Date(y2,m2,d2);
            msPerDay = 24 * 60 * 60 * 1000;
            dayDiff = Math.floor((firstDate-todayDate)/ msPerDay);
            if(dayDiff>=0)
            {
                return true;
            }
            else
            {
                return false;
            }
    }
    
       function fnFutureDateLimit(enterDate,endDate){
     
          var bufArray = enterDate.split("/");     
          var effDateMonth = bufArray[0];   
          var effDateDay = bufArray[1];                        
          var effDateYear = bufArray[2];  
    
          eDate = new Date(effDateYear, effDateMonth, effDateDay);
          
          
          var endArray = endDate.split("/");     
          var endDateMonth = endArray[0];   
          var endDateDay = endArray[1];                        
          var endDateYear = endArray[2];  
          
          fDate = new Date(endDateYear, endDateMonth, endDateDay);    
          msPerDay = 24 * 60 * 60 * 1000;        
          
         dayDiff = Math.floor((eDate-fDate)/ msPerDay);  
         if(dayDiff<=0)
         {
                return true;
         }
         else
         {
                return false;
         } 
     }
     
function commaSepNumcheck(sText){  
   var ValidChars= "0123456789.,";    
   var IsChar=true;
   var Char; 
   for (i = 0; i < sText.length && IsChar == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
             IsChar = false;
         }
      }
   return IsChar;
    
    
 }
 
 function enterKeyValidation(){
     alert("aaaa");
 }
 
function urlValidation(value) {
    var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
    if(urlregex.test(value))
    {
    return(true);
    }
    return(false);
}

  function jTab(cnt, cid, nid)
  {      
     if(document.getElementById(cid).value.length==cnt)
     {
        document.getElementById(nid).focus();
     }
  }


function numCheck(num){
      var pattern2=/(^(0|[1-9][0-9]*)$)|((^(0?|[1-9][0-9]*)\.(0*[1-9][0-9]*)$)|(^[1-9]+[0-9]*\.0+$)|(^0\.0+$))/;

    var matchval=num.match(pattern2);
    if(matchval==null){    
        return false;
    }
    return true;
}


function deleteRcord(cid ,url)
{
            if(confirm("Are you sure you want to Delete this Record?"))
            {
                window.location.href=url+"?act=rem&cid="+cid;
            }
     
}

function  fndeletionConfirmation(type){
     if(confirm("Are you sure that you want to delete this "+type+"?"))  
         return  true; 
     else 
        return  false; 
}


function deleteMessage(delType,cid ,url)  {
      if(confirm("Are you sure you want to Delete this Record?"))
            {
                window.location.href=url+"?act=rem&cid="+cid+"&delType="+delType;
            }
     

}

function fnSaveMyCoupon(cid, mid){

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?myCoupon="+cid+"&mid="+mid;
   
    document.getElementById('status'+cid).innerHTML ='loading..';
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
	       document.getElementById('status'+cid).innerHTML ='<span class="errmsg1">'+result+'<span>';
	   }
   }; 
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}


function fnPrintMyCoupon(cid, mid){

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?myPCoupon="+cid+"&mid="+mid;
   
    document.getElementById('status'+cid).innerHTML ='loading..';
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
	       document.getElementById('status'+cid).innerHTML ='<span class="errmsg1">'+result+'<span>';
	   }
   }; 
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}

function fnDeleteMyCoupon(cid, mid){

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?myDCoupon="+cid+"&mid="+mid;
   
    document.getElementById('status'+cid).innerHTML ='loading..';
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
	       document.getElementById('status'+cid).innerHTML ='<span class="errmsg1">'+result+'<span>';
	   }
   }; 
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}

function fnDeleteSavedCoupon(cid, mid){

   xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   var url="ajax_member.php";
   url=url+"?DeleteSavedCoupon="+cid+"&mid="+mid;
   
    document.getElementById('status'+cid).innerHTML ='loading..';
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
	       document.getElementById('status'+cid).innerHTML ='<span class="errmsg1">'+result+'<span>';
	   }
   }; 
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}

function fnMyPageShowMore(postMessage,perPage,pageNo){

	 xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   document.getElementById('loadme').innerHTML ='<div id="left_div" style="font-size:16px;font-weight:bold;">loading..</div>';
   var url="myPageShowmore.php";
   url=url+"?lastElement="+postMessage+"&perPage="+perPage+"&pageNo="+pageNo;
   
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
		   result = result.replace(/^\s+|\s+$/g,"");

   		   result = result.split("@@#$%^@@");
		  
		   if(result[1] == 0){
			 //  alert('1');
			   document.getElementById('showOlderPostOption').style.display='none';
		   }
		   if(result[0] == 0) {
			 
			document.getElementById('loadme').innerHTML ='<div id="left_div" style="font-size:16px;font-weight:bold;">No Records</div>';
		   } else {
		   $('div[id=postMessage'+postMessage+']').append(result[0]);
		   document.getElementById('loadme').innerHTML ='';
		   }
		   document.getElementById('showmoreClick').value = parseInt(pageNo) + 1;
	   }
   }; 
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}


function fnMyPanelShowMore(postMessage,perPage,pageNo){

	 xmlHttp=GetXmlHttpObject();     
   if (xmlHttp==null)
   {
      alert("Your browser does not support AJAX!");
      return;
   } 
   document.getElementById('loadme').innerHTML ='<div id="left_div" style="font-size:16px;font-weight:bold;">loading..</div>';
   var url="myPanelShowmore.php";
   url=url+"?lastElement="+postMessage+"&perPage="+perPage+"&pageNo="+pageNo;
   
   xmlHttp.onreadystatechange= function () {
	   if (xmlHttp.readyState==4)
	   {   
		   var result = Trim(xmlHttp.responseText) 
			  
	       
		   result = result.replace(/^\s+|\s+$/g,"");
		   if(result == 0) {
			 
			document.getElementById('loadme').innerHTML ='<div id="left_div" style="font-size:16px;font-weight:bold;">No Records</div>';
		   } else {
		   $('div[id=postMessage'+postMessage+']').append(result);
		   document.getElementById('loadme').innerHTML ='';
		   }
		   document.getElementById('showmoreClick').value = parseInt(pageNo) + 1;
	   }
   }; 
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null); 

}

 function sysDateFormat(ctl){    
//
   var cal = new Array();  
   cal['01'] = "Jan";
   cal['02'] = "Feb";
   cal['03'] = "Mar";
   cal['04'] = "Apr";
   cal['05'] = "May";
   cal['06'] = "Jun";
   cal['07'] = "Jul";
   cal['08'] = "Aug";
   cal['09'] = "Sep";
   cal['10'] = "Oct";
   cal['11'] = "Nov";
   cal['12'] = "Dec";  

   var sysDate = new Date();   
   var effDateChar =ctl; // P_EFFECTIVE_DATE

   // translate date entered by user into JS format
   var bufArray = effDateChar.split("/");   
   
  
   
   var effDateMonth = cal[bufArray[0]];   
  

   var effDateDay = bufArray[1];                        
   var effDateYear = bufArray[2];    
   var effDateDate = new Date(effDateMonth+" "+ effDateDay +
                       ", "+effDateYear+" 23:59:59");   

   return effDateDate; 
 
 }

function validate(type)
{  
    typeVal  =document.getElementById('lstMesType').value;
    
    var iCount = 0;

    if(typeVal==0){
    
        ids     = document.getElementById('txtUnread').value      
        if(Trim(ids) !=''){
            idsArr  = ids.split(',');     
            var iChkCount = idsArr.length;
            
           
            
            for(i=0;i<idsArr.length;i++){
                 j= idsArr[i] 
                 ckid = "chk"+j; 
                 iCount++
              document.getElementById(ckid).checked = true;
            } 
        }
            
               
    }
    else if(typeVal==1){        
        ids     = document.getElementById('txtRead').value
        
        if(Trim(ids) !=''){
            idsArr  = ids.split(','); 
            
            var iChkCount = idsArr.length;
           
           
            for(i=0;i<idsArr.length;i++){
                 j= idsArr[i] 
                 ckid = "chk"+j; 
                 iCount++ 
              document.getElementById(ckid).checked = true;
            }  
        }
        
           
    }
    else if(typeVal==2 || typeVal==4 ){     

        ids     = document.getElementById('txtAll').value
        
        if(Trim(ids) !=''){
            idsArr  = ids.split(','); 
            var iChkCount = idsArr.length;
            
            for(i=0;i<idsArr.length;i++){
                  j = idsArr[i]
                 ckid = "chk"+j; 
                 iCount++ 
              document.getElementById(ckid).checked = true;
            }  
      }
        
        
    }   
    alertMsg = "Select atleast one message to "+ type;
    confirmMsg = "Are you sure you want to "+type +" the selected messages?";        
  
 
    if (iCount == 0)
    {
        alert(alertMsg);
        return false;
    }
    if(!confirm(confirmMsg))
        return false;
    else
        return true;
            
 } 

    function passwordValidation(sText)
{
  
   var IsChar=true;
   var Char; 
   for (i = 0; i < sText.length && IsChar == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (Char == "'" || Char == '"') 
         {
             IsChar = false;
         }
      }
   return IsChar;
}
 

  
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

              
// stop hiding --> 
