
/**
 * First open the respective tab
 * @param to_open profile.php
 */
var Email_sent =0;
switch(to_open){
    case "favorites": favorites(document.getElementById("favorites-a"), friend_id);
        break;
    case "justshared": justShared(document.getElementById("just-shared-a"), friend_id);
        break;
    case "comments": userComments(document.getElementById("comments-a"), friend_id);
        break;
    case "friends": friends(document.getElementById("friends-a"), friend_id);
        break;
    case "messages": messages(document.getElementById("messages-a"), friend_id);
        break;
    case "addalink": if(!friend_id)
        addALink(document.getElementById("add-a-link-a"));
    else
        favorites(document.getElementById("favorites-a"), friend_id);
    break;
    case "fullprofile": openProfileWindow('fullProfile', friend_id);
        favorites(document.getElementById("favorites-a"), friend_id);
        break;
    case "exit": break;
    default: favorites(document.getElementById("favorites-a"), friend_id);
        break;
}

	
/**
 * To activate the clicked tab
 * @param Object obj Clickd tab
 */
function changeActiveTab(obj)
{
    var ul_obj		= document.getElementById("accountnav");
    var li_array	= ul_obj.childNodes;
    for(var i = 0; i < li_array.length; i++)
    {
        // get the child nodes of the li
        var lichildren = li_array.item(i).childNodes;
			
        // Iterate through the child nodes of the li
        for( var j = 0; j < lichildren.length; j++ )
            //if(lichildren[j].name == "tabanc")
            lichildren[0].className = "";
			
    }
		
    obj.className	= "here";
    return true;
}

/**
 * To make AJAX request with url
 */
function loadlTabByAjaxCall(url, start, limit, friend_id, load_div)
{
    //Fill the div with relevant info
    var params = '';
		
    if(limit != '')
        params = 'start='+start+'&limit='+limit;
		
    if(friend_id)
        url = url + '/' + friend_id;

    var xmlh		= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        url,
        params,
        function(){
	
            if(xmlh.readyState < 4)
                document.getElementById(load_div).innerHTML = "<img src="+templateURL+"images/loader.gif /> loading ...<br /><br />";
	
            if(xmlh.readyState == 4)
                document.getElementById(load_div).innerHTML = xmlh.responseText;
        });
}

/**
 * To get the just shared links
 * @param Object obj Just shared anchor
 */
function justShared(obj, friend_id)
{
    //Change the tab style
    changeActiveTab(obj);
		
    //Fill the div with just shared links
    var start = 0;
    var limit = 10;
    loadlTabByAjaxCall(siteURL + 'user/justShared', start, limit, friend_id, "account-data");
		
}

/**
 * To get the favorite links
 * @param Object obj favorites anchor
 */
function favorites(obj, friend_id)
{
    //Change the tab style
    changeActiveTab(obj);

    //Fill the div with favorite links by making ajax call
    var start = 0;
    var limit = 10;
    loadlTabByAjaxCall(siteURL + 'user/favorites', start, limit, friend_id, "account-data");
		
}

/**
 * To get the friends of user
 * @param Object obj friends anchor
 */
function friends(obj, friend_id)
{
    //Change the tab style
    changeActiveTab(obj);

    //Fill the div with friends by making ajax call
    var start = 0;
    var limit = 10;
    var url 		= siteURL + 'connection/friends';
    var load_div 	= "account-data";
    //Fill the div with relevant info
    var params 		= '';
		
    if(limit != '')
        params = 'start='+start+'&limit='+limit;
		
    if(friend_id)
        url = url + '/' + friend_id;

    var xmlh		= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        url,
        params,
        function(){
	
            if(xmlh.readyState < 4)
                document.getElementById(load_div).innerHTML = "<img src="+templateURL+"images/loader.gif /> loading ...<br /><br />";
	
            if(xmlh.readyState == 4)
            {
                document.getElementById(load_div).innerHTML = xmlh.responseText;
                var xmlh2		= GetXmlHttpObject();
                var response	= SendPostRequest(xmlh2,
                    siteURL + "contact/grabContacts",
                    "step=initial"+"&friends_invite=on",
                    function(){
                        //if(xmlh2.readyState < 4)
                        //grab_div.innerHTML = "<img src="+templateURL+"images/loader.gif /> loading ...<br /><br />";

                        if(xmlh2.readyState == 4)
                        {
                            var grab_div    = document.getElementById('grab-content')
                            grab_div.innerHTML = xmlh2.responseText;
                            if(Email_sent == 1)
                             document.getElementById("display_message").innerHTML = "<b style='color:red;'>You have successfully sent invitation.</b>";
                        }
	                                                                                                      
                    });
            }
        });
}
		

