var request_list = '';
var request_fullmap = '';
var request = '';
var request1 = '';
var request2 = '';
var helper_in = 0;
var leftDivHeight;
var dummyLeftPanel;
function onRSC(oRequest, func, divTemplate, loggedInFun) {
   var state = 0;
    var status = 0;
    try {
        status = oRequest.status;
        state = oRequest.readyState;
		
    } 
    catch(e) {}
	   if ((state == 4 || state == "complete") && (status == 200)) {
		    if (parse_ajax_response(oRequest.responseText, divTemplate, loggedInFun)) {
            func();
        }
        actionUnlock();
    }
}
function gotoPageHeader() {
    window.scrollTo(0, 0);
}
function actionLock() {
    if (window.lock) {
        return false;
    }
    else {
        window.lock = true;
        return true;
    }
}
function actionUnlock() {
    window.lock = false;
}
function GetXmlHttpObject() {
    var httpRequest;
    try {
        httpRequest = new XMLHttpRequest();
    }
    catch(e) {
        var Versions = new Array("MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP");
        for (i = 0; i < Versions.length && !httpRequest; i++) {
            try {
                httpRequest = new ActiveXObject(Versions[i]);
            }
            catch(e) {}
        }
    }
    if (!httpRequest) {
        throw new error('Error creating XMLHttpRequest object');
        return false;
    }
    return httpRequest;
}
var popup_lock = false;
var popup_onload_func = false;
function show_ajax_popup(url, nsWidth, nsHeight) {
    if (!popup_lock) {
        if (!document.getElementById('dhtml_popup')) {
            popup_lock = true;
            var popup_width = (nsWidth || false) ? nsWidth: false;
            var popup_height = (nsHeight || false) ? nsHeight: false;
            var popup_func = function() {
                return parse_popup_errors(rnd);
            };
            rnd = Math.floor(Math.random() * 1000000);
            url += (url.indexOf('?') == -1 ? '?': '&') + 'rnd=' + rnd;
			
            request = GetXmlHttpObject();
            request.onreadystatechange = function() {
				
                display_ajax_popup(popup_width, popup_func, popup_height);
            };
            request.open("GET", url, true);
            request.send(null);
        }
    }
}
function display_ajax_popup(popup_width, popup_func, popup_height) {
    var state = 0;
    var status = 0;
    var width = (popup_width || false) ? popup_width: 570;
    var height = (popup_height || false) ? popup_height: 500;
    try {
        status = request.status;
        state = request.readyState;
    }
    catch(e) {}
    if ((state == 4 || state == "complete") && (status == 200)) {
       popup_lock = false;
        var process_continue = popup_func();
        if (process_continue) {
            var html = request.responseText;
            show_dhtml_popup('view', html, width, height);
            if (popup_onload_func || false) {
                popup_onload_func();
                popup_onload_func = false;
            }
        }
        else {
            show_dhtml_popup('delete');
        }
    }
}
function parse_popup_errors(rnd, errorFunc) {
    var sResponse = request.responseText;
	var bReturn = true;

    errorFunc = (errorFunc || false) ? errorFunc: display_error;
    switch (sResponse) {
    case 'ERROR : ' + rnd + ' : EMAIL VALIDATION IS REQUIRED': errorFunc(validation_needed);
        bReturn = false;
        break;
    case 'ERROR : ' + rnd + ' : USER BLOCKED YOU': errorFunc(u_blocked);
        bReturn = false;
        break;
    case 'ERROR : ' + rnd + ' : USER BLOCKED YOU - FRIENDSHIP FORBIDEN': errorFunc(friendship_denied);
        bReturn = false;
        break;
    case 'ERROR : ' + rnd + ' : USER ALREADY BLOCKED': errorFunc(user_already_blocked);
        bReturn = false;
        if (document.getElementById('but_block_mem')) {
            document.getElementById('but_block_mem').style.display = "none";
            document.getElementById('but_unblock_mem').style.display = "";
        }
        break;
    case 'ERROR : ' + rnd + ' : USER IS YOUR FRIEND': errorFunc(user_already_friend);
        bReturn = false;
        break;
    case 'ERROR : ' + rnd + ' : USER IS NOT YOUR FRIEND': errorFunc(user_not_friend);
        bReturn = false;
        break;
    case 'ERROR : ' + rnd + ' : FRIEND REQUEST IS ALREADY SENT': errorFunc(friend_rq_already_sent);
        bReturn = false;
        break;
    case 'ERROR : ' + rnd + ' : RECIEVER NOT FOUND': errorFunc(reciever_not_found);
        bReturn = false;
        break;
	case 'ERROR : ' + rnd + ' : YOU ALREADY SAVED THIS MEMBER': errorFunc(error_save_member);
		gid('ev_save_id').style.display="none";
		gid('ev_saved_id').style.display="";
        bReturn = false;
        break;
    }
    return bReturn;
}
function parse_responce_on(sError, rnd, errorFunc) {
    var sResponse = request.responseText;
    var sFullError = 'ERROR : ' + rnd + ' : ' + sError;
    var re = new RegExp(sFullError);
    var bResult = sResponse.search(re);
    if (bResult > -1) {
        if (errorFunc || false) {
            errorFunc();
        }
        return true;
    }
    else {
        return false;
    }
}
function proceed_on_enter(e) {
    if (e.keyCode == 13) {
        var obj = document.getElementById('submit') ? document.getElementById('submit') : document.getElementById('submit_img');
        try {
            var newEvent = document.createEvent("MouseEvents");
        } catch(e) {}
        if (!newEvent) {
            var newEvent = document.createEventObject();
            newEvent.clientX = 100;
            newEvent.clientY = 100;
            newEvent.canselBubble = false;
            newEvent.button = 1;
            obj.fireEvent("onclick", newEvent);
        } else {
            newEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
            obj.dispatchEvent(newEvent);
        }
    }
}
function func_on_enter(e, func) {
    if (e.keyCode == 13) {
        func();
    }
}
var loginMathRandom;
function showLogin(divTemplate, loggedInFun) {

    hide_alert_blocks();
    show_dhtml_popup('delete');
	if(loggedInFun ||false) {
		var str = "&loggedInFun="+loggedInFun;
	} else {
		var str = '';
	}

    if (divTemplate || false) {
	
        var url = '/ajax_login.php?login_process=1&divTemplate=' + divTemplate+str;
    } else {
	
        var url = '/ajax_login.php?login_process=1'+str;
    }
	 show_ajax_popup(url);
}
var ajax_popup_page_reloading;
function proceedLogin(divTemplate, loggedInFun) {
	var aFields = Array(Array('login_form_email', ''), Array('login_form_password', ''));
    aFields["error_func"] = function() {
        return false;
    };
    if (!checkData(aFields)) {
        return false;
    }
    if (document.getElementById('required_page') || false) {
		document.getElementById("login_form").submit();
    }
	else {
        if (actionLock()) {
            loginMathRandom = Math.floor(Math.random() * 1000000);
            var sPageReloading = (ajax_popup_page_reloading || false) ? '&reloadable_page=1': '';
            var sData = collect_data('login_form');
            var url = '/auth.php?rnd=' + loginMathRandom + sData + sPageReloading;
			divname = 'dhtml_popup';
            request = GetXmlHttpObject();
            request.onreadystatechange = function() {
                proceedLoginSuccess(divTemplate, loggedInFun);
            };
            request.open("GET", url, true);
            request.send(null);
        }
    }
}
function proceedLoginSuccess(divTemplate, loggedInFun) {
	var state = 0;
    var status = 0;
    try {
        status = request.status;
        state = request.readyState;
    }
    catch(e) {}
    if ((state == 4 || state == "complete") && (status == 200)) {
        if (request.responseText.indexOf('LOGGED IN SUCCESS :' + loginMathRandom) != -1) {
            show_dhtml_popup('delete');
			if(loggedInFun || false) {
			window[loggedInFun]();
			}
			if(divTemplate) {
				document.getElementById('miacc').innerHTML = '<a style="color:#000;" href="/my_account.php" >My Account</a><img src="/images/general/cmn_sep1.gif" width="1" height="11" style="padding:0 11px;"/><a href="/invite_friends.php" style="color:#000;">Invite Friends</a>';
				document.getElementById('milogout').innerHTML ='<a href="/logout.php" class="topmenu"><img  alt="Logout" title="Logout" src="/images/main_menu/menu_log_out.gif" width="67" height="14" border="0" ></a>';
			} else {
				document.getElementById('miacc').innerHTML = '<a  href="/my_account.php"  class="topmenu"> My Account</a>';
				document.getElementById('invfrnds').innerHTML = '<a href="/invite_friends.php" class="topmenu"> Invite Friends</a>';
				document.getElementById('milogout').innerHTML ='<a href="logout.php" class="topmenu"><img  alt="Logout" title="Logout" src="/images/main_menu/menu_log_out.gif" width="67" height="14" border="0" ></a>';
			}
			
			if (document.getElementById("objType").value== "event")
			{
					event_popup();
			} 
			if (document.getElementById("objType").value== "composer")
			{
					composer_popup();
			} 
		if ( document.getElementById("objType").value== "composition")
			{
					
					composition_popup();
			}
			if ( document.getElementById("objType").value== "user_review")
			{
				window.location.reload();
			} 
			if (document.getElementById("objType").value == "venue")
			{
				venue_popup();
			}
			if (document.getElementById("objType").value	==	"performer")
			{
				performer_popup();
			}
			
		 }
        else if (request.responseText.indexOf('REQUIRED POPUP :' + loginMathRandom) != -1) {
			if(loggedInFun || false) {
					window[loggedInFun]();
			}
			if(divTemplate) {
				document.getElementById('miacc').innerHTML = '<a style="color:#000;" href="/my_account.php" >My Account</a><img src="/images/general/cmn_sep1.gif" width="1" height="11" style="padding:0 12px 0 12px;"/><a href="/invite_friends.php" style="color:#000;">Invite Friends</a>';
				document.getElementById('milogout').innerHTML ='<a href="/logout.php" class="topmenu"><img  alt="Logout" title="Logout" src="/images/main_menu/menu_log_out.gif" width="67" height="14" border="0" ></a>';
			} else {
				document.getElementById('miacc').innerHTML = '<a  href="my_account.php"  class="topmenu"> My Account</a>';
				document.getElementById('invfrnds').innerHTML = '<a href="invite_friends.php" class="topmenu"> Invite Friends</a>';
				document.getElementById('milogout').innerHTML ='<a href="logout.php" class="topmenu"><img  alt="Logout" title="Logout" src="images/main_menu/menu_log_out.gif" width="67" height="14" border="0" ></a>';
			}
			if (request.responseText.indexOf('WRONG PARAMETRS') != -1) {
				window.location.reload();
			} else if(request.responseText.indexOf('ERROR') != -1 && request.responseText.indexOf('ERROR :') < 1000) {
				window.location.reload();
			} else {	
				document.getElementById(divname).innerHTML = request.responseText;
			}
        }
        else if (request.responseText.indexOf('RELOAD BODY :' + loginMathRandom) != -1) {
				if(window.location.href.indexOf('city_not_covered.php') != -1) {
					window.location.href = '/events.php';
				} else {
					window.location.reload();
				}
			
        } else {
			if(request.responseText.indexOf('NOT LOGGED IN :' + loginMathRandom) != -1) {
				 window.location.href = '/auth.php';
			} else {
	            window.location.href = '/my_account.php';
			}
        }
        actionUnlock();
			
    }
}
function display_info(message, hide) {
	document.getElementById('success_box').style.display = '';
    document.getElementById('success_box_msg').innerHTML = message;
    document.getElementById('error_box').style.display = 'none';
    document.getElementById('system_box').style.display = 'none';
	if(hide || false) {
	} else {
	    gotoPageHeader();
	}
}
function display_error(message) {

    document.getElementById('error_box').style.display = '';
    document.getElementById('error_box_msg').innerHTML = message;
    document.getElementById('success_box').style.display = 'none';
    document.getElementById('system_box').style.display = 'none';
    gotoPageHeader();
}
function display_system(message) {
    document.getElementById('system_box').style.display = '';
    document.getElementById('system_box_msg').innerHTML = message;
    document.getElementById('error_box').style.display = 'none';
    document.getElementById('success_box').style.display = 'none';
    gotoPageHeader();
}
function hide_alert_blocks() {
    document.getElementById('system_box').style.display = 'none';
    document.getElementById('error_box').style.display = 'none';
    document.getElementById('success_box').style.display = 'none';
}
function display_ARM(sMsgId) {
    var sElementId = (sMsgId || false) ? sMsgId: 'ARM';
    var sMessage = document.getElementById(sElementId).innerHTML;
    var result = sMessage.match(/<!--\s?(\w{4,6})\s?-->/);
    var sType = result !== null ? result[1] : 'error';
    sType = sType.toLowerCase();
    switch (sType) {
    case 'error':
        return function() {
            display_error(sMessage);
        };
        break;
    case 'info':
        return function() {
            display_info(sMessage);
        };
        break;
    case 'system':
        return function() {
            display_system(sMessage);
        };
        break;
    }
}
function popup_display_error(message) {
    document.getElementById('error_message').style.display = '';
    document.getElementById('error_text').innerHTML = message;
}
function display_popup_error(sErrorId) {
    var parent = document.getElementById('popup_error');
    parent.style.display = '';
    var aErrors = parent.getElementsByTagName('span');
    for (var i = 0, leng = aErrors.length; i < leng; i++) {
        aErrors[i].style.display = "none";
    }
    if (sErrorId || false) {
        document.getElementById(sErrorId).style.display = "inline";
    }
}
function write_popup_error(sMsg) {
    var sId = 'popup_error_message';
    document.getElementById(sId).innerHTML = sMsg;
    display_popup_error(sId);
}
var divname = '';
function load_to_div(reqObject, fJSFunc, fErrorJSFunc, fJSAnalyzeResult, divTemplate) {
   //alert(fJSFunc);
    var state = 0;
    var status = 0;
    try {
        status = reqObject.status;
        state = reqObject.readyState;
    }
    catch(e) {}
    if ((state == 4 || state == "complete") && (status == 200)) {
        if (reqObject.responseText == 'NOT LOGGED IN :') {
            if (fErrorJSFunc || false) {
                fErrorJSFunc();
            }
            showLogin(divTemplate);
        }
        else {
            if (fJSAnalyzeResult || false) {
                if (fJSAnalyzeResult(reqObject.responseText)) {
                    if (fJSFunc || false) {
                        fJSFunc();
                    }
                }
            }
            else {

                document.getElementById(divname).innerHTML = reqObject.responseText;
                $(document).ready(function() {
                  $('img').error(function() {
                   $(this).remove();
                  });
                  //$("a:visited").css("color","#0066CC");
                 // $("a:link").css("color","#0066CC");
                });
                if (fJSFunc || false) {
                    fJSFunc();
                }
            }
        }
        actionUnlock();
    }
}
var funcVariable = false;
function onload_start_func() {
    var state = 0;
    var status = 0;
    var func = arguments[0];
    try {
        status = request.status;
        state = request.readyState;
    }
    catch(e) {}

    if ((state == 4 || state == "complete") && (status == 200)) {
        if (parse_ajax_response(request.responseText)) {
            if (func || false) {
                func();
            }
            else {
                funcVariable();
            }
        }
        actionUnlock();
    }
}

