var pid = null;

function checkPostAd(frm)
{

    if(frm.adtitle.value=='')
    {
        alert('Please Enter Title');
        frm.adtitle.focus();
        return false;
    }
    if(document.getElementById('longdescription').value == '')
    {
        alert('Please Enter Description');
        frm.longdescription.focus();
        return false;
    }
    if(frm.statenm.value == '')
    {
        alert('Please Select State');
        frm.statenm.focus();
        return false;
    }
    if(frm.email.value == '')
    {
        alert('Enter email id ');
        frm.email.focus();
        return false;
    }   
    else if(frm.email.value != '')
    {
        if(!(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(frm.email.value)))
        {
            alert(' Invalid Email Address.. Please Re-enter it ');
            frm.email.focus();
            return false;
        }
    }
    if(frm.postad_security_code.value == '')
    {
        alert(' Please Enter Security Code !!');
        frm.postad_security_code.focus();
        return false;
    }
    return true;
}

function DisplayCategory()
{
    document.getElementById('Category').style.display = '';
    document.getElementById('Location').style.display = 'none';
}
function DisplayLocation()
{
    document.getElementById('Location').style.display = '';
    document.getElementById('Category').style.display = 'none';
}

function checkRegistration()
{
    if(document.registerfrm.firstname.value == '')
    {
        alert('Please Enter First Name ');
        document.registerfrm.firstname.focus();
        return false;
    }

    if(document.registerfrm.nickname.value == '')
    {
        alert('Please Enter NickName ');
        document.registerfrm.nickname.focus();
        return false;
    }

    if(document.registerfrm.job_title.value == '')
    {
        alert('Please Enter Job Title');
        document.registerfrm.job_title.focus();
        return false;
    }


    if(document.registerfrm.industrytype.value == '')
    {
        alert('Please select Industry');
        document.registerfrm.industrytype.focus();
        return false;
    }

    if(document.registerfrm.useremail.value == '')
    {
        alert('Please Enter Email Id ');
        document.registerfrm.useremail.focus();
        return false;
    }
    else if(!(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(document.registerfrm.useremail.value)))
    {
        alert('Please Enter Valid Email Id ');
        document.registerfrm.useremail.focus();
        return false;
    }
    
    if(document.registerfrm.userpassword.value == '')
    {
        alert(' Please Enter Password ');
        document.registerfrm.userpassword.focus();
        return false;
    }   
    else if(document.registerfrm.userpassword.value.length < 6)
    {
        alert('Password must be at least 6 characters');
        document.registerfrm.userpassword.focus();
        return false;
    }
    if(document.registerfrm.confirmpassword.value == '')
    {
        alert('Please Enter Confirm Password ');
        document.registerfrm.confirmpassword.focus();
        return false;
    }
    else if(document.registerfrm.userpassword.value != document.registerfrm.confirmpassword.value)
    {
        alert('Both passwords do not match');
        document.registerfrm.confirmpassword.focus();
        return false;
    }

    if(document.registerfrm.register_security_code.value == '')
    {
        alert(' Please Enter Security Code ');
        document.registerfrm.register_security_code.focus();
        return false;
    }
    return true;
}

function checkSignIn(signfrm)
{
    if(signfrm.signemail.value == '')
    {
        alert(' Please Enter Email Id ');
        signfrm.signemail.focus();
        return false;
    }
    else if(!(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(signfrm.signemail.value)))
    {
        alert('Please enter a valid Email Id');
        signfrm.signemail.focus();
        return false;
    }

    if(signfrm.signpassword.value == '')
    {
        alert('Please Enter Password');
        signfrm.signpassword.focus();
        return false;
    }
    return true;
}

function checkForgotten(forgotfrm)
{
    if(forgotfrm.forgotemail.value == '')
    {
        alert('Please Enter Email Id');
        forgotfrm.forgotemail.focus();
        return false;
    }
    else if(!(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(forgotfrm.forgotemail.value)))
    {
        alert('Enter valid email id');
        forgotfrm.forgotemail.focus();
        return false;
    }
    return true;
}

function checkPassword()
{
    if(document.changepassfrm.chcurpassword.value == '')
    {
        alert(' Please Enter Current Password ');
        document.changepassfrm.chcurpassword.focus();
        return false;
    }
    if(document.changepassfrm.chpassword.value == '')
    {
        alert(' Please Enter New Password ');
        document.changepassfrm.chpassword.focus();
        return false;
    }

    if(document.changepassfrm.chrepassword.value == '')
    {
        alert(' Please Re-type Password ');
        document.changepassfrm.chrepassword.focus();
        return false;
    }

    if(document.changepassfrm.chpassword.value.length < 6)
    {
        alert(' Length of New Password should be at least 6 characters. ');
        document.changepassfrm.chpassword.focus();
        return false;
    }

    if(document.changepassfrm.chpassword.value != document.changepassfrm.chrepassword.value)
    {
        alert(' Both Passwords does not Match');
        document.changepassfrm.chrepassword.focus();
        return false;
    }
    return true;
}
function checkNickname()
{
    if(document.frmChangeNickname.txtNickname.value == '')
    {
        alert('Please Enter Valid Nickname');
        document.frmChangeNickname.txtNickname.focus();
        return false;
    }
    return true;
}

function checkProfile(proffrm)
{
    if(proffrm.chfirstname.value == '')
    {
        alert('Please Enter First Name');
        proffrm.chfirstname.focus();
        return false;
    }
    return true;
}