/**
 * To get the bookmarks of user
 * @param Object obj friends anchor
 */
function addALink(obj)
{
    //Change the tab style
    changeActiveTab(obj);

    //Fill the div with friends by making ajax call
    var start = 0;
    var limit = 10;
    loadlTabByAjaxCall(siteURL + 'user/addALink', start, limit, 0, "account-data");
		
}


/**
 *	To set the bookmark
 */
function setBookmark()
{
    var url		= document.getElementById("add-url").value;
    var tags	= document.getElementById("add-tag").value;
    var desc	= document.getElementById("add-desc").value;
    var title   = document.getElementById("add-title").value;
    if(document.getElementById('parent-category-name'))
        var parent_category_name=document.getElementById('parent-category-name').value;
    else
        var parent_category_name='';
    if(document.getElementById('selected-category-div'))
        var category_name=document.getElementById('selected-category-div').innerHTML;
    
    var suggested_tags_list=document.getElementById("suggested-tags-list").value;
    var category= '';
    var makepublic=document.getElementById("make-as-public");
    var makeaspublic;
    if(makepublic.checked==true)
        makeaspublic='yes';
    else
        makeaspublic='no';
    if(document.getElementById("categories-select"))
        category= document.getElementById("categories-select").value;
    var url=document.getElementById("add-url").value;
    if(!verifyUrl(url))

    {
        document.getElementById("add-err").className="red bold";document.getElementById("add-err").innerHTML="Enter some Link";
    }
    else if(title=='')
    {
        document.getElementById("add-err").className="red bold";document.getElementById("add-err").innerHTML="Enter Title";
        document.getElementById("add-title").focus();
    }
    else if(category_name=='')
    {
        document.getElementById("add-err").innerHTML="Select Category";document.getElementById("add-err").className="red bold";
    }
    else if(title && tags && desc)
    {
        //Fill the div with relevant info
        xmlh			= GetXmlHttpObject();
        var response	= SendPostRequest(xmlh,
            siteURL + "ajax/bookmark/saveBookmark",
            "url="+encodeURIComponent(url)+"&comment="+desc+"&tag="+tags+"&category="+category+"&parent_category_name="+parent_category_name+"&category_name="+category_name+"&title="+title+"&makeaspublic="+makeaspublic+"&suggested_tags_list="+suggested_tags_list,
            function(){
                if(xmlh.readyState<4)
                {
                    if(document.getElementById('add-url-submit-div'))
                    {
                        var submit_button_div=document.getElementById('add-url-submit-div');
                        submit_button_div.innerHTML="<img src='"+GLOBAL_TEMPLATE_URL+"images/loader.gif' /> Adding...";
                        document.getElementById('verify-tags-desc-div').innerHTML='';
                    }
                }
                if(xmlh.readyState == 4)
                {
                    var res = xmlh.responseText;
                    document.getElementById("add-url").value = "";
                    document.getElementById("tag-desc-div").className = "no-display";

                    addALink(document.getElementById("add-a-link-a"));
                }
            });
    }
    else
        alert("Tags & Desc needed")
}

/*
 * To show the comments of user
 */
function userComments(obj, friend_id)
{
    //Change the tab style
    changeActiveTab(obj);

    //Fill the div with favorite links by making ajax call
    var start = 0;
    var limit = 10;
    loadlTabByAjaxCall(siteURL + 'user/userComments', start, limit, friend_id, "account-data");
}

/*
 * To show the comments of user
 */
function messages(obj, friend_id)
{
    //Change the tab style
    changeActiveTab(obj);

    //Fill the div with msgs by making ajax call
    var start = 0;
    var limit = 10;
    loadlTabByAjaxCall(siteURL + 'user/messages', start, limit, friend_id, "account-data");
}

