function showTweetLoading(div, loaderClass) {
    if (!loaderClass)
        loaderClass = 'loader';
    div.addClass('loading');
    var loader = div.find("." + loaderClass);
    loader.css('width', div.css('width'));
    loader.css('height', div.css('height'));
}

function showTweetLoaded(response, div) {
    div.removeClass('loading');
    div.parents('.tweet-container').html(response);
}

function make_post() {
    var f = $("#dialog");
    
    var sex = f.find("#sex").val();
    var hair = f.find("#hair").val();
    var location = f.find("#location").val();
    var tweet = f.find("#tweet").val() + tweet_suffix();
    
    $("#dialog-show-post .post-display").remove();
    
    $("#dialog-show-post .box").prepend(
        '<div class=\'post-display\'><span style="color: #4444aa">At '+location+': </span>' +
        (sex == "female" ? "Female" : "Male") + ", " + hair + ". " + tweet + '</div>'
    );
    $("#dialog-show-post").dialog({
        closeOnEscape: true,
        closeText: "",
        modal: true,
        title: "<div id='dlg-title'>Preview and confirm.</div>",
        buttons: {
            "Post": function() {$(this).dialog("close");do_main_form_post();},
            "Cancel": function() {$(this).dialog("close");}
        }
    });
}

function deleteTweet(url, tweet_id) {
    var div = $("div#tweet" + tweet_id);
    showTweetLoading(div);
    $.ajax({
        url: url,
        method: "post",
        complete: function() {
            refreshTweet(tweet_id);
        }
    });
}

function refreshTweet(tweet_id) {
    div = $("div#tweet"+tweet_id);
    url = div.find('.refresh-link').val();
    $.ajax({
        url: url,
        success: function(response) {
            showTweetLoaded(response, div);
        }
    });
}

function deleteMessage(message_id,contact_key,del_all) {
    var post_data={message_id:message_id,contact_key:contact_key,del_all:del_all};
	$.post("/?page=find_message_del",post_data,function(data){
		alert(data.info);
	},"json");
}

function commentSubmit(formId) {
   var div = $("#"+formId).parents(".tweet");
   showTweetLoading(div);
   var post_link = div.find("input.post-link").val();
   var tweet_id = div.find("input.comment-tweet-id").val();
   var comment = div.find("textarea.comment-comment").val();
   var data = {
           "comment[comment]": comment,
           "comment[tweet_id]": tweet_id
       };
   var fruit = div.find("select.comment-fruit").val();
   if (fruit) {
       data["comment[fruit]"] = fruit;
   }
   $.ajax({
       url: post_link,
       method: "post",
       data: data,
       success: function(response) {
           showTweetLoaded(response, div);
       },
       error: function() {
           refreshTweet(tweet_id);
       }});
   return false;
}

function firstClickClear(obj) {
    var color = $(obj).attr('color2');
    if (color != 'black') {
        $(obj).css('color', 'black');
        $(obj).attr('color2', 'black');
        $(obj).removeClass('before-clear');
        $(obj).addClass('after-clear');
        $(obj).attr('value', '');
    }
}

function toggle(obj) {
    var elem = $('#'+obj);
    if (elem.hasClass("hidden-box")) {
		elem.slideDown(200, function() {
			window.location="#"+obj+"_textarea";
			$('#'+obj+' textarea').focus();
		});
        elem.removeClass("hidden-box");
    }
    else {
		elem.slideUp(200);
        elem.addClass("hidden-box");
    }
}

function do_ajax(url, event, act) {
    $html = null;
    
    update = function(id) {
        $("#" + id).html($html);
    }

    toggle_class = function(id, cls) {
        $("#" + id).toggleClass(cls);
    }

    got_response = function(html) {
        $html = html;
        for (var i = 0; i < act.length; ++ i) {
            eval(act[i]);
        }
    }
    
    hash = {
        url: url,
        cache: false
    };
    hash[event] = got_response;
    $.ajax(hash);
}

function show_message_box(message_to,message_to_usr,topic_id,reply_id) {
    var msgBox  = _window.Open("[id]main_send_message","私聊","width=420,height=160");
	$("#to_usr_id").val(message_to);
	$("#topic_id").val(topic_id);
	$("#reply_id").val(reply_id);  
	$("#send_messag_error").html("");
}