function chkLinkToFriend(adlinkmail)
{
    if(adlinkmail.from_email.value == '')
    {
        alert('Please Enter From Email Id');
        adlinkmail.from_email.focus();
        return false;
    }

    else if(!(adlinkmail.from_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
    {
        alert('Enter valid From Email Id');
        adlinkmail.from_email.focus();
        return false;
    }

    if(adlinkmail.to_email.value == '')
    {
        alert('Please Enter To Email Id');
        adlinkmail.to_email.focus();
        return false;
    }

    else if(!(adlinkmail.to_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
    {
        alert('Enter valid To Email Id');
        adlinkmail.to_email.focus();
        return false;
    }

    return true;
}

/* START CODE FOR : for open popup with parent window disable  */
function setLayerPosition(showid,hideid) 
{
    var shadow = document.getElementById(showid);
    var question = document.getElementById(hideid);
    
    shadow.style.width = document.body.clientWidth + "px";
    shadow.style.height = document.body.clientHeight + "px";
    
    shadow = null;
    question = null;
}

function showLayer(showid,hideid)
{
    setLayerPosition(showid,hideid);
    var shadow = document.getElementById(showid);
    var question = document.getElementById(hideid);

    shadow.style.display = "block"; 
    question.style.display = "block";

    shadow = null;
    question = null;
}

function hideLayer(showid,hideid)
{
    var shadow = document.getElementById(showid);
    var question = document.getElementById(hideid);

    shadow.style.display = "none"; 
    question.style.display = "none";

    shadow = null;
    question = null; 
}
/* END CODE FOR : for open popup with parent window disable  */
function deleteCheck(path)
{
    var msg;
    msg=confirm("Are You Sure to Delete This Ad !!!");
    if(msg)
    {
        window.location.href=path;
    }
    return false;
}

function ajaxFunction(resultid,sendurl,passval)
{
    document.getElementById(resultid).style.display = '';
    var startloc = passval;
    startloc = startloc.replace(/\s+/g,'-');
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    var url = sendurl+startloc;
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {   
            if(resultid != 'autoFillRes' && resultid != 'PostCityList')
            {
                var strsearch = xmlHttp.responseText.search("and");
                if(strsearch == -1 )
                {
                    document.getElementById(resultid).innerHTML=xmlHttp.responseText;
                }
                else
                {
                    var mymsg = xmlHttp.responseText.split("and");
                    document.getElementById(resultid).innerHTML=mymsg[0];
                    document.getElementById("OpenWatchList").innerHTML=mymsg[1];
                }
                    
            }
            else
            {
                
                document.getElementById(resultid).innerHTML=xmlHttp.responseText;
            }
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function AutoLocationReturn(ctname)
{
    document.SearchFrm.l.value = ctname
    document.getElementById('autoFillRes').style.display = 'none';
}

function chkingsearch()
{
    if(document.SearchFrm.q.value == '' && document.SearchFrm.l.value == '')
    {
        alert("please enter keyword or location");
        document.SearchFrm.q.focus();
        return false;
    }
    return true;
}

function chkingcontactus(conus)
{
    if(conus.contact_email.value == '')
    {
        alert('Please enter email id ');
        conus.contact_email.focus();
        return false;
    }
    else if(!(conus.contact_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
    {
        alert('Enter valid From Email Id');
        conus.contact_email.focus();
        return false;
    }
    if(conus.contact_msg.value == '')
    {
        alert('Please enter message');
        conus.contact_msg.focus();
        return false;
    }
    if(conus.contact_security_code.value == '')
    {
        alert('Please enter word verification');
        conus.contact_security_code.focus();
        return false;
    }
    return true;
}
function validateimproperAd()
{
    var chks = document.getElementsByName('rtpad');
    var hasChecked = false;
    for (var i = 0; i < chks.length; i++)
    {
        if (chks[i].checked)
        {
            hasChecked = true;
            break;
        }
    }
    if (hasChecked == false)
    {
        alert('Please select a reason for reporting this ad');
        return false;
    }
    if(document.reportimproper.report_email.value == '')
    {
        alert('Please enter email id');
        document.reportimproper.report_email.focus();
        return false;
    }
    else if(!(document.reportimproper.report_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
    {
        alert('Enter valid From Email Id');
        document.reportimproper.report_email.focus();
        return false;
    }
    return true;
}
function ajaxKeyword(desturl,keyword,dest,categoryId,txtbox)
{
    if(!categoryId)
    {
        document.addKeywordsfrm.catlist.focus();
        alert('Select Catagory');
        return false;
    }
    document.getElementById(dest).innerHTML='';
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
        return xmlHttp;
    }
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }
    
    var url=desturl+"/administrator/addKeywords.php";
    url=url+"?action=A&check=insertedKeywords&keyword="+keyword+"&categoryId="+categoryId;
    
    xmlHttp.onreadystatechange=function() 
    { 
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
        { 
            document.getElementById(dest).innerHTML=xmlHttp.responseText;
        } 
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function loadChild(parentid)
{
    pid = parentid;
    xmlHttp=GetXmlHttpObject();
        if (xmlHttp==null)
        {
            alert ("Your browser does not support AJAX!");
            return;
        }
    var url="/administrator/loadChild.php";
    url=url+"?id="+parentid;
    
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function stateChanged() 
{
    if (xmlHttp.readyState==4)
    {
        document.getElementById("children"+pid).innerHTML=xmlHttp.responseText;

        var divid = document.getElementById("children"+pid);
        if(divid.style.display == "")
        {
            divid.style.display = "none";
            document.getElementById("image"+pid).src = "../images/plus.gif";
        }
        else
        {
            divid.style.display = "";
            document.getElementById("image"+pid).src = "../images/minus.gif";
        }   
    }
}

function GetXmlHttpObject()
{
    var xmlHttp=null;
        try
        {
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
    return xmlHttp;
}

function chekingAddKeyword()
{
    if(document.addKeywordsfrm.catlist.value == '')
    {
        alert("Please select category ");
        document.addKeywordsfrm.catlist.focus();
        return false;
    }
    return true;
}

function nospaces(textname)
{
    var t = textname;
    var v = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
    var w = "";
    for (i=0; i < t.value.length; i++) 
    {
        x = t.value.charAt(i);
        if (v.indexOf(x,0) != -1)
            w += x;
    }
    t.value = w;
    document.getElementById('nicknm').innerHTML=w;
    
}

/********* for disable share button when twite empty ********/
function blah(clsNm)
{   
    //alert(clsNm);
    var txtmsg = document.comv_message.post_conv.value;
    if(txtmsg == "What's on your mind? What you have achieved recently?")
        document.comv_message.post_conv.value='';

    document.comv_message.post_conv.className="textbox1 "+clsNm;
}

function blah_msg(form_objmsg)
{
    if (form_objmsg.direct_msg.value != '' && form_objmsg.to_user.value != '')
        form_objmsg.Send.disabled = false;
    else
        form_objmsg.Send.disabled = true;
}

/* For OpenInviter Module*/
function keyword(typedisplay)
{
    
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
        return xmlHttp;
    }
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }
    var url="http://www.brick7.rpa/OpenInviter/getlist.php?provider_type="+typedisplay;
    
    xmlHttp.onreadystatechange=function() 
    { 
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
        { 
            document.getElementById("other_contact").innerHTML=xmlHttp.responseText;
        } 
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

/*** ajax function for twitter module ****/
function ajaxConversation(sendurl,qrytype,delid)
{
    if(qrytype == 'add')
    {
        convmsg = document.comv_message.post_conv.value;    
    }
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    if(qrytype == 'add')
    {
        var url = sendurl+"/convAjax.php";
        var replyId = document.comv_message.replyid.value;
        var returntype = document.comv_message.form_type.value;
        var params = "postConv="+convmsg+"&replyid="+replyId+"&reply_type="+returntype;

    }
    else
    {
        if(confirm("Are you sure you want to delete this record ?"))
        {   
            var url = sendurl+"/convAjax.php";
            if(qrytype == 'Updelete')
            {
                var params = "del_update="+delid;
            }
            else
            {
                var params = "del_conv="+delid;
            }
        }
    }   
    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            var mymsg = xmlHttp.responseText.split("!&CONV&!");
            if(qrytype == 'add' && convmsg != ' ')
            {
                document.getElementById('latest_conv').innerHTML=convmsg;
                document.getElementById('myCounter').innerHTML=140;
                document.comv_message.post_conv.value = '';
                document.getElementById("replyTitle").innerHTML= "Share with your friends !";
                document.getElementById("CancelVal").innerHTML= "";
                document.comv_message.replyid.value = "";
                document.comv_message.Share.value = "Share";
            }
            if(qrytype == 'delete')
            {
                document.getElementById('latest_conv').innerHTML=mymsg[1];
            }
            
            /** for only update delete return msg */
            if(qrytype == 'Updelete')
            {
                document.getElementById('LatestUpdates').innerHTML=mymsg[0];
                document.getElementById('TtlUpdate').innerHTML=mymsg[1];
            }
            /** for all return msg */
            else
            {
                document.getElementById('ttlupdates').innerHTML=mymsg[0];
                document.getElementById('UserAllConv').innerHTML=mymsg[2];
            }
        }
    }
    xmlHttp.send(params);
}


function chkpersonalfrm()
{
    var str = document.personalfrm.txt_address.value;
    var newstr = str.replace(/\n/g," ");
    result = newstr.split(" ");

    var loopcounter = 0;
    while(loopcounter < result.length)
    {
        if(result[loopcounter].length > 50)
        {
            alert('One of the word in Address you provided is too long.(The maximum word length is 50 characters).');
            document.personalfrm.txt_address.focus();
            return false;
        }
        loopcounter+=1;
    }

    var leapyear = '';
    if(document.personalfrm.sel_month.value == 2)
    {
        if(document.personalfrm.sel_year.value%100 == 0)
        {
            if(document.personalfrm.sel_year.value%400 == 0)
            {
                leapyear = 'true';
            }
            else
            {
                leapyear = 'false';
            }
        }
        else
        {
            if(document.personalfrm.sel_year.value%4 == 0)
            {
                leapyear = 'true';
            }
            else
            {
                leapyear = 'false';
            }
        }

        if(leapyear == 'true')
        {
            if(document.personalfrm.sel_day.value > 29)
            {
                alert('You cant select Date '+document.personalfrm.sel_day.value+' in this Month');
                return false;
            }
        }
        else
        {
            if(document.personalfrm.sel_day.value > 28)
            {
                alert('You cant select Date '+document.personalfrm.sel_day.value+' in this Month');
                return false;
            }
        }
    }
    else if(document.personalfrm.sel_month.value == 4 || document.personalfrm.sel_month.value == 6 || document.personalfrm.sel_month.value == 9 || document.personalfrm.sel_month.value == 11)
    {
        if(document.personalfrm.sel_day.value > 30)
        {
            alert('You cant select Date '+document.personalfrm.sel_day.value+' in this Month');
            return false;
        }
    }

    if(document.personalfrm.sel_day.value  != '00')
    {
        if(document.personalfrm.sel_month.value == '00' || document.personalfrm.sel_year.value == '0000')
        {
            alert('Please specify full Birthdate');
            document.personalfrm.sel_month.focus();
            return false;
        }
    }

    if(document.personalfrm.sel_month.value != '00')
    {
        if(cdocument.personalfrm.sel_year.value == '0000' || document.personalfrm.sel_day.value  == '00')
        {
            alert('Please specify full Birthdate');
            document.personalfrm.sel_day.focus();
            return false;
        }
    }

    if(document.personalfrm.sel_year.value != '0000')
    {
        if(document.personalfrm.sel_day.value == '00' || document.personalfrm.sel_month.value == '00')
        {
            alert('Please specify full Birthdate');
            document.personalfrm.sel_day.focus();
            return false;
        }
    }

    return true;
}


function displayCropping()
{
    if (xmlHttp.readyState==4)
    {
        document.getElementById("imgArea").style.display='';
        document.getElementById("imgArea").innerHTML=xmlHttp.responseText;
    }
}
function nodisplayCropping(imgArea)
{
    document.getElementById(imgArea).style.display='none';
}
function currentwork()
{
    if(document.experiencefrm.ch_currentry_working.checked == true)
    {
        document.getElementById('selectyear').style.display = 'none';
        document.getElementById('presentyear').style.display = '';
        document.experiencefrm.hid_present.value = 'yes';
    }
    else
    {
        document.getElementById('selectyear').style.display = '';
        document.getElementById('presentyear').style.display = 'none';
        document.experiencefrm.hid_present.value = 'no';
    }
}

function confirmProfileDelete(str)
{
    var s = confirm("Are you sure you want to delete this "+str+" ?");
    if (s == true)
    {
        return true;
    }
    else
    {
        return false;
    }
}

function charCount(elementid,divelement)
{
    var str = document.getElementById(elementid).value;
    var newstr = str.replace(/\n/g," ");
    result = newstr.split(" ");

    var loopcounter = 0;
    while(loopcounter < result.length)
    {
        if(result[loopcounter].length > 50)
        {
            var extra = result[loopcounter].length - 50;
            document.getElementById(divelement).innerHTML = 'You have exceeded the maximum word length of 50 by '+extra+' characters';
            document.getElementById(divelement).style.display = '';
            return false;
        }

        document.getElementById(divelement).style.display = 'none';
        loopcounter+=1;
    }
}

function chkexperiencefrm(current_month,current_year)
{
    if(document.experiencefrm.txt_company_name.value == '')
    {
        alert('Please specify the Company Name');
        document.experiencefrm.txt_company_name.focus();
        return false;
    }

    if(document.experiencefrm.txt_job_title.value == '')
    {
        alert('Please specify a Job Title');
        document.experiencefrm.txt_job_title.focus();
        return false;
    }

    if(document.experiencefrm.sel_start_month.value == '00')
    {
        alert('Please specify a Month for the Start Date.');
        document.experiencefrm.sel_start_month.focus();
        return false;
    }

    if(document.experiencefrm.txt_start_year.value == '' || document.experiencefrm.txt_start_year.value == 'year')
    {
        alert('Please specify a Year for the Start Date.');
        document.experiencefrm.txt_start_year.focus();
        return false;
    }

    if(document.experiencefrm.txt_start_year.value < 1900 || document.experiencefrm.txt_start_year.value > current_year)
    {
        alert('Please specify the Start Year between 1900 and '+current_year);
        document.experiencefrm.txt_start_year.focus();
        return false;
    }

    if(document.experiencefrm.txt_start_year.value == current_year)
    {
        if(document.experiencefrm.sel_start_month.value > current_month)
        {
            alert('Please specify a Date no later than this month.');
            document.experiencefrm.sel_start_month.focus();
            return false;
        }
    }

    if(!document.experiencefrm.ch_currentry_working || (document.experiencefrm.ch_currentry_working && document.experiencefrm.ch_currentry_working.checked == false))
    {
        if(document.experiencefrm.sel_end_month.value == '00')
        {
            alert('Please specify a Month for the End Date.');
            document.experiencefrm.sel_end_month.focus();
            return false;
        }

        if(document.experiencefrm.txt_end_year.value == '' || document.experiencefrm.txt_end_year.value == 'year')
        {
            alert('Please specify a Year for the End Date.');
            document.experiencefrm.txt_end_year.focus();
            return false;
        }

        if(document.experiencefrm.txt_end_year.value < 1900 || document.experiencefrm.txt_end_year.value > current_year)
        {
            alert('Please specify the End Year between 1900 and '+current_year);
            document.experiencefrm.txt_end_year.focus();
            return false;
        }

        if(document.experiencefrm.txt_end_year.value == current_year)
        {
            if(document.experiencefrm.sel_end_month.value > current_month)
            {
                alert('Please specify a Date no later than this month.');
                document.experiencefrm.sel_end_month.focus();
                return false;
            }
        }

        if(document.experiencefrm.txt_start_year.value > document.experiencefrm.txt_end_year.value)
        {
            alert('Please be sure the Start Date is not after the End Date.');
            document.experiencefrm.txt_end_year.focus();
            return false;
        }

        if(document.experiencefrm.txt_start_year.value == document.experiencefrm.txt_end_year.value)
        {
            if(document.experiencefrm.sel_start_month.value > document.experiencefrm.sel_end_month.value)
            {
                alert('Please be sure the Start Date is not after the End Date.');
                document.experiencefrm.sel_end_month.focus();
                return false;
            }

            if(document.experiencefrm.sel_start_month.value == document.experiencefrm.sel_end_month.value)
            {
                alert('Please be sure the Experience is not less than 1 month');
                document.experiencefrm.sel_end_month.focus();
                return false;
            }
        }
    }

    var str = document.experiencefrm.txt_job_description.value;
    var newstr = str.replace(/\n/g," ");
    result = newstr.split(" ");

    var loopcounter = 0;
    while(loopcounter < result.length)
    {
        if(result[loopcounter].length > 50)
        {
            alert('One of the word in Job Description you provided is too long.(The maximum word length is 50 characters).');
            document.experiencefrm.txt_job_description.focus();
            return false;
        }

        loopcounter+=1;
    }

    return true;
}

function isNumberKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    else
        return true;
}

function getText(txt_element)
{
    if(document.getElementById(txt_element).value == 'year')
    {
        document.getElementById(txt_element).value = '';
        document.getElementById(txt_element).style.color = "#000000";
    }
}

function putText(txt_element)
{
    if(document.getElementById(txt_element).value == '')
    {
        document.getElementById(txt_element).value = 'year';
        document.getElementById(txt_element).style.color = "#999999";
    }
}

function chkeducationfrm()
{
    if(document.educationfrm.txt_degree.value == '')
    {
        alert('Please specify a Degree');
        document.educationfrm.txt_degree.focus();
        return false;
    }

    if(document.educationfrm.sel_degree_start.value == '0000')
    {
        alert('Please specify the Degree starting year');
        document.educationfrm.sel_degree_start.focus();
        return false;
    }

    if(document.educationfrm.sel_degree_end.value == '0000')
    {
        alert('Please specify the Degree ending year');
        document.educationfrm.sel_degree_end.focus();
        return false;
    }

    if(document.educationfrm.sel_degree_start.value > document.educationfrm.sel_degree_end.value)
    {
        alert('Please be sure the start year is not after the end year.');
        document.educationfrm.sel_degree_end.focus();
        return false;
    }

    if(document.educationfrm.sel_university.value == 0)
    {
        if(document.educationfrm.unitotal.value > 0)
        {
            if(document.educationfrm.txt_university2.value == '')
            {
                alert('Please enter the name of the University/School you attended.');
                document.educationfrm.txt_university2.focus();
                return false;
            }
        }
        else
        {
            if(document.educationfrm.txt_university1.value == '')
            {
                alert('Please enter the name of the University/School you attended.');
                document.educationfrm.txt_university1.focus();
                return false;
            }
        }
    }

    var str = document.educationfrm.txt_additional_notes.value;
    var newstr = str.replace(/\n/g," ");
    result = newstr.split(" ");

    var loopcounter = 0;
    while(loopcounter < result.length)
    {
        if(result[loopcounter].length > 50)
        {
            alert('One of the word in Additional notes you provided is too long.(The maximum word length is 50 characters).');
            document.educationfrm.txt_additional_notes.focus();
            return false;
        }
        loopcounter+=1;
    }
    return true;
}

function chkbasicfrm()
{
    if(document.basicfrm.txt_first_name.value == '')
    {
        alert('Please specify First Name');
        document.basicfrm.txt_first_name.focus();
        return false;
    }

    if(document.basicfrm.txt_first_name.value.length > 20)
    {
        alert('Your First Name is too long. The maximum limit is 20 characters');
        document.basicfrm.txt_first_name.focus();
        return false;
    }

    if(document.basicfrm.txt_last_name.value.length > 20)
    {
        alert('Your Last Name is too long. The maximum limit is 20 characters');
        document.basicfrm.txt_last_name.focus();
        return false;
    }

    if(document.basicfrm.txt_nick_name)
    {
        if(document.basicfrm.txt_nick_name.value == '')
        {
            alert('Please specify Nick Name');
            document.basicfrm.txt_nick_name.focus();
            return false;
        }
        else if(document.basicfrm.txt_nick_name.value.length > 15)
        {
            alert('Your Nick Name is too long. The maximum limit is 15 characters');
            document.basicfrm.txt_nick_name.focus();
            return false;
        }
    }

    if(document.basicfrm.txt_profession.value == '')
    {
        alert('Please specify Profession');
        document.basicfrm.txt_profession.focus();
        return false;
    }

    return true;
}

function getDefaultUrl(txt_element)
{
    if(document.getElementById(txt_element).value == '(Ex: http://www.site.com)')
    {
        document.getElementById(txt_element).value = '';
        document.getElementById(txt_element).style.color = "#000000";
    }
}

function putDefaultUrl(txt_element)
{
    if(document.getElementById(txt_element).value == '')
    {
        document.getElementById(txt_element).value = '(Ex: http://www.site.com)';
        document.getElementById(txt_element).style.color = "#999999";
    }
}

function chkdisplayOthers(typeid)
{
    if(typeid == 'sel_website1_type')
    {
        if(document.additionalfrm.sel_website1_type.value == 'Other')
        {
            document.getElementById('other_type1').style.display = '';
        }
        else
        {
            document.getElementById('other_type1').style.display = 'none';
        }
    }
    else if(typeid == 'sel_website2_type')
    {
        if(document.additionalfrm.sel_website2_type.value == 'Other')
        {
            document.getElementById('other_type2').style.display = '';
        }
        else
        {
            document.getElementById('other_type2').style.display = 'none';
        }
    }
    else if(typeid == 'sel_website3_type')
    {
        if(document.additionalfrm.sel_website3_type.value == 'Other')
        {
            document.getElementById('other_type3').style.display = '';
        }
        else
        {
            document.getElementById('other_type3').style.display = 'none';
        }
    }
}

function chkadditionalfrm()
{
    if(document.additionalfrm.txt_website1.value == '(Ex: http://www.site.com)')
    {
        document.additionalfrm.txt_website1.value = '';
    }

    if(document.additionalfrm.txt_website2.value == '(Ex: http://www.site.com)')
    {
        document.additionalfrm.txt_website2.value = '';
    }

    if(document.additionalfrm.txt_website3.value == '(Ex: http://www.site.com)')
    {
        document.additionalfrm.txt_website3.value = '';
    }

    if(document.additionalfrm.txt_website1.value != '')
    {
        if(document.additionalfrm.sel_website1_type.value == '')
        {
            alert('Please specify a website type for '+document.additionalfrm.txt_website1.value);
            document.additionalfrm.sel_website1_type.focus();
            return false;
        }
    }

    if(document.additionalfrm.txt_website2.value != '')
    {
        if(document.additionalfrm.sel_website2_type.value == '')
        {
            alert('Please specify a website type for '+document.additionalfrm.txt_website2.value);
            document.additionalfrm.sel_website2_type.focus();
            return false;
        }
    }

    if(document.additionalfrm.txt_website3.value != '')
    {
        if(document.additionalfrm.sel_website3_type.value == '')
        {
            alert('Please specify a website type for '+document.additionalfrm.txt_website3.value);
            document.additionalfrm.sel_website3_type.focus();
            return false;
        }
    }

    if(document.additionalfrm.sel_website1_type.value == 'Other')
    {
        if(document.additionalfrm.other_type1.value == '')
        {
            alert('If you choose Other, please specify a Website title');
            document.additionalfrm.other_type1.focus();
            return false;
        }
    }

    if(document.additionalfrm.sel_website2_type.value == 'Other')
    {
        if(document.additionalfrm.other_type2.value == '')
        {
            alert('If you choose Other, please specify a Website title');
            document.additionalfrm.other_type2.focus();
            return false;
        }
    }

    if(document.additionalfrm.sel_website3_type.value == 'Other')
    {
        if(document.additionalfrm.other_type3.value == '')
        {
            alert('If you choose Other, please specify a Website title');
            document.additionalfrm.other_type3.focus();
            return false;
        }
    }

    var str1 = document.additionalfrm.txt_interests.value;
    var newstr1 = str1.replace(/\n/g," ");
    result1 = newstr1.split(" ");

    var loopcounter1 = 0;
    while(loopcounter1 < result1.length)
    {
        if(result1[loopcounter1].length > 50)
        {
            alert('One of the word in Intrests you provided is too long.(The maximum word length is 50 characters).');
            document.additionalfrm.txt_interests.focus();
            return false;
        }
        loopcounter1+=1;
    }

    var str2 = document.additionalfrm.txt_honors_awards.value;
    var newstr2 = str2.replace(/\n/g," ");
    result2 = newstr2.split(" ");

    var loopcounter2 = 0;
    while(loopcounter2 < result2.length)
    {
        if(result2[loopcounter2].length > 50)
        {
            alert('One of the word in Honors and Awards you provided is too long.(The maximum word length is 50 characters).');
            document.additionalfrm.txt_honors_awards.focus();
            return false;
        }
        loopcounter2+=1;
    }

    return true;
}


function getVcardInfo(userId,siteUrl)
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    }
    var url=siteUrl+"/vCardInfo.php";
    url=url+"?userId="+userId;

    xmlHttp.onreadystatechange=showVcardInfo;

    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function showVcardInfo()
{
    if (xmlHttp.readyState == '4')
    {
        document.getElementById("vCardInfo").innerHTML=xmlHttp.responseText;
    }
}

function getUniversity(country_id,siteUrl)
{
    if(country_id != 0)
    {
        xmlHttp=GetXmlHttpObject();
        if (xmlHttp==null)
        {
            alert ("Your browser does not support AJAX!");
            return;
        }
        var url=siteUrl+"/universityList.php";
        var params = "country_id="+country_id;
        
        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.onreadystatechange=countryChanged;
    
        xmlHttp.send(params);
    }
    else
    {
        document.getElementById("UniCaption").style.display='none';
        document.getElementById("UniName").style.display='none';
    }
}

function countryChanged()
{
    if (xmlHttp.readyState == '4')
    {
        document.getElementById("UniCaption").innerHTML="University / School: ";
        document.getElementById("UniName").innerHTML=xmlHttp.responseText;
    }
}

function otherUniversity(universityVal)
{
    if(universityVal == 0)
    {
        document.getElementById("otherSchool").style.display = '';
    }
    else
    {
        document.getElementById("otherSchool").style.display = 'none';
    }
}

function check_inviteFromBrick()
{
    if(document.frmSearch.search.value == '')
    {
        document.frmSearch.search.focus();
        alert('Enter Name for Search');
        return false;
    }
    return true;
}
function check_inviteByEmail()
{
    if(document.frmAddresses.addresses.value == '')
    {
        document.frmAddresses.addresses.focus();
        alert('Please Enter Email Address');
        return false;
    }
    return true;
}

function replyvalue(textval)
{
    document.comv_message.post_conv.style.color = "#999";
    document.comv_message.post_conv.value = "reply here .... ";
    document.getElementById("replyTitle").innerHTML= "Reply to "+textval+":";
    document.comv_message.replyid.value = textval;
    document.getElementById("CancelVal").innerHTML= " or <a href='javascript:void(0);' onclick='canclereply();'>cancel</a>";
    document.comv_message.Share.value = "Reply";
    window.scrollTo(0,0);
}

function canclereply()
{
    document.getElementById("replyTitle").innerHTML= "Share with your friends !";
    document.getElementById("CancelVal").innerHTML= "";
    document.comv_message.replyid.value = "";
    document.comv_message.post_conv.value = "";
    document.getElementById("myCounter").innerHTML= "140";
    document.comv_message.Share.value = "Share";
    document.comv_message.post_conv.focus();    
}
function replyFromOther()
{
    document.conv_home.submit();
}
/* for Openinviter */
function toggleAll(element) 
{
    var form = document.forms.openinviter;
    var z = 0;
    for(z=0; z<form.length; z++)
    {
    if(form[z].type == 'checkbox')
        form[z].checked = element.checked;
    }
}

function displayList(opr,providerType)
{
    if(opr == 'show')
        document.getElementById('pList').style.display = '';
    else
        document.getElementById('pList').style.display = 'none';

    if(providerType == 'others')
        document.getElementById("providerType").innerHTML= "";
    else
        document.getElementById("providerType").innerHTML= "<input type='hidden' name='provider_box' value='"+providerType+"'/>";
}

function composeMessage(display)
{
    if(display == 'no')
        document.getElementById('compose_msg').style.display = 'none';
    else
        document.getElementById('compose_msg').style.display = '';
}

function mailAjax(sendurl)
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    var url = sendurl+"/mailAjax.php";
    var fwEmail = document.sendMail.forward_email.value;
    var params = "fwEmail="+fwEmail;

    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.responseText == 'NOT')
            {
                document.getElementById("not_send").innerHTML="You don't have any connection so you can't send any message.";
                document.sendMail.forward_email.value = "";
            }
            else
            {
                document.getElementById("forward_email").innerHTML=xmlHttp.responseText;
            }
        }
    }
    xmlHttp.send(params);
}

function jobAlert(alerttype)
{
    if(alerttype == 'show')
    {
        document.getElementById('jobAlert2').style.display = '';
        document.getElementById('jobAlert1').style.display = 'none';
    }
    else
    {
        document.getElementById('jobAlert2').style.display = 'none';
        document.getElementById('jobAlert1').style.display = '';
    }
}

function jobAlertAjax(sendurl)
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    document.getElementById('ajaxLoadImg').className="fl loader_img";

    var url = sendurl+"/jobAlerts.php";
    var altEmail = document.jobAlertfrm.alert_email.value;
    var idCity = document.jobAlertfrm.id_city.value;
    var Cityname = document.jobAlertfrm.city_name.value;
    var idCategory = document.jobAlertfrm.id_category.value;
    var idKeyword = document.jobAlertfrm.id_keyword.value;
    var searchText = document.jobAlertfrm.search_keyword.value;    
    var idState = document.jobAlertfrm.id_state.value;    

    var params = "alertEmail="+altEmail+"&idCity="+idCity+"&Cityname="+Cityname+"&idCategory="+idCategory+"&idKeyword="+idKeyword+"&searchText="+searchText+"&idState="+idState;
    
    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.responseText == 'done')
            {
                document.getElementById('alert_detail').style.display = 'none';
                document.getElementById('alt_status').innerHTML='<span class="black"><b>Please check your email</b> - we have sent a confirmation message. <br/>Click on the link in this email to start receiving your job alerts.</span>';
            }
            else
            {
                document.getElementById('ajaxLoadImg').className="fl";
                document.getElementById('alt_status').innerHTML=xmlHttp.responseText;
            }
        }
    }
    xmlHttp.send(params);
}
function public_profile_currnet_position(chid,imgid)
{
    if(document.frmPublicProfile.currnet_position.checked)
    {
        document.frmPublicProfile.currnet_position_detail.checked = true;
        ShowImage(chid,'pic_work_experience1');
    }
    ShowImage(chid,imgid);
}