/*
 * To send the message
 */
function sendMessage(ta_id, to_user_id, reply_of)
{
    var message = document.getElementById(ta_id).value;
    document.getElementById(ta_id).value = "";
    if(message)
    {
        //Fill the div with relevant info
        xmlh			= GetXmlHttpObject();
        var response	= SendPostRequest(xmlh,
            siteURL + "user/saveMessage",
            "friend_id="+to_user_id+"&message="+message+"&reply_of="+reply_of,
            function(){
												
                if(xmlh.readyState == 4)
                {
                    var res = xmlh.responseText;
                    if(reply_of) to_user_id = 0;
                    messages(document.getElementById("messages-a"), to_user_id)
                }
            });
    }
    else
        alert("Message needed")
}

function reply(user_message_id)
{
    document.getElementById('conv-msg-'+user_message_id).className = "no-display";
    var reply_div = document.getElementById('reply-msg-'+user_message_id);
    reply_div.className = "";
}

/**
 * To delete message
 */
function deleteMessage(user_message_id)
{		
    //Fill the div with relevant info
    xmlh			= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        siteURL + "user/deleteMessage",
        "user_message_id=" + user_message_id,
        function(){
            if(xmlh.readyState < 4)
                document.getElementById("msg-" + user_message_id).innerHTML = "<img src="+templateURL+"images/loader.gif /> deleting ...<br /><br />";
            if(xmlh.readyState == 4)
            {
                var res = xmlh.responseText;
                messages(document.getElementById("messages-a"), 0)
            }
        });
}

function conversation(user_message_id)
{
    document.getElementById('reply-msg-'+user_message_id).className = "no-display";
    //Fill the div with relevant info
    xmlh			= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        siteURL + "user/conversationMessage",
        "user_message_id=" + user_message_id,
        function(){
											
            document.getElementById("conv-msg-" + user_message_id).className = '';
            if(xmlh.readyState < 4)
                document.getElementById("conv-cont-" + user_message_id).innerHTML = "<img src="+templateURL+"images/loader.gif /> loading ...<br /><br />";
            if(xmlh.readyState == 4)
            {
                var conv = eval( '(' + xmlh.responseText + ')' );
                var conv_len = conv.length;
                var conv_cont = "";
                for(var i = 0; i < conv_len; i++)
                {
                    var msg		= conv[i]['message'];
                    msg			= msg.replace(/\n/g, "<br />");
                    conv_cont	= conv_cont + "<div style='margin-bottom:1px;background-color:silver;padding:10px;'><div><a href='{{}}user/profile/"+conv[i]['user_id']+"'>"+conv[i]['display_name']+"</a>:</div><div>"+msg+"</div></div>";
                }
                document.getElementById("conv-cont-" + user_message_id).innerHTML = conv_cont;
            }
											
        });
}

/**
 * To showup the full/edit profile
 */
function openProfileWindow(act, friend_id)
{
    var f_div = document.getElementById('full-profile');
		
    f_div.className = 'fullprofile';
    loadlTabByAjaxCall(siteURL + 'user/' + act, '', '', friend_id, 'full-profile');
}

/**
 * To close the full profile
 */
function closeProfileWindow()
{	
    var f_div = document.getElementById('full-profile');
    if(f_div.className == 'fullprofile')
        f_div.className = 'no-display';
}