function ajax_form(url, form_id, success_script, success_div, failure_div, submit_button, loading_text, complete_text) {
    data = "";
    inputs = $("#" + form_id).find(".form_input");
    for (var i = 0; i < inputs.length; i++) {
        var val = inputs[i].value;
        if (data != "") data += "&";
        data += inputs[i].name + "=" + val;
    }

    hash = {
        url: url,
        type: 'POST',
        cache: false,
        data: data,
        beforeSend: function() {
            var obj = $("#" + submit_button);
            obj.html(loading_text);
            obj.attr("disabled", "true");
        },
        complete: function() {
            var obj = $("#" + submit_button);
            obj.html(complete_text);
            obj.attr("disabled", "");
        },
        success: function(data) {
            $("#" + success_div).html(data);
            eval(success_script);
        },
        error: function(request) {
            $("#" + failure_div).html(request.responseText);
        }
    };
    $.ajax(hash);
}



var f_type,s_type;
function set_tree(v_f_type,v_s_type) {
    f_type = v_f_type;
    s_type = v_s_type;
}

function change_tree_base(category, subcategory) {
    cat = $(category).val();

    // First remove all the existing categories.
    $(subcategory + " option").remove();
    $(subcategory).append("<option value=''>请选择</option>");
    if(cat>0){
		for (var i in s_type[cat]){
			sub = s_type[cat][i];
			$(subcategory).append("<option value=\"" +i+"\">" +sub);

		}
	}
}

function change_tree() {
    change_tree_base("#location_type_id", "#location_type_id_s");
}

function change_tree_filter() {
    change_tree_base("#tweet_category_filter", "#tweet_sub_category_filter");
}

function classify_location(url) {
    loc = $("input#location").val();
    $.ajax({
        url: url.replace("xyzz", loc),
        success: function(classified) {
            var cats = classified.split("::");
            $("#tweet_category").val(cats[0]);
            change_tree();
            $("#tweet_sub_category").val(cats[1]);
        }
    });
}

var lastSyncTime = null;
var lastSyncLoc = null;
function dropDownSync(url) {
    setTimeout(function() {
        var now = (new Date()).getTime();
        loc = $("input#location").val();
        if (lastSyncTime && lastSyncTime >= now - 500) return;
        if (lastSyncLoc == loc) return;
        lastSyncTime = now;
        lastSyncLoc = loc;
        $.ajax({
            url: url.replace("xyzz", loc),
            success: function(spots) {
                spots = eval(spots);
                if (spots.length == 0) {
                    $('#location-box-container').hide(200);
                    return;
                }
                html = "";
                for (var i = 0; i < spots.length; ++ i) {
                    html += "<div><a href='javascript: setLocation(\"" + spots[i][0] +
                        "\");'>" + spots[i][1] + "</a></div>";
                }
                $('#location-box-container').html(html);
                $('#location-box-container').show(200);
            }
        });
    }, 1000);
}

function setLocation(location) {
    $("input#location").val(location);
    $('#location-box-container').hide(200);
}

function mobile_add_post() {
    $('#dialog.window').slideToggle(200, function() {
        
    });
}

function expandBox(obj) {
    $(obj).css('font-size', '12px');
    $(obj).css('height', '100px');
    $(obj).parents('.tweet-frame').find('.submit-comment').show();
}

function toggle_category(cat) {
    $("#"+cat+"_list").toggle();
    html = $("#"+cat+"_link").html();
    if ($("#"+cat+"_list").is(":visible"))
        html = html.replace("[+]", "[-]");
    else
        html = html.replace("[-]", "[+]");
    $("#"+cat+"_link").html(html);
}

function user_follow_changed(url, name, value) {
    var $elem = $("#"+name.replace(":", "_").replace(" ", "_")+"_loader");
    var is_checked = ($('input[name='+name+']').is(':checked') ? "0" : "1")
    var hash = {
        url: url,
        type: 'GET',
        data: 'follow=' + name + '&value=' + value + "&is_checked=" + is_checked,
        cache: false,
        success: function() {
            $elem.hide();
        }
    };
    $.ajax(hash);
    $elem.show();
}

function user_follow_toggle(url, name, elem) {
    var value = "";
    if (elem.innerHTML == "Follow") {
        value = "on";
        elem.innerHTML = "Unfollow";
    }
    else  {
        elem.innerHTML = "Follow";
    }
    user_follow_changed(url, name, value);
}