function public_profile_past_position(chid,imgid)
{
    if(document.frmPublicProfile.past_position.checked)
    {
        document.frmPublicProfile.past_position_detail.checked = true;
        ShowImage(chid,'pic_work_experience2');
    }
    ShowImage(chid,imgid);
}

function public_profile_education(chid,imgid)
{
    if(document.frmPublicProfile.education.checked)
    {
        document.frmPublicProfile.education_detail.checked = true;
        ShowImage(chid,'pic_education_qualification');
    }
    ShowImage(chid,imgid);
}

function ShowImage(chid,imgid)
{
    var chBox = "document.frmPublicProfile."+chid+".checked";
    if(eval(chBox))
        eval("document.getElementById('"+imgid+"').style.display = 'block';");
    else
        eval("document.getElementById('"+imgid+"').style.display = 'none';");

    if(imgid == 'pic_websites' && eval(chBox) && chid == 'websites')
        document.getElementById('pic_additional_Information_websites').style.display = 'block';
    if(imgid == 'pic_websites' && !eval(chBox) && chid == 'websites')
        document.getElementById('pic_additional_Information_websites').style.display = 'none';
}

function choosePassword(choosepass)
{
    if(choosepass.reg_pass.value == '')
    {
        alert('Please Enter Password');
        choosepass.reg_pass.focus();
        return false;
    }
 
    else if(choosepass.reg_pass.value.length < 6)
    {
        alert('Password must be at least 6 characters');
        choosepass.reg_pass.focus();
        return false;
    }
   
    if(choosepass.reg_conf_pass.value == '')
    {
        alert('Please Enter Confirm Password');
        choosepass.reg_conf_pass.focus();
        return false;
    }      

    else if(choosepass.reg_conf_pass.value.length < 6)
    {
        alert('Password must be at least 6 characters');
        choosepass.reg_conf_pass.focus();
        return false;
    }

    if(choosepass.reg_pass.value != choosepass.reg_conf_pass.value)
    {
        alert('Your confirm password does not match');
        choosepass.reg_conf_pass.focus();
        return false;
    }

    return true;
}
function chkAllwatchedAd()
{
    var tot = document.getElementById('chAll').value;
    for(var i=0;i<tot;i++)
    {
        ch = 'ch'+i;
        if(document.getElementById('chAll').checked)
            document.getElementById(ch).checked = true;
        else
            document.getElementById(ch).checked = false;
    }
}
/** for watchList */
function deletecheck()
{
    var tot = document.getElementById('chAll').value;
    var flag = false;
    var cnf;
    for(var i=0;i<tot;i++)
    {
        ch = 'ch'+i;
        if(document.getElementById(ch).checked)
            flag = true;
    }
    if(flag)
    {
        cnf = confirm('Are you sure to delete Ads from Watch List !!!');
        if(cnf)
            return true;
        else
            return false;
    }
    else
    {
        alert('Please select at least One Ad to delete');
        return false;
    }
}