function loadResponceToDiv(oRequest, sDivID) {
    return function() {
        gid(sDivID).innerHTML = oRequest.responseText;
    };
}
function getRandom() {
    return Math.floor(Math.random() * 1000000);
}
function getURLRandom() {
    return '&rnd=' + getRandom();
}
function parse_ajax_response(ajaxResponse, divTemplate, loggedInFun) {
    if (ajaxResponse == 'NOT LOGGED IN :') {
        showLogin(divTemplate, loggedInFun);
        return false;
    }
    else {
        return true;
    }
}
function checkData(aFields) {
    for (var j = 0, leng = aFields.length; j < leng; j++) {
        var oField = aFields[j];
        var sType;
        if (oField[2] || false) {
            sType = oField[2];
        }
        else {
            sType = 'not_null';
        }
        var input = (sType != 'radio_group') ? document.getElementById(oField[0]) : false;
        switch (sType) {
        case 'not_null':
            res = /\S+/.test(input.value);
            break;
        case 'email':
            res = /^[a-zA-Z0-9\.\-_\+]+@[a-zA-Z0-9\.\-_]+\.[a-zA-Z]{2,4}$/.test(input.value);
            break;
        case 'nickname':
            res = (/^[a-zA-Z0-9\-_]{3,15}$/.test(input.value)) && (/^(?!www$)/.test(input.value));
            break;
		case 'nickname_long':
			res = (input.value.length > 15) ? false:true;
			break;
		case 'nickname_short':
			res = (input.value.length < 3) ? false:true;
			break;
        case 'zip':
            res = /^[0-9]{4,7}$/.test(input.value);
		    break;
        case 'name':
            res = /^[a-zA-Z]{1,}[a-zA-Z0-9- ]{1,}$/.test(input.value);
            break;
        case 'checked':
            res = input.checked;
            break;
        case 'password':
            res = /^[\S]{1,20}$/.test(input.value);
            break;
        case 'short_password':
            res = /^[\S]{4,20}$/.test(input.value);
            break;
        case 'radio_group':
            var aInputs = document.getElementsByName(oField[0]);
            var iInputsLength = aInputs.length;
            if (iInputsLength === undefined) {
                res = (aInputs.checked) ? true: false;
            }
            else {
                res = false;
                for (var i = 0; i < iInputsLength; i++) {
                    if (aInputs[i].checked) {
                        res = true;
                        break;
                    }
                }
            }
            break;
        default:
            regular = sType;
            res = regular.test(input.value);
        }
        if (!res) {
            if (oField[1] || false) {
                if (aFields['error_func'] || false) {
                    var func = aFields['error_func'];
                    func(oField[1]);
                }
                else {
                    display_error(oField[1]);
                }
                return false;
            }
            else {
                return false;
            }
        }
    }
    return true;
}
function collect_data(sElementID) {
    var sData = '';
    var parent;
    if (sElementID || false) {
        parent = document.getElementById(sElementID);
    } else {
        parent = document;
    }
    var els = parent.getElementsByTagName("input");
    for (i = 0; i < els.length; i++) {
        if (els[i].type == "checkbox") {
            if (els[i].checked) {
                sData += '&' + els[i].name + '=' + els[i].value;
            }
        }
        else if (els[i].type == "radio") {
            if (els[i].checked) {
                sData += '&' + els[i].name + '=' + els[i].value;
            }
        }
        else if (els[i].type != "button" && els[i].value !== '' && els[i].name != 'rnd' && els[i].name !== '') {
            sData += '&' + els[i].name + '=' + escape(els[i].value);
        }
    }
    els = parent.getElementsByTagName("textarea");
    for (i = 0; i < els.length; i++) {
        if (els[i].value !== '') {
            sData += '&' + els[i].name + '=' + escape(els[i].value);
        }
    }
    els = parent.getElementsByTagName("select");
    for (i = 0; i < els.length; i++) {
        if (els[i].name && els[i].value != '-1') {
            sData += '&' + els[i].name + '=' + escape(els[i].value);
        }
    }
    return sData;
}
hl_lock = false;
function show_find_city(obj) {
    if (!hl_lock) {
        hl_lock = true;
        var body_obj = document.getElementsByTagName("body").item(0);
        var content_obj = document.createElement('DIV');
        content_obj.setAttribute("id", "find_city");
        content_obj.style.display = '';
        content_obj.style.left = getposOffset(obj, 'left') - 110;
        content_obj.style.top = getposOffset(obj, 'top') + obj.scrollHeight + 5;
        content_obj.style.position = 'absolute';
        content_obj.style.zIndex = 102;
        content_obj.style.border = "1px solid #FFFFFF";
        body_obj.appendChild(content_obj);
        var url = "/ajax_location_find_city.php";
        request = GetXmlHttpObject();
        request.open("GET", url, false);
        request.send(null);
        if (parse_ajax_response(request.responseText)) {
            var find_city_html = request.responseText;
            content_obj.innerHTML = find_city_html;
            document.getElementById('cities_list').innerHTML = document.getElementById('match1').innerHTML;
            if (navigator.appName.charAt(0) == "M") {
                create_frame(content_obj, 'create', 100, 5, 2);
            }
        }
    }
}
function close_find_city() {
    var body_obj = document.getElementsByTagName("body").item(0);
    var content_obj = document.getElementById('find_city');
    body_obj.removeChild(content_obj);
    if (navigator.appName.charAt(0) == "M") {
        create_frame(content_obj, 'remove');
    }
    hl_lock = false;
}
function search_for_city(page, divTemplate) {
    if (actionLock()) {
        document.getElementById('not_found').style.display = 'none';
        document.getElementById('finded_cities').style.display = 'block';
        if (divTemplate) {
            document.getElementById('match1').style.display = 'none';
        }
        var sExtraUrl = escape(divTemplate);
        var fraze = escape(document.getElementById('city_search').value);
        var url = "/ajax_location_find_city_helper.php?search=" + fraze + '&divTemplate=' + sExtraUrl+'&page='+page+'&rnd=' + Math.floor(Math.random()*1000000 );
        divname = 'finded_cities';
        var request_search_for_city = GetXmlHttpObject();
        request_search_for_city.onreadystatechange = function() {
            load_to_div(request_search_for_city);
            if ((request_search_for_city.readyState == 4)) {
                changeLocationHovers();
            }
        };
        request_search_for_city.open("GET", url, true);
        request_search_for_city.send(null);
    }
}