function updateProfile()
{
    var ay		= document.editForm.aboutYou.value;
    var mi		= document.editForm.myInterests.value;
    var tih		= document.editForm.thingsIHate.value;
    var rs		= document.editForm.relationshipStatus.options[document.editForm.relationshipStatus.selectedIndex].value;
    var lis		= document.editForm.languageISpeak.value;
    var bil		= document.editForm.booksILove.value;
    var mil		= document.editForm.moviesILike.value;
    var ii		= document.editForm.imId.value;
    var p		= document.editForm.phone.value;
    var a		= document.editForm.address.value;
    var o		= document.editForm.occupation.value;
    var ind		= document.editForm.industry.value;
    var co		= document.editForm.company.value;
    var c		= document.editForm.college.value;
    var d		= document.editForm.degree.value;
    var hs		= document.editForm.highSchool.value;
    var oc		= document.editForm.otherCourses.value;

    //Fill the div with relevant info
    xmlh			= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        siteURL + "user/updateProfile",
        "aboutYou="+ay+"&myInterests="+mi+"&thingsIHate="+tih+"&relationshipStatus="+rs+"&languageISpeak="+lis+"&booksILove="+bil+"&moviesILike="+mil+"&imId="+ii+"&phone="+p+"&address="+a+"&occupation="+o+"&industry="+ind+"&company="+co+"&college="+c+"&degree="+d+"&highSchool="+hs+"&otherCourses="+oc,
        function(){
												
            var f_div = document.getElementById('full-profile-detail')
            if(xmlh.readyState < 4)
                f_div.innerHTML = "<img src="+templateURL+"images/loader.gif /> saving ...<br /><br />"
												
            if(xmlh.readyState == 4)
																								
                document.getElementById('full-profile').className = 'no-display';
												
        });
		
}

/**
* To change the prefernces 
*/
function openPreferencesWindow()
{
    var f_div = document.getElementById('full-profile');
		
    f_div.className = 'fullprofile';
    loadlTabByAjaxCall(siteURL + 'user/getPreferences', '', '', '', 'full-profile');
}
/**
*To change the password
*/
function openChangePasswordWindow()
{
    var f_div = document.getElementById('full-profile');

    f_div.className = 'fullprofile';
    loadlTabByAjaxCall(siteURL + 'user/changePassword', '', '', '', 'full-profile');
}

