function InOut( elem )
{
 elem.delay()
     .fadeIn(300)
     .delay(6000)
.fadeOut(           
    function(){              
        if(elem.next().length > 0) 
           {InOut( elem.next() );} 
                         else                
                         {
                            InOut( elem.siblings(':first'));} 
                                        }          ); 
}

function strstr( haystack, needle, bool ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // *     example 1: strstr('Kevin van Zonneveld', 'van');
    // *     returns 1: 'van Zonneveld'
    // *     example 2: strstr('Kevin van Zonneveld', 'van', true);
    // *     returns 2: 'Kevin '
    var pos = 0;
    haystack += '';
    pos = haystack.indexOf( needle );
    if( pos == -1 ){
        return false;
    } else{
        if( bool ){
            return haystack.substr( 0, pos );
        } else{
            return haystack.slice( pos );
        }
    }
}

$(function(){
$('#content li').hide();
$('#ticker_table').css("display","inline");
InOut( $('#content li:first') );
});





	function sluitmenu(id){
  $("#"+id).stop().fadeTo(1, 0, function() { //Fade to 0 opactiy
      $("#"+id).hide();  //after fading, hide it
  });
	}

	function openMenu(id){
	$("#"+id).stop().fadeTo(1, 1).show(); //Find sub and fade it in
	}

	function videoReactie(pid,vid,mes,pid_video){
				$.post("/new_version/ajax/jquery/add_video_message.php?vid="+vid+"&pid="+pid+"&mes="+mes+"&pid_video="+pid_video,"" , function(theResponse){
				$("#video_respons").html(theResponse);
			}); 
			return false;
	}
	
function change_image(image,new_img){
	$("#plaats_img").attr("src", new_img);
    return false;
}
function close_nok(){
        $("#nok_close").fadeOut('1000');
        return false;
   
}   