function cover_city_div() {
    if (actionLock()) {
        divname = 'find_city_div';
        var url = "/ajax_location_find_city_helper.php?show=cover_city" + '&divTemplate=divTemplate&rnd=' + Math.floor(Math.random()*1000000 );
        var request_cover_city = GetXmlHttpObject();
        request_cover_city.onreadystatechange = function() {
            load_to_div(request_cover_city);
            if ((request_cover_city.readyState == 4)) {
                load_city_hide();
                changeLocationHovers();
            }
        };
        request_cover_city.open("GET", url, true);
        request_cover_city.send(null);
    }
}
function load_city_hide() {
    document.getElementById('match7').style.display = 'none';
    document.getElementById('not_found').style.display = 'none';
    gid('find_city_div').style.display = '';
}
function set_home_location(city_id) {
    if (actionLock()) {
        var url = "/ajax_location_set.php?home_location=" + city_id;
        divname = 'home_location';
        var request_set_home = GetXmlHttpObject();
        request_set_home.onreadystatechange = function() {
            load_to_div(request_set_home);
        };
        request_set_home.open("GET", url, true);
        request_set_home.send(null);
        close_find_city();
    }
}
function set_home_location_div(city_id, citynotcover) {
    if (actionLock()) {
        var url = "/ajax_location_set.php?home_location=" + city_id;
        divname = 'home_location';
        var request_set_home = GetXmlHttpObject();
        request_set_home.onreadystatechange = function() {
            load_to_div(request_set_home);
			if(request_set_home.readyState == 4) {
				if(document.location.href.indexOf('events.php') != -1 || window.location.href.indexOf('city_not_covered.php') != -1) {
					window.location.href='events.php';
				}else if(document.location.href.indexOf('restaurant.php') != -1) {
					window.location.href='restaurant.php';
				}
	     		else if(document.getElementById('homelocChanged') || document.location.href.indexOf('_list.php') != -1) {
					if(typeof(oF) == "object") {
						var qry = oF.oSearch.query;
						qry = qry.replace(/exitcity:o;?/,"");
						qry = qry.replace(/city:[^;]*;/,"");
						qry = qry.replace(/neighbor:[^;]*;/,"");
						qry = qry.replace(/place:[^;]*;/,"place:"+ city_id+";");
						window.location.href ="events_list.php?q="+qry;
					} else {
						window.location.reload();
					}
				}
			}
        };
        request_set_home.open("GET", url, true);
        request_set_home.send(null);
        close_find_city();
		
    }
}
function city_not_found() {
    document.getElementById('not_found').style.display = '';
    document.getElementById('finded_cities').style.display = 'none';
}
function cover_city() {
    if (actionLock()) {
        divname = 'find_city';
        var url = "/ajax_location_find_city_helper.php?show=cover_city";
        var request_cover_city = GetXmlHttpObject();
        request_cover_city.onreadystatechange = function() {
            load_to_div(request_cover_city);
            if ((request_cover_city.readyState == 4)) {
                changeLocationHovers();
            }
        };
        request_cover_city.open("GET", url, true);
        request_cover_city.send(null);
    }
}
function cover_set_provinces(obj) {
    var country_id = obj.value;
    var update_provinces = function() {
        sOptions = request.responseText;
        document.getElementById('location_provinces_td').innerHTML = "\<select style='border: 1px solid rgb(122, 159, 188); width: 137px; height: 19px;' name='state'>" + sOptions + "</select>";
    }
    request = GetXmlHttpObject();
    request.onreadystatechange = function() {
        onload_start_func(update_provinces);
    };
    request.open("GET", "/ajax_locations_provinces.php?absence_default=1&country_id=" + country_id, true);
    request.send(null);
}
function send_cover(divTemplate) {
    if (actionLock()) {
        divname = 'find_city';
        if (divTemplate) {
			divname = 'find_city_div';
            document.getElementById('match1').style.display = 'none';
        }
        var sExtraUrl = escape(divTemplate);
        var url = "/ajax_location_find_city_helper.php?show=cover_send" + '&divTemplate=' + sExtraUrl;
        var request_send_cover = GetXmlHttpObject();
        request_send_cover.onreadystatechange = function() {
            load_to_div(request_send_cover);
            if ((request_send_cover.readyState == 4)) {
                changeLocationHovers();
            }
        };
        request_send_cover.open("GET", url, true);
        request_send_cover.send(null);
    }
}
function block_member(member_id, divID) {
	
    if (actionLock()) {
        var rnd = Math.floor(Math.random() * 1000000);
        var url = '/ajax_block_member.php?bid=' + member_id + '&rnd=' + rnd;
        
        funcVariable = function() 
		{
			if (parse_popup_errors(rnd)) {
                //msg();
				display_ARM()();
                if (document.getElementById('but_block_mem')) {
                    document.getElementById('but_block_mem').style.display = "none";
                    document.getElementById('but_unblock_mem').style.display = "";
                }
            }
			show_dhtml_popup('delete');
        };
        request = GetXmlHttpObject();
        request.onreadystatechange = function() {
		    onload_start_func();
        };
        request.open("GET", url, true);
        request.send(null);
        //if (divID || false) closeMessagePopup(divID);
        
    }
}
function unblock_member(member_id, divID) {
    if (actionLock()) {
        var rnd = Math.floor(Math.random() * 1000000);
        var url = '/ajax_unblock_member.php?unbid=' + member_id + '&rnd=' + rnd;
        funcVariable = function() {
            if (parse_popup_errors(rnd)) {
                display_ARM()();
                if (document.getElementById('but_block_mem')) {
                    document.getElementById('but_block_mem').style.display = "";
                    document.getElementById('but_unblock_mem').style.display = "none";
                }
            }

			show_dhtml_popup('delete');
            if (divID || false) {
                closeMessagePopup(divID);
            }
        };
        request = GetXmlHttpObject();
        request.onreadystatechange = function() {
            onload_start_func();
        };
        request.open("GET", url, true);
        request.send(null);
    }
}
function go_to_link(sLink, iIsLogged) {
    if (iIsLogged || false) {
        bLogginRequire = iIsLogged > 0 ? false: true;
    } else {
        bLogginRequire = false;
    }
    if (bLogginRequire) {
        show_ajax_popup('ajax_login.php?link=' + encodeURIComponent(sLink));
    } else {
        window.location = sLink;
    }
}
function showstuff_div(sec) {
    request_mystuff = GetXmlHttpObject();
    var mzver = navigator.userAgent;
    $("div#mystuff1").slideDown(250);
    var off = $("div#mystuff_div").offset();
    if (mzver.indexOf('Mozilla') != -1) {
        if(sec == "travel"){
			var cur_left = off.left - 122;
			var cur_top = off.top + 1;
		}else{
			var cur_left = off.left - 114;
			var cur_top = off.top + 1;
		}
        $("div#mystuff1").css("left", cur_left + "px");
        $("div#mystuff1").css("top", cur_top + "px");
    }
    else {
        var cur_left = off.left - 114;
        var cur_top = off.top + 1;
        $("div#mystuff1").css("left", cur_left + "px");
        $("div#mystuff1").css("top", cur_top + "px");
    }
    var url = '/mystuff_ui_div.php?rnd=' + Math.floor(Math.random() * 1000000);
    request_mystuff.onreadystatechange = function() {
        loadstuff_div();
    };
    request_mystuff.open("GET", url, true);
    request_mystuff.send(null);
}