function passwordValidation(password)
{    

    if(password != "")
    {
        removeError('pwd-err');
        removeError('pwd-err2');
        document.getElementById('pwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/checkbullet.gif></img>";



        var pwdfilter = /^([a-zA-Z0-9!@#$%^&amp;*()_+~`]{6,15})$/i
        var returnchk = pwdfilter.test(document.changePassword.password.value);
        if (returnchk == false)
        {
            document.getElementById('pwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/wrong.GIF></img>";
            document.getElementById('pwd-err').innerHTML = 'Enter a password of length 6-20.';
        
            return ;
        }
    }
    else
    {
        removeError('pwd-err');
        removeError('pwd-err2');
        document.getElementById('pwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/ex_mark.gif></img>";
        document.getElementById('pwd-err').innerHTML = 'This information is required.';

        return ;

    }
}

function repassValidation(repassword)
{
    if((repassword != "") && (document.changePassword.retypepassword.value == document.changePassword.password.value))
    {
        removeError('repwd-err2');
        removeError('repwd-err');
        document.getElementById('repwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/checkbullet.gif></img>";
        return ;
    }
    else
    {

        document.getElementById('repwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/wrong.GIF></img>";
        document.getElementById('repwd-err').innerHTML = 'Please verify your password .';
        return ;
    }

}
function clearOldPasswordErrorField()
{
    if(document.getElementById('oldpwd-err2')&&document.getElementById('oldpwd-err'))
    {
        if(document.getElementById('old_password').value!='')
        {
            removeError('oldpwd-err');
            removeError('oldpwd-err2');
        //document.getElementById('oldpwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/checkbullet.gif></img>";
        }
    }
}
/*****************************************************************************
* Functions relating Password Strength
******************************************************************************/

function passwordChanged()
{
    //var strength = document.getElementById('password_text');
    var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
    var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
    var enoughRegex = new RegExp("(?=.{6,}).*", "g");
    var pwd = document.getElementById("password");
    if (pwd.value.length==0)
    {
        document.getElementById('strengthBox1').style.backgroundColor = "white";
        document.getElementById('strengthBox2').style.backgroundColor = "white";
        document.getElementById('strengthBox3').style.backgroundColor = "white";
        document.getElementById('strengthBox4').style.backgroundColor = "white";
    }
    else if (false == enoughRegex.test(pwd.value))
    {
        document.getElementById('strengthBox1').style.backgroundColor = "#4AE817";
    }
    else if (strongRegex.test(pwd.value))
    {
        document.getElementById('strengthBox4').style.backgroundColor = "#4AE817";
        document.getElementById('strengthBox1').style.backgroundColor = "#4AE817";
        document.getElementById('strengthBox2').style.backgroundColor = "#4AE817";
        document.getElementById('strengthBox3').style.backgroundColor = "#4AE817";
    }
    else if (mediumRegex.test(pwd.value))
    {
        document.getElementById('strengthBox1').style.backgroundColor = "#4AE817";
        document.getElementById('strengthBox2').style.backgroundColor = "#4AE817";
        document.getElementById('strengthBox3').style.backgroundColor = "#4AE817";
    }
    else
    {
        document.getElementById('strengthBox1').style.backgroundColor = "#4AE817";
        document.getElementById('strengthBox2').style.backgroundColor = "#4AE817";
    }
}

/**
* Function to remove all errors
*
*/
function removeError(id)
{
    document.getElementById(id).innerHTML = "";
    document.getElementById(id).style.backgroundColor="";
}

/**
* Function to update password
*/
function updatePassword()
{
    var old_pass=document.getElementById('old_password').value;
    var new_password=document.getElementById('password').value;
    var verify_new_password=document.getElementById('retypepassword').value;
    if(old_pass=='')
    {
        document.getElementById('oldpwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/wrong.GIF></img>";
        document.getElementById('oldpwd-err').innerHTML = 'Field should not blank .';
        return;
    }
    else if(new_password=='')
    {
        removeError('oldpwd-err2');
        removeError('oldpwd-err');
        document.getElementById('pwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/wrong.GIF></img>";
        document.getElementById('pwd-err').innerHTML = 'Field should not blank .';
        return;
    }
    else if(verify_new_password=='')
    {
        removeError('oldpwd-err2');
        removeError('oldpwd-err');
        document.getElementById('repwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/wrong.GIF></img>";
        document.getElementById('repwd-err').innerHTML = 'Field should not blank .';
        return;
    }
    // passwordValidation(new_password);
    // repassValidation(verify_new_password);
    xmlh			= GetXmlHttpObject();
    if(document.getElementById('oldpwd-err').innerHTML==''&&
        document.getElementById('pwd-err').innerHTML==''&&
        document.getElementById('repwd-err').innerHTML=='')
        {
        var response	= SendPostRequest(xmlh,
            siteURL + "user/updatePassword",
            "old_password="+old_pass+"&new_password="+new_password,
            function(){

                /* var f_div = document.getElementById('full-profile-detail')
            if(xmlh.readyState < 4)
                f_div.innerHTML = "<img src="+templateURL+"images/loader.gif /> saving ...<br /><br />"*/

                if(xmlh.readyState == 4)
                {
                    var res=xmlh.responseText;
                    if(res=='err')
                    {
                        document.getElementById('oldpwd-err2').innerHTML = "<img src="+siteURL+"application/views/templates/home/images/wrong.GIF></img>";
                        document.getElementById('oldpwd-err').innerHTML = 'Please verify your password .';
                    }
                    else
                        document.getElementById('full-profile').className = 'no-display';
                }

            });
    }
}

	
/**
*	To subscribe to daily digest; display the e-mail options on center panel
*	@param none
* 	@return none
*/
function editEmailSubscriptionStatus(is_subscribed)
{	
    var email_daily_digest_status		= document.getElementsByName('emailDailyDigest')[0].checked;
    var email_shared_links_status		= document.getElementsByName('emailSharedLinks')[0].checked;
    var email_friend_requests_status	        = document.getElementsByName('emailFriendsRequests')[0].checked;
    var email_messages_status			= document.getElementsByName('emailMessages')[0].checked;

    //Fill the div with relevant info
    xmlh			= GetXmlHttpObject();
		
    var response	= SendPostRequest(xmlh,
        siteURL + "user/editPreferences",
        "emailSubscriptionDailyDigest=" + email_daily_digest_status + "&emailSubscriptionSharedLinks=" + email_shared_links_status + "&emailSubscriptionFriendsRequests=" + email_friend_requests_status + "&emailSubscriptionMessages=" + email_messages_status,
        function(){
												
            var f_div = document.getElementById('full-profile-content')
            if(xmlh.readyState < 4)
                f_div.innerHTML = "<img src="+templateURL+"images/loader.gif /> sending ...<br /><br />"
												
            if(xmlh.readyState == 4)
                openPreferencesWindow();
												
        });
											
}

/**
* To delete the user comment
*/
function deleteComment(user_comment_id)
{
    //Fill the div with relevant info
    xmlh		= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        siteURL + "user/deleteUserComment",
        "user_comment_id=" + user_comment_id,
        function(){
            if(xmlh.readyState < 4)
                document.getElementById("account-data").innerHTML = "<img src="+templateURL+"images/loader.gif /> deleting ...<br /><br />";
            if(xmlh.readyState == 4)
            {
                var res = xmlh.responseText;
                userComments(document.getElementById("comments-a"), 0)
            }
        });
}

/**
* Send invitation to linkive user
*/
function sendInvitation(friend_id)
{
    var personal_message= document.getElementById('inv-msg').value;
    //Fill the div with relevant info
    xmlh		= GetXmlHttpObject();
    var response	= SendPostRequest(xmlh,
        siteURL + "connection/invite",
        "friend_id=" + friend_id +"&message="+personal_message,
        function(){
            if(xmlh.readyState < 4)
                document.getElementById('initation-span').innerHTML = "<img src="+templateURL+"images/loader.gif /> inviting ...<br /><br />";
            if(xmlh.readyState == 4)
            {
                window.location.reload();
            }
        });
}
        
function inviteContacts()
{ 
    if(document.contactsForm)
    {  
        var email 	= document.getElementById('email-address').innerHTML;
        var invited_contacts = "";  
        var conts	= document.contactsForm.contacts;
        var len		= conts.length;
        for(var i = 0; i < len; i++)
            if(conts[i].checked)
            {
                var cont_det	= conts[i].value;
                //var cont_email	= cont_det.substr(0, cont_det.lastIndexOf('(*^#'));
                invited_contacts += cont_det + ",";
							   			
                //Fill the div with relevant info
                xmlh		= GetXmlHttpObject();
                var response= SendPostRequest(xmlh,
                    siteURL + "contact/invite",
                    "email_address=" + email + "&contacts=" + invited_contacts,
                    function(){
                        if(xmlh.readyState < 4)
                            document.getElementById("grab-content").innerHTML = "<img src="+templateURL+"images/loader.gif /> inviting ...<br /><br />";
                        if(xmlh.readyState == 4)
                            friends(document.getElementById("friends-a"), 0);
                    });
            }
    }
    else
     {   
        var emails 	= document.getElementById('email-boxs').value;
        if(emails)
            {
                xmlh	    = GetXmlHttpObject();
                var response= SendPostRequest(xmlh,
                    siteURL + "contact/directInvite",
                    "contacts=" + emails,
                    function(){
                        if(xmlh.readyState < 4)
                            document.getElementById("grab-content").innerHTML = "<img src="+templateURL+"images/loader.gif /> inviting ...<br /><br />";
                        if(xmlh.readyState == 4)
                            {
                                 
                          friends(document.getElementById("friends-a"), 0);
                        var res=xmlh.responseText;
                     
                       if(res == "1")
                       Email_sent =1;
                      // alert(xmlh.responseText);
                       }
                            
                     });
                    
            }
         else
            {
              document.getElementById("display_message").innerHTML = "<b style='color:red;margin-left: 30px;'>Please enter a email.</b>";
            }
     }
}
function showCategoryListInProfileWindow(start)
{

    var load_url_box_class = document.getElementById('browser-load-category-box').className;
    document.getElementById('box-load-category-content').style.height = "125 px";
    if(load_url_box_class != "profileloadcategorybox" && start == 0)
        document.getElementById('browser-load-category-box').className    = "profileloadcategorybox";
    else
    {
        document.getElementById('browser-load-category-box').className    += " block";
        document.getElementById('box-load-category-content').innerHTML     = "<img src='"+GLOBAL_TEMPLATE_URL+"images/loader.gif' /> loading...";
        xmlh		= GetXmlHttpObject();
        var response	= SendPostRequest(xmlh, GLOBAL_SITE_URL+"ajax/category/selectCategoriesInListBox",
            '',
            function(){
                if(xmlh.readyState == 4)
                    document.getElementById('box-load-category-content').innerHTML = xmlh.responseText;
            });
    }
    
}