function resize(id,height){
$("#"+id).css("height",height);
}
function close_ok(){
        $("#ok_close").fadeOut('1000');
        return false;
  
}      
                  
	function del_mes(bid){
		
		$("#ber_table"+bid).fadeOut('3000');
		$("#mijn_respons").fadeOut('3000');
				$("#mijn_respons").fadeIn('3000');
			$.post("/new_version/ajax/jquery/del_message.php?bid="+bid,"" , function(theResponse){
				$("#mijn_respons").html(theResponse);
			});     
        return false;
}  			  
function setVeldChange(veld){
var var1;
var1 = document.getElementById(""+veld+"").value;

if(var1=="%"){
document.getElementById(""+veld+"").value = "1";
}else{
document.getElementById(""+veld+"").value = "%";
}

}
function loadFile(url,div,v1,v2,v3,v4,v5,v6,v7,v8,v9) {


req = false;
var extra;
var poststr = ""+v1+"=" +  document.getElementById(""+v1+"").value +"&"+v2+"="+  document.getElementById(""+v2+"").value +"&"+v3+"="+  document.getElementById(""+v3+"").value  ;
extra = "&"+v4+"="+  document.getElementById(""+v4+"").value+"&"+v5+"="+  document.getElementById(""+v5+"").value+"&"+v6+"="+  document.getElementById(""+v6+"").value+"&"+v7+"="+  document.getElementById(""+v7+"").value;
if(v8 && v9){

poststr = ""+poststr+""+extra+"&"+v8+"="+  document.getElementById(""+v8+"").value +"&"+v9+"="+  document.getElementById(""+v9+"").value;
}else if(v8){
poststr = ""+poststr+""+extra+"&"+v8+"="+  document.getElementById(""+v8+"").value;
}else{
poststr = ""+poststr+""+extra+"";
}
			$.post("/new_version/ajax/"+url+".php?"+poststr,"" , function(theResponse){
				$("#"+div).html(theResponse);
			});     

$("#"+div).fadeIn(1000);	

}
	   function get(obj,f,v,span,ext1,ext2,ext3,ext4,ext5,ext6,ext7,ext8,ext9,ext10,ext11,ext12,ext13,ext14) {
		 var poststr = ""+v+"=" + encodeURI( document.getElementById(""+v+"").value ) ;
		 if(ext1){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+"&"+ext1+"="+ encodeURI( document.getElementById(ext1).value);}
		 if(ext1&&ext2){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value);}
		 if(ext1&&ext2&&ext3){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value);}
		 if(ext1&&ext2&&ext3&&ext4){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value);}		 
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9&&ext10){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value)+ "&"+ext10+"="+ encodeURI( document.getElementById(ext10).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9&&ext10&&ext11){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value)+ "&"+ext10+"="+ encodeURI( document.getElementById(ext10).value)+ "&"+ext11+"="+ encodeURI( document.getElementById(ext11).value);}		 		 		 
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9&&ext10&&ext11&&ext12){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value)+ "&"+ext10+"="+ encodeURI( document.getElementById(ext10).value)+ "&"+ext11+"="+ encodeURI( document.getElementById(ext11).value)+ "&"+ext12+"="+ encodeURI( document.getElementById(ext12).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9&&ext10&&ext11&&ext12&&ext13){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value)+ "&"+ext10+"="+ encodeURI( document.getElementById(ext10).value)+ "&"+ext11+"="+ encodeURI( document.getElementById(ext12).value)+ "&"+ext12+"="+ encodeURI( document.getElementById(ext12).value)+ "&"+ext13+"="+ encodeURI( document.getElementById(ext13).value);}
		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9&&ext10&&ext11&&ext12&&ext13&&ext14){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value)+ "&"+ext10+"="+ encodeURI( document.getElementById(ext10).value)+ "&"+ext11+"="+ encodeURI( document.getElementById(ext12).value)+ "&"+ext12+"="+ encodeURI( document.getElementById(ext12).value)+ "&"+ext13+"="+ encodeURI( document.getElementById(ext13).value)+ "&"+ext14+"="+ encodeURI( document.getElementById(ext14).value);}

		 if(ext1&&ext2&&ext3&&ext4&&ext5&&ext6&&ext7&&ext8&&ext9&&ext10&&ext11&&ext12&&ext13&&ext14){poststr=""+v+"=" + encodeURI( document.getElementById(""+v+"").value )+ "&"+ext1+"="+ encodeURI( document.getElementById(ext1).value)+ "&"+ext2+"="+ encodeURI( document.getElementById(ext2).value)+ "&"+ext3+"="+ encodeURI( document.getElementById(ext3).value)+ "&"+ext4+"="+ encodeURI( document.getElementById(ext4).value)+ "&"+ext5+"="+ encodeURI( document.getElementById(ext5).value)+ "&"+ext6+"="+ encodeURI( document.getElementById(ext6).value)+ "&"+ext7+"="+ encodeURI( document.getElementById(ext7).value)+ "&"+ext8+"="+ encodeURI( document.getElementById(ext8).value)+ "&"+ext9+"="+ encodeURI( document.getElementById(ext9).value)+ "&"+ext10+"="+ encodeURI( document.getElementById(ext10).value)+ "&"+ext11+"="+ encodeURI( document.getElementById(ext12).value)+ "&"+ext12+"="+ encodeURI( document.getElementById(ext12).value)+ "&"+ext13+"="+ encodeURI( document.getElementById(ext13).value)+ "&"+ext14+"="+ encodeURI( document.getElementById(ext14).value)+ "&"+ext15+"="+ encodeURI( document.getElementById(ext15).value);}
			$.post("/ajax/"+f+".php?"+poststr,"" , function(theResponse){
				$("#"+span).html(theResponse);
			});    
	   }
	   
checked=false;
function checkedAll(frm1) {
	var aa= document.getElementById('frm1');
	 if (checked == false)
          {
           checked = true
          }
        else
          {
          checked = false
          }
	for (var i =0; i < aa.elements.length; i++) 
	{
	 aa.elements[i].checked = checked;
	}
      }

	
       function setVeld(veld,cijfer){
			 
$("#"+veld).val(cijfer);
			 document.getElementById(""+veld+"").value = cijfer;
			
			 }
         function setVeld2(veld,cijfer){document.getElementById(""+veld+"").value += cijfer;}
	function addtext(veld, ubb) { plaats.bericht_X.value += ubb;  }
function addtext7(veld, ubb) { plaats.bericht_X.value = ubb;  }	
	function addtext2(veld, ubb) { document.smiles2.elements[veld].value += ubb;  }
	function addtext3(veld, ubb) { document.smiles3.elements[veld].value += ubb;  }
       function addcolor(ubb) { document.plaats.bericht_X.value += ubb;  }









function open_chat(){
		

			if ($("#chat_friends").is(':visible')) {  
				

				$("#chat_friends").hide();
				$.post("/new_version/ajax/jquery/chat/chat_main_close.php","" , function(theResponse){
				$("#chat_friends").html(theResponse);
			});     

			
			}else{ 
				$("#chat_friends").show();
				$.post("/new_version/ajax/jquery/chat/chat.php","" , function(theResponse){
				$("#chat_friends").html(theResponse);
			});     
			
		}	
			return false;
}