function email_update_option_changed(url, name, value) {
    $elem = $("#"+name+"_loader");
    if (!value)
        value = ($('input[name='+name+']').is(':checked') ? "on" : "");
    hash = {
        url: url,
        type: 'GET',
        data: 'option=' + name + '&value=' + value,
        cache: false,
        success: function() {
            $elem.hide();
        }
    };
    $.ajax(hash);
    $elem.show();
}

function sms_phone_number_changed(url, name, value) {  
    $elem = $("#"+name+"_loader");
    if (!value)
    	value = $('input[name='+name+']').val();
    hash = {
        url: url,
        type: 'GET',
        data: 'option=' + name + '&value=' + value,
        cache: false,
        success: function(data) {
            $elem.hide();
	    if (data != "")
		alert ("Text '" + data + "' to " + "2242675453 to enable text messages from yuker.");
	    //	    $elem1.html(data);
        }
    };
    $.ajax(hash);
    $elem.show();
}

// copied from above 
function sms_update_option_changed(url, name, value) {
    $elem = $("#"+name+"_loader");
    if (!value)
        value = ($('input[name='+name+']').is(':checked') ? "on" : "");
    hash = {
        url: url,
        type: 'GET',
        data: 'option=' + name + '&value=' + value,
        cache: false,
        success: function() {
            $elem.hide();
        }
    };
    $.ajax(hash);
    $elem.show();
}

function edit_tweet(url, tweet_id, elem) {
    $tweet_id = tweet_id;
    $elem = elem;
    if (elem.innerHTML == "Edit") {
        $("#tweet_box_"+$tweet_id).hide();
        $("#tweet_edit_"+$tweet_id).show();
        $("#tweet_loc_edit_"+$tweet_id).show();
        $("#tweet_edit_error_"+$tweet_id).html("");
        $elem.innerHTML = "Post";
    }
    else {
        revert = function() {
            $("#tweet_edit_"+$tweet_id).hide();
            $("#tweet_loc_edit_"+$tweet_id).hide();
            $("#tweet_box_"+$tweet_id).show();
            $elem.innerHTML = "Edit";
        };
        hash = {
            url: url,
            type: 'POST',
            data: 'tweet_id=' + tweet_id + '&tweet=' + $("#tweet_edit_"+tweet_id).val() +
                "&tweet_loc=" + $("#tweet_loc_edit_"+tweet_id).val(),
            cache: false,
            success: function(data) {
                if ($.trim(data).length > 0) {
                    $("#tweet_edit_error_"+$tweet_id).html(data);
                    $("#tweet_edit_"+$tweet_id).val($("#tweet_text_"+$tweet_id).html());
                    $("#tweet_loc_edit_"+$tweet_id).val($("#tweet_loc_"+$tweet_id).html());
                }
                else {
                    $("#tweet_text_"+$tweet_id).html($("#tweet_edit_"+$tweet_id).val());
                    $("#tweet_loc_"+$tweet_id).html($("#tweet_loc_edit_"+$tweet_id).val());
                }
                revert();
            },
            error: function() {
                $("#tweet_edit_"+$tweet_id).val($("#tweet_text_"+$tweet_id).html());
                $("#tweet_loc_edit_"+$tweet_id).val($("#tweet_loc_"+$tweet_id).html());
                revert();
            }
        };
        $.ajax(hash);
    }
}

var locationReqClock = null;
function prePostLocation() {
    locationReqClock = (new Date()).getTime();
    setTimeout(function() {
        if(locationReqClock) {
            $('#location-header-popup').slideToggle(200);
        }
    }, 1000);
}

function postLocation(pos) {
    var lal_username;
    if($.stomp !== undefined){
      lal_username = $.stomp.lal_username;
    }
    hash = {
        url: '/ajax/set_location',
        data: {
            'latitude': pos.coords.latitude,
            'longitude': pos.coords.longitude,
            'accuracy': pos.coords.accuracy,
            'speed': pos.coords.speed,
            'user_ok_time': (new Date()).getTime() - locationReqClock,
            'lal_username': lal_username // this should be avaiable if chat is loaded
        }
    };
    locationReqClock = null;
    $.ajax(hash);
    // setTimeout(function() {$.ajax(hash);}, 3000);
    $('#location-header-popup').hide();
}