function loadstuff_div() {
    var state = 0;
    var status = 0;
    try {
        status = request_mystuff.status;
        state = request_mystuff.readyState;
    }
    catch(e) {}
    if ((state == 4 || state == "complete") && (status == 200)) {
        var mystuff_div = document.getElementById('mystuff1');
		//alert(request_mystuff.responseText);
        mystuff_div.innerHTML = request_mystuff.responseText;
        addHovers();
    }
}
function hide_mystuff_div() {
    $("div#mystuff1").css("display", "none");
}
function addHovers() {
    $("div.bottom_button").click(function() {
        $("#mystuff1").slideUp("fast");
    });
    $("div#mmstf").click(function() {
        $("#mystuff1").slideUp("fast");
    });
    $("a#sh").css({
        'color': '#000000',
        'font-weight': 'bold'
    });
    $("a#hid").css({
        'color': '#000000'
    });
    $("a.friends").hover(function() {
        $("img#frnd").attr("src", "/images/icons/my_stuff/friends_ov.gif");
        $("a.friends").css("text-decoration", "underline");
    },
    function() {
        $("img#frnd").attr("src", "/images/icons/my_stuff/friends.gif");
        $("a.friends").css("text-decoration", "none");
    });
    $("a.mpage").hover(function() {
        $("img#m_page").attr("src", "/images/icons/my_stuff/mypage_ov.gif");
        $("a.mpage").css("text-decoration", "underline");
    },
    function() {
        $("img#m_page").attr("src", "/images/icons/my_stuff/mypage.gif");
        $("a.mpage").css("text-decoration", "none");
    });
    $("a.edit_page").hover(function() {
        $("a.edit_page").css("text-decoration", "underline");
    },
    function() {
        $("a.edit_page").css("text-decoration", "none");
    });
    $("a.mail").hover(function() {
        $("img#ml").attr("src", "/images/icons/my_stuff/mail_ov.gif");
        $("a.mail").css("text-decoration", "underline");
    },
    function() {
        $("img#ml").attr("src", "/images/icons/my_stuff/mail.gif");
        $("a.mail").css("text-decoration", "none");
    });
    $("a.calender").hover(function() {
        $("img#cal").attr("src", "/images/icons/my_stuff/calendar_ov.gif");
        $("a.calender").css("text-decoration", "underline");
    },
    function() {
        $("img#cal").attr("src", "/images/icons/my_stuff/calendar.gif");
        $("a.calender").css("text-decoration", "none");
    });
    $("a.friends").hover(function() {
        $("img#frnd").attr("src", "/images/icons/my_stuff/friends_ov.gif");
        $("a.friends").css("text-decoration", "underline");
    },
    function() {
        $("img#frnd").attr("src", "/images/icons/my_stuff/friends.gif");
        $("a.friends").css("text-decoration", "none");
    });
    $("a.photo").hover(function() {
        $("img#pho").attr("src", "/images/icons/my_stuff/photo_ov.gif");
        $("a.photo").css("text-decoration", "underline");
    },
    function() {
        $("img#pho").attr("src", "/images/icons/my_stuff/photo.gif");
        $("a.photo").css("text-decoration", "none");
    });
    $("a.calender").hover(function() {
        $("img#cal").attr("src", "/images/icons/my_stuff/calendar_ov.gif");
        $("a.calender").css("text-decoration", "underline");
    },
    function() {
        $("img#cal").attr("src", "/images/icons/my_stuff/calendar.gif");
        $("a.calender").css("text-decoration", "none");
    });
    $("img#mystuff_bottom_img").hover(function() {
        $("img#mystuff_bottom_img").attr("src", "/images/icons/my_stuff/bottom_ov.gif");
    },
    function() {
        $("img#mystuff_bottom_img").attr("src", "/images/icons/my_stuff/bottom.jpg");
    });
	$("a.my_savstuff").hover(function() {
        $("img#mysavedstuff").attr("src", "/images/icons/my_stuff/saved_stuff_ov.gif");
        $("a.my_savstuff").css("text-decoration", "underline");
    },
    function() {
        $("img#mysavedstuff").attr("src", "/images/icons/my_stuff/saved_stuff.gif");
        $("a.my_savstuff").css("text-decoration", "none");
    });
}
function login_form_jquery() {
    $("div#overlay").css("display", "block");
    $("div#my_account").fadeIn(800);
    var sh = document.body.scrollHeight;
    var sw = document.body.scrollWidth;
    var mlv = (sw - 565) / 2;
    $("div#overlay").css("height", sh + "px");
    $("div#overlay").css("width", sw + "px");
    $("div#my_account").css("left", mlv + "px");
    $("div#my_account").css("top", "50px");
    $("div#my_account").css("top", "130px");
}
function createLoginRedirectTag(sname, svalue) {
    var cellfarRight = document.getElementById('login_form');
    var e4 = document.createElement('input');
    e4.type = 'hidden';
    e4.name = sname;
    e4.id = sname;
    e4.value = svalue;
    cellfarRight.appendChild(e4);
}
function showstuff() {
    request = GetXmlHttpObject();
    var url = '/mystuff_ui.php?rnd=' + Math.floor(Math.random() * 1000000);
    request.onreadystatechange = function() {
        loadstuff()
    };
    request.open("GET", url, true);
    request.send(null);
}
function loadstuff() {
    var state = 0;
    var status = 0;
    try {
        status = request.status;
        state = request.readyState;
    }
    catch(e) {}
    if ((state == 4 || state == "complete") && (status == 200)) {
        var body_obj = document.getElementsByTagName("body").item(0);
        var mystuff_div = document.getElementById('mystuff_box');
        var mystuff = document.getElementById('mystuff');
        var axy = findPos(mystuff);
        mystuff_div.style.left = axy[0] - 123;
        mystuff_div.style.top = axy[1] + 24;
        mystuff_div.style.display = '';
        mystuff_div.innerHTML = request.responseText;
        isopeninfobox = true;
    }
}
function addOption(sID, sValue, sName, selected, obj) {
    var o = document.createElement("OPTION");
    var t = document.createTextNode(sName);
    o.appendChild(t);
    o.value = sValue;
    if (obj === undefined) {
        lb = document.getElementById(sID);
    } else {
        lb = obj;
    }
    lb.appendChild(o);
    if (selected) {
        lb.selectedIndex = (lb.options.length - 1);
    }
}
function removeOptions(oSelect) {
    if (oSelect && oSelect.tagName && oSelect.tagName.toLowerCase() == "select") {
        var o = oSelect.options;
        if (o && o.length) {
            o.length = 0;
            while (o.length > 0) {
                if (o.remove) {
                    o.remove(o.length - 1);
                }
                else {
                    o[o.length - 1] = null;
                }
            }
            return true;
        }
    }
    return false;
}
function send_compliment(friend_id, isShow) {
//alert(isShow)
    if (actionLock()) {
        var aFields = Array(Array("cid", "error_compliment_set_type", 'radio_group'), Array("compliment", "error_compliment_empty"));
        aFields['error_func'] = display_popup_error;
        if (checkData(aFields)) {
            var sData = collect_data('popup_content');
            var params = 'id=' + friend_id + sData + '&rnd=' + Math.floor(Math.random() * 1000000);
            var url = '/ajax_add_compliment.php';
            funcVariable = function() {
                display_ARM()();
                if (isShow || false) {
					} else {
                    compliment_add_success();
                }
				show_dhtml_popup('delete');
                if (gid('div')) {
                    closeMessagePopup(gid('div').value);
                }
            };
            request = GetXmlHttpObject();
            request.onreadystatechange = function() {
                onload_start_func();
            };
            request.open("POST", url, true);
            request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf8");
            request.send(params);
        }
        else {
            actionUnlock();
        }
    }
}
function show_compliments_small(member_id) {
    request2 = GetXmlHttpObject();
    var url = 'ajax_list_compliments_small.php?id=' + member_id + '&rnd=' + Math.floor(Math.random() * 1000000);
    request2.onreadystatechange = function() {
        compliments_small_statechange();
    };
    request2.open("GET", url, true);
    request2.send(null);
}
function compliments_small_statechange() {
    var state = 0;
    var status = 0;
    try {
        status = request2.status;
        state = request2.readyState;
    }
    catch(e) {}
    if ((state == 4 || state == "complete") && (status == 200)) {
        document.getElementById('compliments_small').innerHTML = request2.responseText;
    }
}
function toPage(n, url, div_or_func, fJSFunc) {
    
	 //alert(fJSFunc)
    if (typeof(div_or_func) == 'function') {
        div_or_func(n);
		//alert(1);
    }
    else {
	    //alert(2);
        var request_toPage = GetXmlHttpObject();
        divname = div_or_func ? div_or_func: 'sqt_page_3';
			loadingStart(divname);
		
        request_toPage.onreadystatechange = function() {
		if(fJSFunc || false) {	
            load_to_div(request_toPage, fJSFunc);
		}else {
			 load_to_div(request_toPage);
		}
            freeSelects();
        };
        url += (url.indexOf('?') != -1) ? ('&page=' + n) : ('?page=' + n);
		
        request_toPage.open("GET", url, true);
        request_toPage.send(null);
    }
}