function alertMultipleCity(cityId,stateName)
{
    document.eidtAler.city_id.value=cityId;
    document.getElementById('state_name').innerHTML='(state : '+stateName+')';
}

function invitationShow()
{
  document.getElementById('invitation_detail').style.display='';
  document.getElementById('invitation_short').style.display='none';  
}

function invitationHide()
{
  document.getElementById('invitation_detail').style.display='none';
  document.getElementById('invitation_short').style.display='';  
}

function chkAllMsg()
{
    var tot = document.getElementById('chk_all').value;
    for(var i=0;i<tot;i++)
    {
        ch = 'msg_'+i;
        if(document.getElementById('chk_all').checked)
            document.getElementById(ch).checked = true;
        else
            document.getElementById(ch).checked = false;
    }
}

function addConvComment(sendurl,id,comment,comntmsg,showbox)
{
    var cmnt = document.getElementById(comment).value;
    if(cmnt == '')
    {
        document.getElementById(showbox).style.display='';
        eval("document.frmConv."+comment+".focus();");
        alert('Please Give Your Comment');
        return false;
    }

    if(cmnt != '')
    {
        var xmlHttp;
        try
        {
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }    

        pageno = document.comv_message.pageno.value;
        var url = sendurl+"/ajaxConv.php";
        var params = "msgid="+id+"&cmt="+cmnt+"&page="+pageno;
        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.onreadystatechange=function()
        {
            if(xmlHttp.readyState==4)
            {
                document.getElementById('allConv').innerHTML=xmlHttp.responseText;
                document.getElementById(comntmsg).innerHTML='Comment Successfully Added';
            }
        }
        xmlHttp.send(params);
    }
}
function addMessage(sendurl,lim)
{   
    var cnv = document.getElementById('post_conv').value;
    if(cnv == "What's on your mind? What you have achieved recently?")
    {
        document.comv_message.post_conv.focus();
        alert('Please Give Your Message');
        return false;
    }
    else if(cnv != '')
    {
        var xmlHttp;
        try
        {
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }    
        //pageno = document.comv_message.pageno.value;
        var url = sendurl+"/ajaxConv.php";
        var params = "newconv="+cnv+"&convlim="+lim+"&page=1";
        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.onreadystatechange=function()
        {
            if(xmlHttp.readyState==4)
            {
                document.getElementById('divconvlist').innerHTML=xmlHttp.responseText;
                document.getElementById('post_conv').value="";
                document.getElementById('latestmsg').innerHTML = document.getElementById('divlatest').innerHTML;
            }
        }
        xmlHttp.send(params);
    }
    else
    {   
        document.comv_message.post_conv.focus();
        alert('Please enter your Message.');
        return false;
    }
}