function hideLocationBox() {
	$('#location-header-popup').hide();
	$.ajax({url: '/ajax/hide_location_box'});
}


function send_messge_main(){
	
	var message_content=$("#message_content").val();
	
	var topic_id=$("#topic_id").val();
	var reply_id=$("#reply_id").val();
	var to_usr_id=$("#to_usr_id").val();
	if(message_content==""){
		$("#send_messag_error").html("请填写短信内容");
	}else if(message_content=="(请填写短信内容)"){
		$("#message_content").val("");
		$("#send_messag_error").html("请填写短信内容");
	}else{
		var data={};
		data.topic_id=topic_id;
		data.reply_id=reply_id;
		data.to_usr_id=to_usr_id;
		data.message_content=message_content;
		data.page="find_main_message_send";
		$.post("/index.php",data,function(data){
			_window.CloseAll();
			if (data.info == "ok") {
				$("#message_content").val("");
				$("#send_messag_error").html("");
				_window.Alert("发送消息成功", "消息提示");
			}
		},"json");
	}
}

function setCookie(name,value,times)
{
    var exp  = new Date();
    exp.setTime(exp.getTime() + times);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

function getCookie(name)
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;
}

/**
 * 消息回复
 **/
function message_reply(id){
	var contact_key=$("#contact_key_"+id).val();
	var content=$("#content_"+id).val();
	if(!contact_key || !content){
		_window.Alert("请填写回复内容", "提示");
		return false;
	}
	_window.Alert("请稍等正在回复中......", "提示");
	$.post("/?page=find_message_reply",{contact_key:contact_key,content:content},function(res){
		if (res.status == 1) {
			var s = '<div class="message-item"><div class="loader"></div> <span class="green-font">我说： </span>&nbsp;' + content + '<div class="message-options"> <div class="fl"> 2秒前 </div> <div class="fr"></div> <div class="clear"></div></div></div>';
			var t = $("#thread_" + id + " .message-item:last").after(s);
			_window.CloseAll();
			$("#content_"+id).html('');
		}
	},"json");
}

//设置选择
function showUpdateSetting(show_id,hide_id){
	$("#"+show_id).show();
	$("#"+hide_id).hide();
	$("#"+show_id+"_title").attr("class","update-content-title-on");
	$("#"+hide_id+"_title").attr("class","update-content-title-off");
}

/**
 * 获取最新的feed
 **/
function getLastestFeed() {
    ajaxSubmit("latest_feed_list_form", function (res) {
        if (res.flag == 'success') {
            res.latest_topic_id = parseInt(res.latest_topic_id);
            if (res.latest_topic_id > latest_topic_id)
            {
                $("#latest_feed_list_pannel .myhome-new-item:gt(3)").remove();
                $(res.str).prependTo("#latest_feed_list_pannel").fadeOut().fadeIn();
                latest_topic_id = res.latest_topic_id;
            }
        }
    });
}

/**
 * 第一次最新的feed
 *
 **/
function getFirstLastFeed() {
    $("#latest_feed_list_form input[name='ajax']").val("0");
    ajaxSubmit("latest_feed_list_form", function (res) {
        if (res.flag == 'success') {
            $("#latest_feed_list_form input[name='ajax']").val("1");
            res.latest_topic_id = parseInt(res.latest_topic_id);
            if (res.latest_topic_id > latest_topic_id)
            {
                $("#latest_feed_list_pannel").html(res.str);
                latest_topic_id = res.latest_topic_id;
            }
        }
    });
}

/**
 * 没有选择学校时提示选择学校
 *
 **/