function toIntPage(n, url, div_or_func) {
        var request_toPage = GetXmlHttpObject();
        divname = div_or_func ? div_or_func: 'sqt_page_3';
        request_toPage.onreadystatechange = function() {
            load_to_div(request_toPage);
            freeSelects();
        };
        url += (url.indexOf('?') != -1) ? ('&page=' + n) : ('?page=' + n);
        request_toPage.open("GET", url, true);
        request_toPage.send(null);
}

function send_message(member_id, subject, sBody, divTempID) {
    if (actionLock()) {
        if (subject || false) {
            bContinue = true;
        }
        else {
            var aFields = Array(Array('subject', 'error_subject_empty'), Array('body', 'error_body_empty'));
            aFields["error_func"] = display_popup_error;
            bContinue = checkData(aFields);
            subject = document.getElementById('subject').value;
            sBody = document.getElementById('body').value;
        }
        if (bContinue) {
            var url = '/ajax_private_message.php';
            var params = 'id=' + member_id + '&subject=' + escape(subject) + '&body=' + escape(sBody) + '&div=' + divTempID + '&rnd=' + Math.floor(Math.random() * 1000000);
            funcVariable = function() {
                display_ARM()();
				show_dhtml_popup('delete');
                if (divTempID) {
                 //   closeMessagePopup(divTempID);
                }
            };
            request = GetXmlHttpObject();
            request.onreadystatechange = function() {
                onload_start_func();
            };
            request.open("POST", url, true);
            request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf8");
            request.send(params);
        }
        else {
            actionUnlock();
        }
    }
}
function show_rep() {
    document.getElementById('rep1').style.display = '';
    document.getElementById('replay').style.display = 'none';
}
function blocked() {
    display_system(u_blocked);
}
function generate_request(data) {
    req = data[0][0] + '=' + encodeURIComponent(data[0][1]);
    for (var i = 1; i < data.length; i++) {
        req += '&' + data[i][0] + '=' + encodeURIComponent(data[i][1]);
    }
    return req;
}
function lockElements(aEl) {
    for (var i = 0; i < aEl.length; i++) {
        aEl[i].readOnly = true;
    }
}
function unlockElements(aEl) {
    for (var i = 0; i < aEl.length; i++) {
        aEl[i].readOnly = false;
    }
}
function join_result() {
    if (!actionLock()) {
        return false;
    }
    var data = new Array();
    var elements = document.getElementById('authform').getElementsByTagName('input');
    lockElements(elements);
    for (var i = 0; i < elements.length; i++) {
        if (elements[i].type == 'radio') {
            if (elements[i].checked) {
                data.push(Array(elements[i].name, elements[i].value));
            }
        } else if (elements[i].type != 'image') {
            data.push(Array(elements[i].name, elements[i].value));
        }
    }
    elements = document.getElementById('authform').getElementsByTagName('select');
    lockElements(elements);
    for (var i = 0; i < elements.length; i++) {
        data.push(Array(elements[i].name, elements[i].value));
    }
    var request = GetXmlHttpObject();
    var req_param = generate_request(data);
    var url = "/join.php?" + req_param;
    document.getElementById('popup_error').style.display = 'none';
    request.onreadystatechange = function() {
        if (request.readyState == 4 || request.status == 200) {
            xml = request.responseXML;
            var elements = parceXML(xml, "\error");
            if (elements[0][0] != '0') {
                document.getElementById('info').style.display = 'none';
                display_popup_error(elements[0][0]);
                unlockElements(document.getElementById('authform').getElementsByTagName('input'));
                unlockElements(document.getElementById('authform').getElementsByTagName('select'));
                actionUnlock();
                return false;
            } else {
                actionUnlock();
                window.location.href = "/my_account.php";
                return true;
            }
        }
    }
    request.open("GET", url, true);
    request.send(null);
    var xml;
}
request = GetXmlHttpObject();
request1 = GetXmlHttpObject();
request2 = GetXmlHttpObject();