function delConvComment(sendurl,commentid,conv,comntmsg)
{   
    if(confirm('Are you sure to delete this Comment ?'))
    {
        var xmlHttp;
        try
        {
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }    

        pageno = document.comv_message.pageno.value;

        var url = sendurl+"/ajaxConv.php";
        var params = "convid="+conv+"&delid="+commentid+"&action=del&page="+pageno;
        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.onreadystatechange=function()
        {
            if(xmlHttp.readyState==4)
            {
                //document.getElementById(dest).innerHTML=xmlHttp.responseText;
                document.getElementById('allConv').innerHTML=xmlHttp.responseText;
                document.getElementById(comntmsg).innerHTML='Comment Successfully Deleted';
            }
        }
        xmlHttp.send(params);
    }
}
function viewAllComments(divids,show,hide)
{   
    var ids = document.getElementById(divids).innerHTML;
    var hiddendivs = ids.split(",");
    for(var i=0;i<(hiddendivs.length);i++)
    {
        var showdivs='divcommentlist'+hiddendivs[i];
        document.getElementById(showdivs).style.display='';
    }
    
    document.getElementById(hide).style.display='';
    document.getElementById(show).style.display='none';
    
}

function hidecomments(divids,show,hide)
{
    var ids = document.getElementById(divids).innerHTML;
    var hiddendivs = ids.split(",");
    for(var i=0;i<(hiddendivs.length);i++)
    {
        var showdivs='divcommentlist'+hiddendivs[i];
        document.getElementById(showdivs).style.display='none';
    }
    document.getElementById(hide).style.display='none';
    document.getElementById(show).style.display='';
}