function chat_status(){
		

			  
				

				$("#chat_o").hide();
				$.post("/new_version/ajax/jquery/chat/set_status.php","" , function(theResponse){
				$("#chat_o").html(theResponse);
			});     
				$("#chat_o").fadeIn();
			

			return false;
}




function stop_ani(bid){
				

}



function ani_on(bid){
$("#min_max"+bid).animate({opacity: "0.4"}, "slow");
$("#min_max"+bid).animate({opacity: "1"}, "slow");


$("#min_max"+bid).animate({opacity: "0.4"}, "slow");
$("#min_max"+bid).animate({opacity: "1"}, "slow");


$("#min_max"+bid).animate({opacity: "0.4"}, "slow");
$("#min_max"+bid).animate({opacity: "1"}, "slow");




}



function setPos(bid){
	var position = $("#chat_boven"+bid).offset(); 
	
				$.post("/new_version/ajax/jquery/chat/chat_pos.php?chatter="+bid+"&left="+position.left+"&top="+position.top,"" , function(theResponse){
				$("#test_div").append(theResponse);
				});     

				
	
	
}
function open_chat_window(naam,bid,mini,new_window,pos_top,pos_left,ges){

var ul = document.getElementById('sort_list');
var n=ul.getElementsByTagName('li').length;


	//alert("open new window"+naam+""+bid+"");
	if(!$("#sort_list:contains('"+naam+"')").length) {

	
	if(n>3){
	
	}else{
	if(ges=="Vrouw"){
	clas="babe";
	clas2="pro_forum_v";
	clas3="top_chat_over_v";
	}else{
	clas="dude";
	clas2="pro_forum_m";
	clas3="top_chat_over_m";
	
	}	
	if(new_window==1){
	$("#sort_list").append("<li id=sort_list_"+bid+" class=left><div onmouseup=setPos("+bid+"); class=chat_boven id=chat_boven"+bid+"><table cellpadding=0 cellspacing=0 width=100%><tr><td class="+clas2+" align=center width=70%><b><a class="+clas+" href=/"+naam+">"+naam+"</a></b></td><td id=m"+bid+" onclick=min_max_chat('"+bid+"'); class=top_chat onmouseout=changeClass('m"+bid+"','top_chat'); onmouseover=changeClass('m"+bid+"','"+clas3+"');>-</td><td id=c"+bid+" class=top_chat onmouseout=changeClass('c"+bid+"','top_chat'); onclick=close_chat("+bid+"); onmouseover=changeClass('c"+bid+"','"+clas3+"');>x</td></tr></table></div><div  onclick=min_max_chat("+bid+"); class=name_chatter id=min_max"+bid+"><center>"+naam+"</center></div></li>"); 	
	
				$.post("/new_version/ajax/jquery/chat/open_chat_window.php?chatter="+bid+"&new_window","" , function(theResponse){
				$("#chat_boven"+bid).append(theResponse);
				});     
				
	}else{
	$("#sort_list").append("<li id=sort_list_"+bid+" class=left><div onmouseup=setPos("+bid+"); class=chat_boven id=chat_boven"+bid+"><table cellpadding=0 cellspacing=0 width=100%><tr><td class="+clas2+" align=center width=70%><b><a class="+clas+" href=/"+naam+">"+naam+"</a></b></td><td id=m"+bid+" onclick=min_max_chat('"+bid+"'); class=top_chat onmouseout=changeClass('m"+bid+"','top_chat'); onmouseover=changeClass('m"+bid+"','"+clas3+"');>-</td><td id=c"+bid+" class=top_chat onmouseout=changeClass('c"+bid+"','top_chat'); onclick=close_chat("+bid+"); onmouseover=changeClass('c"+bid+"','"+clas3+"');>x</td></tr></table></div><div  onclick=min_max_chat("+bid+"); class=name_chatter id=min_max"+bid+"><center>"+naam+"</center></div></li>"); 	
	
				$.post("/new_version/ajax/jquery/chat/open_chat_window.php?chatter="+bid,"" , function(theResponse){
				$("#chat_boven"+bid).append(theResponse);
				});     
				
				}
	}
	}
	if(mini==1){
	$("#chat_boven"+bid).hide();
	}
	if(ges=="Vrouw"){
	$("#sort_list_"+bid).removeClass();
	$("#sort_list_"+bid).addClass('chat_v');
	}else{
	$("#sort_list_"+bid).removeClass();
	$("#sort_list_"+bid).addClass('chat_m');	
	}
	$(function() {
		$("#chat_boven"+bid).draggable({ opacity: 0.6, cursor: 'move', update: function() {
			var order = $(this).draggable("serialize") + '&action=updateRecordsListings'; 
			$.post("/new_version/ajax/jquery/chat/sort_chat.php", order, function(theResponse){
				$("#test_div").html(theResponse);
			}); 															 
		}								  
		});
	});
	
	
//$("#chat_boven"+bid).dialog();




	if(pos_left==0 && pos_top==0){
				$.post("/new_version/ajax/jquery/chat/chat_pos.php?chatter="+bid+"&left=0&top=0","" , function(theResponse){
				$("#test_div").append(theResponse);
				});     	
	}else{
	h = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight);
	h = h - 242;
	
pos_top = h - pos_top;
	
	
	pos_left = pos_left -225;
	$("#chat_boven"+bid).removeClass();
	$("#chat_boven"+bid).addClass('chat_boven_after');
	

	$("#chat_boven"+bid).css("bottom",pos_top);
	$("#chat_boven"+bid).css("left",pos_left);



	/*
        $("#chat_boven"+bid).css(
		{ 
		position: "absolute",   
		
		marginLeft: 0, 
		marginTop: 0,            
		top: pos_top, 
		left: pos_left 
		}
		);	

	*/
	
	}	
	