function collegeSelectAlert(url) {
    var college_id = getCookie("college_id");
    if (!college_id) {
        var win = _alert("您还没有选择学校，请先选择学校");
        win.OnOK = function () {
            window.location.href = '/?page=homepage';
        };
        return;
    }
    window.location.href = url;
}
function copyText(txt,desc){
	if (window.$) {
		if ($.browser.msie) {
			var isSuc= clipboardData.setData("Text", txt);
			if(isSuc){
				_alert(desc,'提示');
			}
		} else {
			if(prompt('请按 Ctrl+C 复制到粘贴板！', txt)) _alert(desc,'提示');
		}
	}
}
function SetLikeTopic(obj){
	var topic_id=$(obj).attr("rel");
	$.post("/?page=find_set_like_topic&topic_id="+topic_id,{},function(data){
		if(data.status==1){
			$(obj).html("取消关注");
			$(obj)[0].onclick=function(){SetUnLikeTopic(obj)};
			$("#feed_like_num_"+topic_id).html( parseInt( $("#feed_like_num_"+topic_id).html() )+1);
		}
	},"json");
	

}
function SetUnLikeTopic(obj){
	var topic_id=$(obj).attr("rel");
	$.post("/?page=find_set_unlike_topic&topic_id="+topic_id,{},function(data){
		if(data.status==1){
			$(obj).html("关注");
			$(obj)[0].onclick=function(){SetLikeTopic(obj)};
			var num=parseInt( $("#feed_like_num_"+topic_id).html() )-1;
			if(num<1){
				num=0;
			}
			$("#feed_like_num_"+topic_id).html(num);		
		}	
	},"json");
}
function SetLikeReply(obj){
	var reply_id=$(obj).attr("rel");
	$.post("/?page=find_set_like_reply&reply_id="+reply_id,{},function(data){
		if(data.status==1){
			$(obj).html("取消关注");
			$(obj)[0].onclick=function(){SetUnLikeReply(obj)};
			$("#reply_like_num_"+reply_id).html( parseInt( $("#reply_like_num_"+reply_id).html() )+1);
		}
	},"json");
}

function SetUnLikeReply(obj){
	var reply_id=$(obj).attr("rel");
	$.post("/?page=find_set_unlike_reply&reply_id="+reply_id,{},function(data){
		if(data.status==1){
			$(obj).html("关注");
			$(obj)[0].onclick=function(){SetLikeReply(obj)};
			var num=parseInt( $("#reply_like_num_"+reply_id).html() )-1;
			if(num<1){
				num=0;
			}
			$("#reply_like_num_"+reply_id).html(num);			
		}	
	},"json");
}
/**
 * 显示更多动态
 */
function do_more(page_num) {
    $(".more").addClass("loading");
	var page_num = parseInt($("#page_num").val())+1;
    $("#page_num").val(page_num);
	$.ajax({
        dataType :'json',
		url: "index.php",
        data: $("#find_feed_more_form").serialize(),
		success: function(data) {
            if(data.status==1){
				$("#page_num").val(page_num);
				$(".more").removeClass("loading");
				$(".more-button").before(data.info);
			}else{
				$(".more-button").remove();
			}
        },
        error: function() {
            $(".more-button").hide();
        }
    });
}
/**
 * 发布动态
 **/
function create_feed(){
	_alert("正在提交，请稍候!");
	ajaxSubmit("create_form", create_formErrorHandler);
}

/**
 * 发布表白
 **/
function create_e_feed(){
	_alert("正在提交，请稍候!");
	ajaxSubmit("create_expression_form", create_e_formErrorHandler);
}

/**
 * 发布动态评论
 **/
function reply_feed(replyFormId){
    if ($("#" + replyFormId + " textarea").val() == '') {
        _alert("回复内容不能为空");
        return;
    }
    _alert("正在提交回复，请稍等......");
	ajaxSubmit(replyFormId, reply_formErrorHandler);
}
function show_all_reply(topic_id){
	alert("todo:显示【"+topic_id+"】的所有评论，发布需要删除缓存");
	$.get("/?page=find_feed_all_reply&topic_id="+topic_id,{},function(txt){
		$("#ccb"+topic_id).html(txt);
	});
}
function ajaxSubmitRegisterForm() {
  ajaxSubmit("register_form", regErrorHandler);
}

function ajaxSubmitLoginForm() {
  ajaxSubmit("login_form", loginErrorHandler);
}

function ajaxSubmitForgotForm() {
  ajaxSubmit("forgot_form", forgotErrorHandler);
}

function ajaxSubmitAbuseForm() {
    if ($("#abuse_form textarea[name='abuse_comment']").val() == '') {
        _alert("举报说明不能为空");
        return;
    }
    ajaxSubmit("abuse_form", abuseErrorHandler);
}


function ajaxSubmitAccountEdit() {
	ajaxSubmit("account_edit_form", accounteditErrorHandler);
}
function _alert(str) {
  var win = _window.Alert(str, "提示");
  return win;
}

