  // ===================================================
function ShowDiv(Div_ID,State) {

 var Div_Obj = document.getElementById(Div_ID)


   if (State == true) {
		document.getElementById('div0').style.display = 'none';		
 		document.getElementById('div1').style.display = 'none';		
 		document.getElementById('div2').style.display = 'none';		
 		document.getElementById('div3').style.display = 'none';		
		document.getElementById('div4').style.display = 'none';		

	   Div_Obj .style.display = 'block';
   }
        else {
      Div_Obj.style.display = 'none';
   }
 
  
}



$(document).ready(function () {
    var $div1 = $('#div1');
    var $div2 = $('#div2');
    var $div3 = $('#div3');
    var $div4 = $('#div4');
    var height1 = $div1.height();
    $div1.hide().css({ height : 0 });
    var height2 = $div2.height();
    $div2.hide().css({ height : 0 });
    var height3 = $div3.height();
    $div3.hide().css({ height : 0 });
    var height4 = $div4.height();
    $div4.hide().css({ height : 0 });

    $('#show1').click(function () {
        if ($div1.is(':visible')) {
            $div1.animate({ height: 0 }, { duration: 500, complete: function () {
                $div1.hide();
            } });
        } else {
		
			if ($div2.is(':visible')) {
				$div2.animate({ height: 0 }, { duration: 500, complete: function () {
					$div2.hide();
				} });
			}
			if ($div3.is(':visible')) {
				$div3.animate({ height: 0 }, { duration: 500, complete: function () {
					$div3.hide();
				} });
			}
			if ($div4.is(':visible')) {
				$div4.animate({ height: 0 }, { duration: 500, complete: function () {
					$div4.hide();
				} });
			}

				$div1.show().animate({ height : height1 }, { duration: 500 });
        }
        
        return false;
    });
	
	
	
	
    $('#show2').click(function () {
        if ($div2.is(':visible')) {
            $div2.animate({ height: 0 }, { duration: 500, complete: function () {
                $div2.hide();
            } });
        } else {
			if ($div1.is(':visible')) {
				$div1.animate({ height: 0 }, { duration: 500, complete: function () {
					$div1.hide();
				} });
			}
			if ($div3.is(':visible')) {
				$div3.animate({ height: 0 }, { duration: 500, complete: function () {
					$div3.hide();
				} });
			}
			if ($div4.is(':visible')) {
				$div4.animate({ height: 0 }, { duration: 500, complete: function () {
					$div4.hide();
				} });
			}
            $div2.show().animate({ height : height2 }, { duration: 500 });
        }
        
        return false;
    });
	
    $('#show3').click(function () {
        if ($div3.is(':visible')) {
            $div3.animate({ height: 0 }, { duration: 500, complete: function () {
                $div3.hide();
            } });
        } else {
			if ($div2.is(':visible')) {
				$div2.animate({ height: 0 }, { duration: 500, complete: function () {
					$div2.hide();
				} });
			}
			if ($div1.is(':visible')) {
				$div1.animate({ height: 0 }, { duration: 500, complete: function () {
					$div1.hide();
				} });
			}
			if ($div4.is(':visible')) {
				$div4.animate({ height: 0 }, { duration: 500, complete: function () {
					$div4.hide();
				} });
			}
            $div3.show().animate({ height : height3 }, { duration: 500 });
        }
        
        return false;
    });
	
    $('#show4').click(function () {
        if ($div4.is(':visible')) {
            $div4.animate({ height: 0 }, { duration: 500, complete: function () {
                $div4.hide();
            } });
        } else {
			if ($div2.is(':visible')) {
				$div2.animate({ height: 0 }, { duration: 500, complete: function () {
					$div2.hide();
				} });
			}
			if ($div3.is(':visible')) {
				$div3.animate({ height: 0 }, { duration: 500, complete: function () {
					$div3.hide();
				} });
			}
			if ($div1.is(':visible')) {
				$div1.animate({ height: 0 }, { duration: 500, complete: function () {
					$div1.hide();
				} });
			}
            $div4.show().animate({ height : height4 }, { duration: 500 });
        }
        
        return false;
    });
	
	
	
	
	
	
	
});

function clear_and_focus() {
	document.getElementById('chat_msg').focus();
	document.getElementById('chat_form').submit();
	document.getElementById('chat_msg').value = '';	
}

function sF(s)
{
	// document.forms.chat_form.elements.msubmit.value=" ...";
	// document.forms.chat_form.elements.msubmit.disabled="true";
	if (s) document.forms.chat_form.submit();
}

function ctrlenter(k)
{
	if (k)
	{
		ctrl=k.ctrlKey;
		k=k.which;
	}
	else
	{
		k=event.keyCode;
		ctrl=event.ctrlKey;
	}
	
	if ((k==13 && ctrl) || (k==10)) sF(true);
}