width = 200 * n + 30;

$("#chat_boven"+bid).fadeIn('slow',function(){   
$(this).animate({'right': '+='+width+'px'},'slow'); 
}); 
	
	setInterval(function(){  refreshChat(bid);  }, 7000); 	
	$(function() {
		$("#chat_boven"+bid).resizable();
	});

			
	return false;
}

  $(document).ready(function(){ 
	
	$(function() {
		$("#chat_boven").draggable({ opacity: 0.6, cursor: 'move', update: function() {
			var order = $(this).draggable("serialize") + '&action=updateRecordsListings'; 
			$.post("/new_version/ajax/jquery/chat/sort_chat.php", order, function(theResponse){
				$("#test_div").html(theResponse);
			}); 															 
		}								  
		});
	});

});	

function tel2(cid,bid){

key = event.keyCode;

if(key==13){
Insertmessge(cid,bid);
}


}

function tel(cid,bid){


var KeyID = (window.event) ? event.keyCode : e.keyCode;



if(KeyID==13){
Insertmessge(cid,bid);
}

}




function refreshChat(bid){

				$.post("/new_version/ajax/jquery/chat/updater.php?chatter="+bid,"" , function(theResponse){
				$("#chat_window_"+bid).html(theResponse);
				});   
}
function Insertmessge(cid,bid){

mes = document.getElementById("chat_area"+bid+"").value;

				$.post("/new_version/ajax/jquery/chat/insert_message.php?chatter="+bid+"&cid="+cid+"&mes="+mes,"" , function(theResponse){
				$("#test_div").append(theResponse);
				});     
				
refreshChat(bid);				
document.getElementById("chat_area"+bid+"").value = '';
document.getElementById("chat_area"+bid+"").focus();
}


function close_chat(bid){



				$.post("/new_version/ajax/jquery/chat/close.php?chatter="+bid,"" , function(theResponse){
				$("#test_div").html(theResponse);
				});   
				
	$("#chat_boven"+bid).remove();
	$("#sort_list_"+bid).remove();
			
}
function min_max_chat(bid){
		if ($("#chat_boven"+bid).is(':visible')) {  
			$("#chat_boven"+bid).hide();	
			
				$.post("/new_version/ajax/jquery/chat/minimize.php?chatter="+bid,"" , function(theResponse){
				$("#test_div").html(theResponse);
				});   
				
			}else{
			$("#chat_boven"+bid).show();	

				$.post("/new_version/ajax/jquery/chat/maximize.php?chatter="+bid,"" , function(theResponse){
				$("#test_div").html(theResponse);
				});   			
		}
}



function changeClass(id,classs){
    id = document.getElementById(id);
    id.className =classs;
    
    
}


function lookup(inputString,file,div1,div2,input1,input2) {


    if(inputString.length < 0) {
        // Hide the suggestion box.
        $('#'+div1).hide();
    } else {
	
	//{ name: "John", time: "2pm" }
        $.post("/new_version/ajax/jquery/"+file+".php?queryString="+inputString+"&input1="+input1+"&input2="+input2+"&div1="+div1,"", function(data){
            if(data.length >0) {
                $('#'+div1).show();
                $('#'+div2).html(data);
            }
        });
    }
} // lookup

function fill(thisValue,thisValue2,input1,input2,div1) {
    $('#'+input1).val(thisValue);
	$('#'+input2).val(thisValue2);
   $('#'+div1).hide();
}



	
	
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=5 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=7 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" height=20 src="/i/trans.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}






function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip	   



// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 