function showhide(show,active,showbox)
{
    var totbx = document.getElementById('totbox').innerHTML;
    
    for(var i=0;i<totbx;i++)
    {
        document.getElementById('show'+i).style.display='none';
    }
    document.getElementById('show'+showbox).style.display='';
    eval("document.frmConv."+active+".focus();");
}

function cancelcomment(show)
{
    document.getElementById(show).style.display='none';
}

function showfullcomment(showid,hideid)
{
    document.getElementById(showid).style.display='';
    document.getElementById(hideid).style.display='none';
}

function blankCheckConv()
{
    if(document.comv_message.post_conv.value == "What's on your mind? What you have achieved recently?")
    {
        document.comv_message.post_conv.focus();
        alert('Please Give Your Message');    
        return false;
    }
    else if(document.comv_message.post_conv.value == '')
    {
        document.comv_message.post_conv.focus();
        alert('Please Give Your Message');    
        return false;
    }
    else
        return true;
}

function blankString(clsnm)
{
    var newcls = "textbox1 conv_gray1 "+clsnm;
    var str = document.comv_message.post_conv.value;
    if(str == '')
    {
        document.comv_message.post_conv.className=newcls;
        document.comv_message.post_conv.value="What's on your mind? What you have achieved recently?";
    }
    else
        document.comv_message.post_conv.className="textbox1 "+clsnm;
}