function set_c_number() {
    document.getElementById('profile_panel_number').innerHTML = document.getElementById('total').innerHTML;
}
function show_reviews(member_id, type, page) {
    var request_reviews = GetXmlHttpObject();
	if(page || false) {
		iPage = "&page="+page;
	}else {
		iPage ='';
	}
	if(type || false) {
		var url = 'ajax_list_reviews.php?id=' + member_id + iPage +'&type='+type+ '&rnd=' + Math.floor(Math.random() * 1000000);
	} else {
		var url = 'ajax_list_reviews.php?id=' + member_id + iPage + '&rnd=' + Math.floor(Math.random() * 1000000);
	}
	
    divname = 'reviews_all';
    request_reviews.onreadystatechange = function() {
        load_to_div(request_reviews);
        if ((request_reviews.readyState == 4)) {
            setPanelHeader();
        }
    };
    request_reviews.open("GET", url, true);
    request_reviews.send(null);
}



function show_more_rev(index, varline ) {
    document.getElementById('more' + index).style.display = '';
    document.getElementById('less' + index).style.display = 'none';
	if(varline||false) {
		varlineEvents();
	}
}

function hide_more_rev(index, varline) {
    document.getElementById('more' + index).style.display = 'none';
    document.getElementById('less' + index).style.display = '';
	if(varline||false) {
		varlineEvents();
	}
}

