﻿//var TimeOut = 100;//iframe refresh time


function SetCwinHeight(){
    try {
        $("iframe").each(function(){
            var contentHeight = this.contentDocument ? this.contentDocument.body.scrollHeight + 50 : this.Document.body.offsetHeight + 50;
            
            $(this).css("height", contentHeight + "px");
        });
    } 
    catch (e) {
    }
}


function CheckLen(obj, span, TotalCount){
    var currentCount = $(obj).val().length;
    if (currentCount > TotalCount) {
        $(obj).val($(obj).val().substring(0, TotalCount));
        $(span).text("0");
    }
    else {
        $(span).text(TotalCount - currentCount);
    }
}

function setSpan(obj, span, TotalCount){
    $(span).text(TotalCount - $(obj).val().length);
}

function IconInit(){
    var iconList = [["bgimg4", "bgimg5"], ["icon8", "icon8_1"]];
    $(document).ready(function(){
        for (var i = 0; i < iconList.length; i++) {
            $("." + iconList[i][0]).click(function(){
                $(this).removeClass(iconList[i][0]);
                $(this).addClass(iconList[i][1]);
            });
            $("." + iconList[i][1]).click(function(){
                $(this).removeClass(iconList[i][1]);
                $(this).addClass(iconList[i][0]);
            })
        }
    });
}