function hideCommentbox(hideID,txtComment)
{
    if(document.getElementById(txtComment).value == '')
    {
        document.getElementById(hideID).style.display='none';
    }
    else
    {
        document.getElementById(hideID).style.display='';
    }
}

function checkContactUs()
{
    if(document.contactus.feedback_msg.value == '')
    {
        alert('Please enter a description of your concern in the textbox.')
        document.contactus.feedback_msg.focus();
        return false;
    }

    if(document.contactus.fbemail.value != '')
    {
        if(!(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(document.contactus.fbemail.value)))
        {
            alert(' Invalid Email Address.. Please Re-enter it ');
            document.contactus.fbemail.focus();
            return false;
        }
    }
    return true;
}

function contactTab(showcontact,hidecontact)
{
    document.getElementById(showcontact).style.display = '';
    document.getElementById(hidecontact).style.display = 'none';      
}

function signinBox(displayVal)
{
    if(displayVal == 'Y')
    {
        document.getElementById('signInBox').style.display = '';
    }
    else
    {
        document.getElementById('signInBox').style.display = 'none';
    }
}

function ajaxSignin()
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    var url = "/ajaxSignin.php";
    var sEmail = document.Singin.email.value;
    var sPassword = document.Singin.spassword.value;
    var params = "email_id="+sEmail+"&password="+sPassword;

    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.responseText == 'done')
            {
                window.location.reload();
                var openUrl=document.Singin.url_open.value;
                window.open(openUrl);
            }
            else
            {
                document.getElementById('returnMsgSign').innerHTML=xmlHttp.responseText;
            }
        }
    }
    xmlHttp.send(params);
}