function varlineEvents() {
	var rightPanelHeight = document.getElementById('rightEvents').offsetHeight;
	if(leftDivHeight < (rightPanelHeight - 34) ) {
		gid('leftCats').style.height = rightPanelHeight - 34 +'px';
	} else if (gid('leftCats').offsetHeight > leftDivHeight && (rightPanelHeight - 34) > gid('leftCats').offsetHeight) {
		gid('leftCats').style.height = rightPanelHeight - 34 +'px';
	}
	else {
		gid('leftCats').style.height = leftDivHeight+ 'px';
	}
}

function funUline(obj) {
    if (obj.className != 'arial12blue_member_ac') {
        obj.className = 'uline';
    }
}
function funNoUline(obj) {
    if (obj.className != 'arial12blue_member_ac') {
        obj.className = 'nouline';
    }
}
function mystuff_history(action, div_template) {
    if (actionLock()) {
        request_mystf_his = GetXmlHttpObject();
        var url = '/ajax_mystuff_history.php?history=' + action + '&div_template=' + div_template + '&rnd=' + Math.floor(Math.random() * 1000000);
        divname = 'my_stuff_ui_history';
        if (div_template||false) {
            request_mystf_his.onreadystatechange = function() {
                load_to_div(request_mystf_his);
                addHovers();
            };
        } else {
            request_mystf_his.onreadystatechange = function() {
                load_to_div(request_mystf_his);
            };
        }
        request_mystf_his.open("GET", url, true);
        request_mystf_his.send(null);
    }
}
function getCountDaysInMonth(iMonth, iYear) {
    oDate = new Date(iYear || 2008, iMonth, 0);
    return oDate.getDate();
}
function setDaysList(iMonth, select_id, selected) {
    var iDay = document.getElementById(select_id).value;
    var iYear = document.getElementById('b_year').value == '---' ? 2007 : document.getElementById('b_year').value;
    iYear = iYear == '---' ? 2007 : iYear;
    var iCountDays = getCountDaysInMonth(1 * iMonth + 1, iYear);
    removeOptions(document.getElementById(select_id));
    addOption(select_id, '---', '------', false);
    if (iMonth != '---') {
        for (var i = 1; i <= iCountDays; i++) {
            sel = (i == iDay) ? true: false;
            addOption(select_id, i, i, sel);
        }
    }
}
function open_upload_photo(album) {
	  if (album || false) {
        if (album == 'profile') {
            var upload_window = window.open("/upload/html/upload_photos.php?rec_type=profile", "", "width=574,height=436,status=no");
        } else {
            var upload_window = window.open("/upload/html/upload_photos.php?rec_type=album&rec_id=" + album, "", "width=574,height=436,status=no");
        }
    }
    else {
        var upload_window = window.open("upload_album_image.php", "", "width=565px,height=180px,status=no");
    }
}
function inappropriate_profile() {
    if (document.getElementById('comment').value != '') {
        display_ARM()();
        show_dhtml_popup('delete');
    }
    else {
        document.getElementById('error_message').style.display = '';
    }
}
function setCheckedValue(radioObj, newValue) {
    if (!radioObj) return;
    var radioLength = radioObj.length;
    if (radioLength === undefined) {
        radioObj.checked = (radioObj.value == newValue.toString());
        return;
    }
    for (var i = 0; i < radioLength; i++) {
        radioObj[i].checked = false;
        if (radioObj[i].value == newValue.toString()) {
            radioObj[i].checked = true;
        }
    }
}
function gid(id) {
    return document.getElementById(id);
}
var dragPrevent = new Object();
dragPrevent.buffer = new Array();
dragPrevent.InputElements = new Array();
dragPrevent.preparation = function() {
    var content = gid("dhtml_popup");
    var aImages = content.getElementsByTagName("img");
    for (var i = 0, length = aImages.length; i < length; i++) {
        aImages[i].onmousedown = this.startDrag;
    }
    var aInputs = content.getElementsByTagName("input");
    var aTAinputs = content.getElementsByTagName("textarea");
    if (aTAinputs.length && aInputs.length) {
        for (var i = 0, length = aTAinputs.length; i < length; i++) {
            this.InputElements.push(aTAinputs[i]);
        }
        for (var i = 0, length = aInputs.length; i < length; i++) {
            this.InputElements.push(aInputs[i]);
        }
    } else if (aTAinputs.length) {
        this.InputElements = aTAinputs;
    } else if (aInputs.length) {
        this.InputElements = aInputs;
    }
};
dragPrevent.startDrag = function() {
    for (var i = 0, length = dragPrevent.InputElements.length; i < length; i++) {
        dragPrevent.buffer[i] = dragPrevent.InputElements[i].value;
        dragPrevent.InputElements[i].onmouseover = function() {
            for (var j = 0, length = dragPrevent.InputElements.length; j < length; j++) {
                if (this == dragPrevent.InputElements[j]) {
                    break;
                }
            }
            if (dragPrevent.buffer[j] != this.value) {
                this.value = dragPrevent.buffer[j];
            }
            this.onmouseover = null;
        };
    }
};
dragPrevent.freeDrag = function() {
    this.buffer = new Array();
    this.InputElements = new Array();
};
function lockSelects() {
    var aSelects = document.getElementsByTagName('select');
    for (var i = 0; i < aSelects.length; i++) {
        aSelects[i].style.visibility = 'hidden';
    }
    if (gid("dhtml_popup")) {
        var contrSelects = gid("dhtml_popup").getElementsByTagName('select');
        for (var i = 0; i < contrSelects.length; i++) {
            contrSelects[i].style.visibility = 'visible';
        }
    }
}
function freeSelects() {
    var aSelects = document.getElementsByTagName('select');
    for (var i = 0; i < aSelects.length; i++) {
        aSelects[i].style.visibility = 'visible';
    }
}
function getLeftTop(obj) {
    var iTop = 0;
    var iLeft = 0;
    if (obj.offsetParent) {
        iLeft = obj.offsetLeft;
        iTop = obj.offsetTop;
        while (obj = obj.offsetParent) {
            iLeft += obj.offsetLeft;
            iTop += obj.offsetTop;
        }
    }
    return Array(iLeft, iTop);
}
function autofocus(field, limit, next) {
    if (field.value.length == limit) {
        gid(next).focus();
    }
}
oLoading = function(width, height, oContainer) {
    this.container = oContainer;
    this.mainDiv = document.createElement('div');
    this.mainDiv.setAttribute('id', 'loadingDiv');
    this.mainDiv.style.zIndex = 1000;
    var image = document.createElement('img');
    image.setAttribute('id', 'loadingImage');
    image.src = '/images/icons/general/loading.gif';
    var contDiv = document.createElement('div');
    contDiv.align = "right";
    contDiv.style.marginTop = height > 400 ? '300px': Math.floor(height / 2) - 15 + 'px';
	
    contDiv.style.marginLeft = Math.floor((width - 185) / 2) + 'px';
    var span = document.createElement('span');
    span.setAttribute('id', 'loadingText');
    span.style.lineHeight = "30px";
    span.style.fontWeight = "bold";
    span.style.fontSize = "14px";
    span.style.color = "#1334cd";
    var sTextNode = document.createTextNode('Loading... Please wait.');
    contDiv.appendChild(image);
    span.appendChild(sTextNode);
    contDiv.appendChild(span);
    this.mainDiv.appendChild(contDiv);
    this.mainDiv.style.width = width + 'px';
    this.mainDiv.style.height = height + 'px';
    this.mainDiv.style.display = 'block';
    this.mainDiv.style.position = 'absolute';
    var curleft = 0;
    var curtop = 0;
	if(oContainer.id!="forconloaderB" && oContainer.id!="forcityloaderB" && oContainer.id!="forconloader"){
	/*if (oContainer.offsetParent) {
        curleft = oContainer.offsetLeft;
        curtop = oContainer.offsetTop;
		
        while (oContainer = oContainer.offsetParent) {
            curleft += oContainer.offsetLeft;
            curtop += oContainer.offsetTop;
        }
    }*/
	//alert(curtop);
    //this.mainDiv.style.left = curleft + 'px';list_markers
	var contID = this.container.id ;
	this.mainDiv.style.left = $('#'+contID).position().left + 'px';
    this.mainDiv.style.top = $('#'+contID).position().top + 'px';
	}
/*	if(oContainer.id =="forcityloaderB" ){
		this.mainDiv.style.top = curtop + 'px';
	}*/
	//alert(this.mainDiv.style.position);
    this.display = function() {
		this.container.appendChild(this.mainDiv);
    };
    this.hide = function() {};
};
function loadingStart(id, hide) {
	var dis ="";
    lockSelects();
    oContent = gid(id);
    var height = oContent.scrollHeight;
	
    var width = oContent.scrollWidth;
	
    if (height == 0) {
        if (id == "events_list") {
            //setTimeout("loadingStart(divname)", 2000);
			gid("events_list").style.height="200px";
			gid("events_list").style.width="740px";
			width = "740";
			height = "200";
        }
        if (id == "forcityloaderB") {
            //setTimeout("loadingStart(divname)", 2000);
			gid("forcityloaderB").style.height="252px";
			gid("forcityloaderB").style.width="604px";
			width = "604";
			height = "252";
			dis = "Yes";
        }
        if (id == "search_result") {
            //setTimeout("loadingStart(divname)", 2000);
			gid("search_result").style.height="252px";
			gid("search_result").style.width="882px";
			width = "882";
			height = "252";
			dis = "Yes";
        }
		if(id=="TGcat1" ||id=="TGcat2"||id=="TGcat3"||id=="TGcat4"||id=="TGcat5"||id=="TGcat6"||id=="TGcat7"){
			gid(id).style.height="252px";
			gid(id).style.width="918px";
			width = "882";
			height = "252";
			dis = "Yes";
		}
    }
    var load = new oLoading(width, height, oContent);
    if (hide) {
        load.hide();
    }
	
    if (oContent.scrollHeight != 0 || dis == "Yes") {
        if (!document.getElementById('loadingDiv')) {
			load.display();
        }
    }
	
}
function changeLocationHovers() {
    var curid = null;
    $("div.cty_result_des").hover(function() {
        curid = "div#" + this.id;
        curid1 = curid + "k";
        $(curid).css("background", "#e0edf6");
        $(curid1).css("visibility", "visible");
    },
    function() {
        $(curid).css("background", "#FFFFFF");
        $(curid1).css("visibility", "hidden");
    });
}
function send_passwd(divID) {
    var xz = document.getElementById('femail').value;
    show_dhtml_popup('delete');
    if (divID || false) {
        setTimeout("show_ajax_popup('/ajax_send_password.php?div=yes&email=" + xz + "')", 1000);
    } else {
        setTimeout("show_ajax_popup('/ajax_send_password.php?email=" + xz + "')", 1000);
    }
}
function funUlineEb(obj) {
    if (obj.className != 'page_active_eb') {
        obj.className = 'uline_eb';
    }
}
function funNoUlineEb(obj) {
    if (obj.className != 'page_active_eb') {
        obj.className = 'nouline_eb';
    }
}