/**
 * confrim 弹窗
 **/
function _confrim(str) {
  var win = _window.Confirm(str, "提示");
  return win;
}
function forgotErrorHandler(res) {
    var flag = res.flag;
	switch(flag){
    case "suc":
        str="系统已将账户信息发送至您的注册邮箱，请登录您的邮箱查看或修改。如果您未收到此邮件请检查您的垃圾信箱，如还有问题，请直接<a href=\"/?page=feedback\">反馈给客服</a>(<font color=\"#ff0000\">邮件可能会不及时，若没收到请等1-24小时后再查收，给您带来的不便请谅解！</font>)";
        break;
    case "not_same":
        str="您输入的邮件和注册邮件不符";
        break;
    case "error_email":
        str="您输入的邮件尚未在本站注册";
        break;
	}
    _alert(str);
}
function abuseErrorHandler(res) {
    var flag = res.flag;
	switch(flag){
    case "suc":
        str = "举报成功";
        break;
    case "empty":
        str="请填写举报内容和说明";
        break;
	}
    _window.CloseAll();
    _alert(str);
}
function create_formErrorHandler(res){
	var str;
	if(res.status==0){
		switch(res.info){
			case "empty_college_id":
				str="学校参数错误";
				break;
			case "err_gender":
				str="请选择性别";
				break;
			case "err_hair_type":
				str="请选择发型";
				break;
			case "err_location_text":
				str="请填写地点";
				break;
			case "err_location_type":
				str="请填写区域";
				break;
			case "err_content":
				str="请填写内容";
				break;
		}
	}else{
		str = "发布成功";
	}
    _window.CloseAll();
    var win = _alert(str);
    if (res.status != 0)
    {
        win.OnOK = function () {
            window.location = "/?page=find_feed";
        };
    }
}
function create_e_formErrorHandler(res){
	var str;
	if(res.status==0){
		switch(res.info){
			case "empty_college_id":
				str="学校参数错误";
				break;
			case "err_gender":
				str="请选择性别";
				break;
			case "err_content":
				str="请填写内容";
				break;
		}
	}else{
		str = "发布成功";
	}
    _window.CloseAll();
    var win = _alert(str);
    if (res.status != 0)
    {
        win.OnOK = function () {
            window.location = "/?page=find_feed";
        };
    }
}
function reply_formErrorHandler(res){
	var str;
	if(res.status==0){
		switch(res.info){
			case "empty_college_id":
				str = "学校参数错误";
				break;
			case "err_topic_id":
				str = "主题参数错误";
				break;
			case "err_content":
				str = "请输入回复内容";
				break;				
		}
	}else{
		$("#reply_form_"+res.topic_id+ " textarea").val("");
		if($("#ccb" + res.topic_id + " .findfeed-comment-content").length>0){
			$("#ccb" + res.topic_id + " .findfeed-comment-content:first").before(res.reply).fadeIn();
        }else{
			$("#ccb" + res.topic_id).html(res.reply);
			$("#ccb" + res.topic_id).removeClass("hidden");
		}
		toggle('cbx' + res.topic_id);
		str = "回复成功";
	}
    _window.CloseAll();
    //_alert(str);
}
/**
 * 显示举报弹窗
 */
function showAbuseBox(topic_id, reply_id, abuse_usr_id) {
    $("#abuse_form input[name='topic_id']").val(topic_id);
    $("#abuse_form input[name='reply_id']").val(reply_id);
    $("#abuse_form input[name='abuse_usr_id']").val(abuse_usr_id);
    var abuse_content = '';
    if (reply_id > 0) {
        abuse_content = $("#reply_text_" + reply_id).html();
    } else {
        abuse_content = $("#feed_text_" + topic_id).html();        
    }
    $("#abuse_form textarea[name='abuse_content']").html(abuse_content);
    $("#abuse_form_pannel .abuse-text").html(abuse_content);
    _window.CloseAll();
    var win = _window.Open("[id]abuse_form_pannel", "举报","width=410,height=300");
}
function toggle_more_college(obj){
	$(".more_college").toggle();
	if($(".more_college:visible").length>0){
		$(obj).children("img").attr("src",$(obj).children("img").attr("src").replace("down","up"));
	}else{
		$(obj).children("img").attr("src",$(obj).children("img").attr("src").replace("up","down"));
	}
}