function ajaxRegister()
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    var url = "/ajaxRegister.php";
    var rFirstName=document.registerfrm.firstname.value;
    var rLastName=document.registerfrm.lastname.value;
    var rNickName=document.registerfrm.nickname.value;
    var rjobTtl=document.registerfrm.job_title.value;
    var rCountry=document.registerfrm.country.value;
    var rIndustry=document.registerfrm.industrytype.value;
    var rEmail=document.registerfrm.useremail.value;
    var rPassword=document.registerfrm.userpassword.value;
    var rVerify=document.registerfrm.register_security_code.value;
    var params = "fname="+rFirstName+"&lname="+rLastName+"&nickname="+rNickName+"&jobttl="+rjobTtl+"&country="+rCountry+"&industry="+rIndustry+"&email="+rEmail+"&pass="+rPassword+"&imgcode="+rVerify;

    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.responseText == 'done')
            {
                window.location='/userhome.html';
                var openUrl=document.registerfrm.url_open.value;
                window.open(openUrl);
            }
            else
            {
                document.getElementById('returnMsg').innerHTML=xmlHttp.responseText;
            }
        }
    }
    xmlHttp.send(params);
}


function cityShowHide(displayType)
{
    if(displayType == 'Y')
    {
        document.getElementById('parent_city').style.display='';
    }
    else
    {
        document.getElementById('parent_city').style.display='none';
    }    

    document.getElementById('rssURL').style.display='';
    document.getElementById('buttonDis').colSpan=3;    
}

function parentCity()
{
    document.getElementById('parent_city').style.display='none';
    document.getElementById('rssURL').style.display='none';
    document.getElementById('buttonDis').colSpan=2;    
}


function sendLinktoFriend()
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    
    var from_email=document.linkmail.from_email.value;
    var to_email=document.linkmail.to_email.value;
    var mail_msg=document.linkmail.mail_msg.value;
    var frd_subject=document.linkmail.frd_subject.value;
    var url = "/ajaxSendLinkToFriend.php";
    var params = "from_email="+from_email+"&to_email="+to_email+"&mail_msg="+mail_msg+"&send_from=jl&frd_subject="+frd_subject;

    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.responseText != 'send')
            {
                document.getElementById('frdResult').innerHTML=xmlHttp.responseText;
            }
            else
            {
                document.getElementById('sendLinkShow').style.display='none';
                document.getElementById('sendLinkHide').style.display='';
                document.getElementById('sendLinkHide').innerHTML="Your email to <b>"+to_email+"</b> has been sent! <a href='javascript:void(0);' onclick='showHideSendLink();'>Send another email</a>";
            }
        }
    }
    xmlHttp.send(params);
}

function showHideSendLink()
{
    document.getElementById('frdResult').innerHTML = '';
    document.linkmail.from_email.value = '';
    document.linkmail.to_email.value = '';
    document.linkmail.mail_msg.value = '';    
    document.getElementById('sendLinkShow').style.display='';
    document.getElementById('sendLinkHide').style.display='none';
    
}

function sendLinkMsg(siteurl)
{
    if(document.getElementById('frdMsg').style.display == 'none')
    {
        document.getElementById('arrowImg').innerHTML="<img src='"+siteurl+"/down_arrow_small.gif' align='' />";   
        document.getElementById('frdMsg').style.display='';   
    }
    else
    {   
        document.getElementById('arrowImg').innerHTML="<img src='"+siteurl+"/arrow_small.gif' align='' />";   
        document.getElementById('frdMsg').style.display='none';   
    }    
}


function ajaxKeywordList(catId)
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    var url = "/administrator/addKeywords.php";
    var params = "catID="+catId;

    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.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            document.getElementById('parentKeyword').innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.send(params);
}

function automCompleteOff()
{
    document.SearchFrm.l.setAttribute("autocomplete", "off");
}