// COMMON FUNCTIONS FOR THE COMMENTS,COMPLIMENTS, FRIENDS AND ETC
function set_profile_number()
{
	document.getElementById('profile_panel_number').innerHTML=document.getElementById('total').innerHTML;	
}

function set_profile_panel_number(number)
{
	number = (number||false) ? number : document.getElementById('total').innerHTML;
	document.getElementById('profile_panel_number').innerHTML = number;
}

function cancelBubble(e) {
	
	if(e.stopPropagation) {e.stopPropagation();} else {e.cancelBubble = true;}
}

/*
//Changed JQUERY to JAVASCRIPT function changeHomeLocation() by Jayalakshmi K
$(document).ready(function() {
		$("a#change_location").click(function(){
			chLocByJquery();
	    });
		$("img#chlocImg").click(function(){
			chLocByJquery();
	    });
});
*/
function changeHomeLocation()
{
	chLocByJquery();
}
function chLocByJquery() {
	if (!hl_lock) {
        hl_lock = true;
		var obj = gid('change_location');
        var body_obj = document.getElementsByTagName("body").item(0);
        var content_obj = document.createElement('DIV');
        content_obj.setAttribute("id", "find_city");
        content_obj.style.display = '';
        content_obj.style.left = getposOffset(obj, 'left') - 110 + "px";
        content_obj.style.top = getposOffset(obj, 'top') + obj.scrollHeight + 5 + "px";
        content_obj.style.position = 'absolute';
        content_obj.style.zIndex = 102;
        body_obj.appendChild(content_obj);
        var url = "/ajax_location_find_city_div.php";
        request = GetXmlHttpObject();
        request.open("GET", url, false);
        request.send(null);
        if (parse_ajax_response(request.responseText)) {
            var find_city_html = request.responseText;
            content_obj.innerHTML = find_city_html;
		   $("div#match7").css("display","block");
		   document.getElementById('finded_cities').innerHTML= document.getElementById('match1').innerHTML;
		    $("div#finded_cities").css("display","block");
            if (navigator.appName.charAt(0) == "M") {
                create_frame(content_obj, 'create', 100, 5, 2);
            }
        }
	}
}

