	var cNews_=1;
	function cNews(n){
		if(n>0 && n<4){
			for(i=1;i<4;i++){
				document.getElementById("newsCont"+i).style.display="none";
				document.getElementById("ndc"+i).className="ndc";
			}
			document.getElementById("newsCont"+n).style.display="block";
			document.getElementById("ndc"+n).className="ndc2";
			cNews_=n;
			if(newst[n]) document.getElementById("newsTitl").innerHTML=newst[n];
		}
	}
	function cNews_c(n){
		if(n==2) {if(cNews_ < 3) cNews(cNews_+1);}
		else {if(cNews_ > 1) cNews(cNews_-1);}
	
	}
	
	var cNews_2=1;
	function cNews2(n){
		if(n>0 && n<4){
			for(i=1;i<4;i++){
				document.getElementById("newsCont2"+i).style.display="none";
				document.getElementById("ndc2"+i).className="ndc";
			}
			document.getElementById("newsCont2"+n).style.display="block";
			document.getElementById("ndc2"+n).className="ndc2";
			cNews_2=n;
			if(newst2[n]) document.getElementById("newsTitl2").innerHTML=newst2[n];
		}
	}
	function cNews_c2(n){
		if(n==2) {if(cNews_2 < 3) cNews2(cNews_2+1);}
		else {if(cNews_2 > 1) cNews2(cNews_2-1);}
	
	}

function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
     var img = document.images[i]
     var imgName = img.src.toUpperCase()
     if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
        {
       var imgID = (img.id) ? "id='" + img.id + "' " : ""
       var imgClass = (img.className) ? "class='" + img.className + "' " : ""
       var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
       var imgStyle = "display:inline-block;" + img.style.cssText
       if (img.align == "left") imgStyle = "float:left;" + imgStyle
       if (img.align == "right") imgStyle = "float:right;" + imgStyle
      if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle      
       var strNewHTML = "<span " + imgID + imgClass + imgTitle
       + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
       + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
       img.outerHTML = strNewHTML
       i = i-1
        }
      }
   }
   
function checkvalidimgs(){
	if(!viewprof || viewprof==0) return;
	var o=document.getElementById('frtbl');
	if(!o) return;
	
	var element = $(o).getElementsByTagName('img');
	var l=element.length;
	if(!l) return;
	
	var allok=true;
	
	for(i=0;i<l;i++){
		if(element[i].height != 35 && element[i].src) allok=false;
	}
	
	if(!allok){ 
		
		document.body.innerHTML+='<iframe src="/index.php?m=member&p=profile&id='+viewprof+'&chacheclean=1" frameborder="0" height="1" width="1"></iframe>';
	}

}
var viewprof=0;


   function loader4534(){
	//correctPNG();
	//if(viewprof>0) checkvalidimgs();
	leftbanner_();
	rightbanner_();
	cenbanner_();
   }
//window.attachEvent("onload", loader4534); 
window.onload=loader4534;

function updateflashcontent(){
	var obj=document.getElementsByTagName("object");
	var l=obj.length;
	
	for(i=0;i<l;i++){
	try{
		obj[i].setAttribute('wmode','transparent'); //.wmode='transparent';
		obj[i].wmode='transparent';
		obj[i].innerHTML+='<param name="wmode" value="transparent">';
		}catch(e) {}
	}
	
	var obj=document.getElementsByTagName("embed");
	var l=obj.length;
	
	for(i=0;i<l;i++){
		obj[i].setAttribute('wmode','transparent'); //.wmode='transparent';
		obj[i].wmode='transparent';
		
	}
}
var i_domain="http://media.karamel4e.com/"; //"http://media.karamel4e.com/";
/*
var ctrlImg=new Image();
ctrlImg.src="http://media.karamel4e.com/media/i/comments-2_03.gif";
ctrlImg.onload=setDom;
*/
function setDom(){
	i_domain="http://media.karamel4e.com/";
}

function showFInfo(data){
	
	var j=document.getElementById("fcount_table");
	var j2=document.getElementById("fdiccont");
	


	j2.innerHTML=data;
	j.style.display="block";

document.onmousemove=fmouse2;

}

function showThumbInfo(name,pic,age,sex,city,more,rank,nastroenie,activ){
	if(!i_domain) i_domain="http://media.karamel4e.com/";
	if(!more) more='';
	if(pic=='-') pic='';
	var j=document.getElementById("t_container");
	var d='';
	j.style.border="1px dashed #000";
	j.style.width="300px";
//	j.style.height="155px";
	j.style.position="absolute";
	if(sex=="Жена") j.style.background="#f9dde2"; //"transparent url('/templates/modern/media/baloon2.png') repeat";
	else j.style.background="#cedefc"; //"url('http://media.karamel4e.com/media/n/popup.png')";//"#cedefc"; //"transparent url('/templates/modern/media/baloon.png') repeat";
	j.style.zIndex=999;
	
	d+='<table width="100%" cellpadding="4" ><tr>';
	 d+='<td valign="top" width="120" align="center">'+(rank?rank:'')+'<img src="'+i_domain+((pic != '')?'media/uploads/t_picture_'+pic:'templates/modern/media/nopicture.gif')+'" alt="" /></td>';
	d+='<td valign="top" align="left" style="font-size:10px;"><span style="font-size:14px;"><b>'+name.replace(/[\<]/g,'&#60;')+'</b></span><br /><br />';
	if(age) d+='<b>Възраст:</b> '+age+'<br />';
	if(sex) d+='<b>Пол:</b> '+sex+'<br />';
	if(city) d+='<b>Град:</b> '+city+'<br />';
	if(nastroenie) {
		nastroenie=nastroenie.split(":");
		if(nastroenie[1].length > 4) d+='<b>Настроение:</b> '+nastroenie[1].replace(/[\<]/g,'&#60;')+'<br />';
	}
	d+=more;
	d+='</td></tr>';
	
	if(activ){
		act1=activ.split(".");
		
		
							d+='<tr><td colspan="2"><table width="100%" cellspacing="3"><tr><td>Активност:</td><td align="right">'+activ+'%</td></tr><tr><td colspan="2"><table style="width:100%; height:3px;border:1px solid #525252" cellspacing="0"><td style="background:'+(act1[0]>0?'green':'white')+';width:'+act1[0]+'%;"><img src="'+i_domain+'templates/modern/media/spacer.gif" /></td><td style="background:#fff;"><img src="'+i_domain+'templates/modern/media/spacer.gif" /></td></table></td></tr></table></td></tr>';

	
	}
	
	d+='</table>';
	


	j.innerHTML=d;
	j.style.display="block";

document.onmousemove=fmouse;

}

function badwordsfilter(field){

	var badwords=new Array("driv3r","impulse.bg","limpa.bg","sofianci.com","aha.bg","elmaz.com","flirt4e.com","mucunki.com","bgstar.eu","zapoznanstwa.com","asl.bg","riva.bg","strastni.com","3aka4ka.com","amur.bg","sesile.com","kotetata.com","hot.bg","mybestmatch.net","famous.bg","gadje.bg","priateli.net","euroloveliness.com","sesile.net","bgpal.com");
	var l=badwords.length;
	field=field.toLowerCase();
	
	for(i=0;i<l;i++){
		if(field.indexOf(badwords[i]) != -1){
			alert("Вашето съобщение няма да бъде прието от системата защото съдържа непозволена дума: "+badwords[i]);
			return false;
		}	
	}
	return true;
}


function fmouse(e){
		var xcoord=10;
	var ycoord=15;
var j=document.getElementById("t_container");
	if (typeof e != "undefined"){
			xcoord += e.pageX;
			ycoord += e.pageY;
	} else if (typeof window.event != "undefined"){
			var event=window.event;
			xcoord += truebody().scrollLeft+event.clientX

			ycoord += truebody().scrollTop + event.clientY;
		
	}
	j.style.left=xcoord+"px";
	j.style.top=ycoord+"px";
	j.style.display="block";
}
function fmouse2(e){
		var xcoord=10;
	var ycoord=15;
var j=document.getElementById("fcount_table");
	if (typeof e != "undefined"){
			xcoord += e.pageX;
			ycoord += e.pageY;
	} else if (typeof window.event != "undefined"){
			var event=window.event;
			xcoord += truebody().scrollLeft+event.clientX

			ycoord += truebody().scrollTop + event.clientY;
		
	}
	j.style.left=xcoord+"px";
	j.style.top=ycoord+"px";
	j.style.display="block";
}
function hideThumbInfo(){
	document.onmousemove=null;
	var j=document.getElementById("t_container");
	j.innerHTML='';
	j.style.display="none";
}

function hideFInfo(){
	document.onmousemove=null;
	var j=document.getElementById("fcount_table");
	var j2=document.getElementById("fdiccont");
	j2.innerHTML='';
	j.style.display="none";
}

// rating
function ratingstar_toggle(content_id, score, toggle)
{
	for ( var i = 1; i <= score; i++ )
	{
		var obj = $('ratingstar'+content_id+'__'+i);
		obj.src = ( toggle == 'show' ) ? (obj.src).replace(/rate0/, 'rate1') : (obj.src).replace(/rate1/, 'rate0');
	}
}
function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function submit_rating(type, member_id, content_id, score)
{
	Ajax.request(virpath+'index.php?m=rating', {'method':'post','parameters':{'type':type,'score':score,'member_id':member_id,'content_id':content_id}, 'onComplete':function(res){
		if ( res && res[0] )
		{
			var response = res[0].split("\n");
			if ( response.length == 2 )
			{
				if ( response[0] == 'ok' && response[1] )
				{
					$('rating_'+type+'_response'+content_id).innerHTML = response[1];
					return true;
				}
			}
		}
	}});
}


// reports
function submit_report(type, member_id, content_id, noreason)
{
	var reason = $('report_'+type+'_reason'+content_id).value;
	if ( !reason ) { alert(noreason); return; }
	Ajax.request(virpath+'index.php?m=report', {'method':'post','parameters':{'type':type,'reason':reason,'member_id':member_id,'content_id':content_id}, 'onComplete':function(res){
		if ( res && res[0] )
		{
			var response = res[0].split("\n");
			if ( response.length == 2 )
			{
				if ( response[0] == 'ok' && response[1] )
				{
					$('report_'+type+'_response'+content_id).innerHTML = response[1];
					return true;
				}
			}
		}
	}});
}


// toggles
function row_toggle(name)
{
    var showRow = (browser.IE) ? "block" : "table-row";

    for (var i = 0;  document.getElementById(name+'_'+i) != null;  i++)
    {
        if (document.getElementById(name+'_'+i).style.display == "none")
            document.getElementById(name+'_'+i).style.display = showRow;
        else
            document.getElementById(name+'_'+i).style.display = "none";
    }
}

function showhide_field(name, show)
{
	var el = document.getElementById(name);
    if (el.style.display == "none"  &&  (show == '' || show == undefined)  ||  show == 1)
    {
        el.style.display = "block";
    }
    else
    {
        el.style.display = "none";
    }
}


//------------------------------------------------
// Misc
//------------------------------------------------
function confirmLink(question, url)
{
    var is_confirmed = confirm(question);

    if (is_confirmed && url != '')
        window.location = url;

    return is_confirmed;
}

function confirmForm(question, form)
{
    var is_confirmed = confirm(question);

    if (is_confirmed && form != '')
        eval('document.' + form + '.submit()');

    return is_confirmed;
}

function toggleMessages(form, check)
{
    for (var i = 0; i < form.elements.length; i++)
    {
        if (form.elements[i].type == 'checkbox')
        {
            form.elements[i].checked = check;
        }
    }
}

function stylizeBooleanBox(prefix, boxid)
{
	var options = document.getElementById(prefix + boxid);
	for ( var i = 0, length = options.length; i < length; i++ )
	{
		options[i].style.background = ( options[i].value == 1 ) ? '#DEFAE0' : '#FBDDDD';
		if ( options[i].value == 1 && options[i].selected )
			document.getElementById(prefix + boxid).style.background = '#DEFAE0';
		else if ( options[i].value == 0 && options[i].selected )
			document.getElementById(prefix + boxid).style.background = '#FBDDDD';
	}
}


//------------------------------------------------
// Chat
//------------------------------------------------
var httpReceiveChat = null;
var httpSendChat = null;
var chatwincurr = 0;
var autocheck = 0;
var autodelay = 8;
var virpath = '';
chatwins = new Array();

function checkChat(path,check,delay)
{
    virpath = path;
    autocheck = check;
    autodelay = delay;
    httpReceiveChat = getHTTPObject();
    httpSendChat = getHTTPObject();
    receiveChatText();
}

function receiveChatText() {
	if (httpReceiveChat.readyState == 4 || httpReceiveChat.readyState == 0) {
  	httpReceiveChat.open("GET",virpath+'chat.php?p=check', true);
    httpReceiveChat.onreadystatechange = handlehHttpReceiveChat;
  	httpReceiveChat.send(null);
	}
}

function handlehHttpReceiveChat() {
    if (httpReceiveChat.readyState == 4) {
        memberid = httpReceiveChat.responseText;
        if (memberid != "0") openChatWindow(memberid);
        if (autocheck) setTimeout('receiveChatText();', (autodelay*1000));
    }
}

function openChatWindow(id) {
    if (id > 0 && (typeof(chatwins['chat' + id]) != "object"  ||  chatwins['chat' + id].closed)) {
        chatwins['chat' + id] = window.open(virpath + 'index.php?m=chat&id=' + id, 'chat' + id, 'width=380,height=360,resizable=yes,scrollbars=no,toolbar=no,location=no,status=no,menubar=no');
        if ( chatwins['chat' + id] && chatwins['chat' + id].open)
        	chatwins['chat' + id].focus();
		else
			alert('Could not open a chat window. Please disable your popup blocker.');
    }
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}




function getY( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}
function getX( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

	function getElement(id){ return document.getElementById(id); }
	function putDivImgs(){
	try{
		var mainBlock=getElement('thdt');
		var maiWidth=document.all? Math.min(truebody().scrollWidth, truebody().clientWidth) : Math.min(window.innerWidth);
		var pTop=getX(mainBlock);
		var pBot=mainBlock.offsetHeight;
		var pRig=975; //mainBlock.offsetWidth;
		//alert(pTop+' '+mainBlock.style.left);
		
		var uL=getElement('z5');
		uL.style.width=(pTop)+'px';
		uL.style.display="block";
		
		uL=getElement('z6');
		uL.style.width=(maiWidth-(pTop+pRig+(document.all?0:18)))+'px';
		uL.style.left=(pTop+pRig)+'px';
		uL.style.display="block";
		
		uL=getElement('z7');
		uL.style.width=(pTop)+'px';
		uL.style.top=(pBot-308)+'px';
		uL.style.display="block";
		
		uL=getElement('z8');
		uL.style.width=(maiWidth-(pTop+pRig+(document.all?0:18)))+'px';
		uL.style.top=(pBot-308)+'px';
		uL.style.left=(pTop+pRig)+'px';
		uL.style.display="block";
	}catch(e){}
	}
	
var _leftbanner=false;
var _rightbanner=false;
function _wscroll(){
	if(_leftbanner) leftbanner_run();
	if(_rightbanner) rightbanner_run();
	putDivImgs();
}
window.onresize=_wscroll;


function cenbanner_(){
try{
	var ytop=getY(document.getElementById("_cct")); 
	var ybottom=getY(document.getElementById("_blcb"));
	var yspace=eval(ybottom-ytop);
	if(yspace > 280) {
		document.getElementById("adv_cc_").style.height=yspace-12;
		document.getElementById("adv_cc_").style.display="block";
		document.getElementById("adv_cc_").innerHTML='<br /><iframe src="/adv.php?set=300x250" frameborder="0" style="width:338px;height:282px;margin-top:4px;" ></iframe>';
	}else if(yspace > 78){
		document.getElementById("adv_cc_").style.height=yspace-12;
		document.getElementById("adv_cc_").style.display="block";
		document.getElementById("adv_cc_").innerHTML='<iframe src="/adv.php?set=468x60" frameborder="0" style="width:470px;height:62px;margin-top:4px;" ></iframe>';
	}else document.getElementById("adv_cc_").style.display="none";

}catch(e) {  } 
}
function rightbanner_(){
try{
	var ytop=getY(document.getElementById("_rct"));
	var ybottom=getY(document.getElementById("_bcb"));
	var yspace=eval(ybottom-ytop);
	if(yspace > 610) {
		document.getElementById("adv_r_f_").style.height=yspace-12;
		document.getElementById("adv_r_f_").style.display="block";
		document.getElementById("adv_r_f").innerHTML='<iframe src="/adv.php?set=120x600" frameborder="0" style="width:122px;height:602px;" ></iframe>';
		rightbanner_run();
		window.onscroll=_wscroll;
		window.onresize=_wscroll;
	}else if(yspace > 20){
		document.getElementById("adv_r_f_").style.height=yspace-12;
		document.getElementById("adv_r_f_").style.display="block";
	}else document.getElementById("adv_r_f").style.display="none";
}catch(e) {} 
}
function rightbanner_run(){
try{
	_rightbanner=true;
	var pDiv=document.getElementById("dc_7");
	var x=getX(document.getElementById("_rct"));
	var ytop=getY(document.getElementById("_rct"))+10;
	var ybottom=getY(document.getElementById("_bcb"))-10;
	var obj=document.getElementById("adv_r_f");
	var _top=ytop;
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if(truebody().scrollTop && truebody().scrollTop>docheight-(ytop-30)){
		if(truebody().scrollTop+(ytop/(docheight/15))+600 < ybottom){
			ytop=truebody().scrollTop+(ytop/(docheight/15));
		}else ytop=ybottom-604;
	}
	if(ytop<_top) ytop=_top;
	if(obj){
		pDiv.style.height= (ybottom-(getY(pDiv)+4))+'px';
		obj.style.top=ytop+"px";
		obj.style.left=(x+4)+"px";
		obj.style.display="block";
	}
	}catch(e) {} 
}
function leftbanner_(){
try{
	var ytop=getY(document.getElementById("_lct"));
	var ybottom=getY(document.getElementById("_blcb"));
	var yspace=eval(ybottom-ytop);
	
	if(yspace > 610) {
		document.getElementById("adv_l_f_").style.height=yspace-12;
		document.getElementById("adv_l_f_").style.display="block";
		document.getElementById("adv_l_f").innerHTML='<iframe src="/adv.php?set=120x600" frameborder="0" style="width:122px;height:602px;" ></iframe>';
		leftbanner_run();
		window.onscroll=_wscroll;
		window.onresize=_wscroll;
	}else if(yspace > 20){
		document.getElementById("adv_l_f_").style.height=yspace-12;
		document.getElementById("adv_l_f_").style.display="block";
	}else document.getElementById("adv_l_f").style.display="none";
}catch(e) {} 
}
function leftbanner_run(){
try{
	_leftbanner=true;
	var pDiv=document.getElementById("dc_2");
	var x=getX(document.getElementById("_lct"));
	var ytop=getY(document.getElementById("_lct"))+10;
	var ybottom=getY(document.getElementById("_blcb"))-10;
	var obj=document.getElementById("adv_l_f");
	var _top=ytop;
	
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if(truebody().scrollTop && truebody().scrollTop>docheight-(ytop-30)){
		if(truebody().scrollTop+(ytop/(docheight/15))+600 < ybottom){
			ytop=truebody().scrollTop+(ytop/(docheight/15));
		}else ytop=ybottom-604;
	}
	if(ytop<_top) ytop=_top;
	
	
	if(obj){
		pDiv.style.height= (ybottom-(getY(pDiv)+4))+'px';
		obj.style.top=ytop+"px";
		obj.style.left=(x+2)+"px";
		obj.style.display="block";
	}
}catch(e) {} 
}


var seclogin=false;function secureLogin(){	if(seclogin){ seclogin=false; document.loginform.action="http://karamel4e.com/index.php?m=login"; }else{ seclogin=true; document.loginform.action="https://karamel4e.com/index.php?m=login"; } } 

function checkemos(){
	var d=document.getElementById("messbox").value;
	var bad=new Array(')','(',':',';','-','>','~','*','@','|','#','<','\\\\','/','=','{','}');
	var bl=bad.length;
	var dl=d.length;
	if(dl < 10) return true;
	var b=0;
	
	for(i=0;i<dl;i++) for(j=0;j<bl;j++) if(d.charAt(i)==bad[j]){ b++; continue; }
	
	if((b/(dl/100)) > 40){ alert('Използвате прекалено много емотиконки!'); return false; }
return true;
}


function displayPic(name,cpic){
	try{
	if(thewin) thewin.close();
	}catch(e){}
	thewin=window.open('/picview.php?name='+name+'&pc='+(numphotos?numphotos:1)+'&cp='+cpic,'picmem','height=650, width=500,toolbar=no,menubar=no,addressbar=no,statusbar=no');
}
function getFileName(n){
	return photos[n];
}
function reloadImg(ttsrc){
			var tmpimg=new Image();
			tmpimg.src=ttsrc;
			return tmpimg;
		}
		function displayTPic(num){
		//alert(photos[dpic[num]]);
		if(photos[dpic[num]]){
				displayPic(photos[dpic[num]],dpic[num]);
			}
		}
		function refreshThumbs(){
			for(i=1; i<=3; i++) document.getElementById("sp"+i).src=((photoss[dpic[i]]) ? photoss[dpic[i]].src : (photos[dpic[i]]?"upload/thumbs/"+photos[dpic[i]]:'images/default_avatar.gif') );
		}
		function picUp(){
			if(numphotos > 3 && dpic[1] > 1){
				for(i=1; i<=5; i++) dpic[i]--;
				refreshThumbs();
			}
		}
		function picDown(){
			if(numphotos > 3 && dpic[3] < numphotos){
				for(i=1; i<=4; i++) dpic[i]++;
				refreshThumbs();
			}		
		}
function stelt(w,j){
	if(w==1){
		if(j) document.getElementById('steltd').style.display="block";
		else  document.getElementById('steltd').style.display="none";
	}else window.location="/index.php?setstelt="+(j.checked?1:2);
}

function ppicrun(pic){
if(ppic) ppic.close();
ppic=window.open('/picview.php?'+pic,'picparty','height=650, width=555,toolbar=no,menubar=no,addressbar=no,statusbar=no');
}

function partypicrun(pic,party){
if(ppic) ppic.close();
ppic=window.open('/ppicview.php?cpic='+pic+'&party='+party,'picparty','height=700, width=655,toolbar=no,menubar=no,addressbar=no,statusbar=no');
}




var menus54=new Array();
var m_hide=false;
var m_l=0;
menus54[1]=new Array();
menus54[1][0]=new Array("Търси","/index.php?m=search");
menus54[1][1]=new Array("Жени","/index.php?m=women");
menus54[1][2]=new Array("Мъже","/index.php?m=men");
menus54[1][3]=new Array("Онлайн","/index.php?m=online");


menus54[2]=new Array();
menus54[2][0]=new Array("Индивидуални","/index.php?m=war");
menus54[2][1]=new Array("По двойки","/index.php?m=war&action=dvoiki");

menus54[3]=new Array();
menus54[3][0]=new Array("Смях","/index.php?m=vicove");
menus54[3][1]=new Array("Блогове","/index.php?m=blogs");
menus54[3][2]=new Array("Конкурси","/index.php?m=contest");
menus54[3][3]=new Array("Чат","/index.php?m=irc");
menus54[3][4]=new Array("Архив Новини","/index.php?m=news");
menus54[3][5]=new Array("Архив Интервюта","/index.php?m=news&interviews=1");

menus54[4]=new Array();
menus54[4][0]=new Array("Песен","/index.php?m=music&action=newsong");
menus54[4][1]=new Array("Албум","/index.php?m=music&action=newalbum");
menus54[4][2]=new Array("Текст","/index.php?m=music&action=newtext");
menus54[5]=new Array();
menus54[5][0]=new Array("SMS Класация","/index.php?m=board");
menus54[5][1]=new Array("Най-харесвани","/index.php?m=boardh");
menus54[5][2]=new Array("Ела и ме виж!","/index.php?m=contest_v");
menus54[6]=new Array();
menus54[6][0]=new Array("Продукти на Karamel4e","http://teniski.karamel4e.com/?id=firminew&menu=7");

function smenu(t,n){
	m_hide=false;
	if(m_l==n) return;
	m_l=n;
	var ht='<table cellpadding="0"  cellspacing="0" >';
	var l=menus54[n].length;
	for(i=0;i<l;i++)
	ht+='<tr><td><a href="'+menus54[n][i][1]+'">'+menus54[n][i][0]+'</a></td></tr>';
	ht+='</table>';
	document.getElementById("m_con").innerHTML=ht;
	document.getElementById("m_con").style.display="block";
	document.getElementById("m_con").style.left=(getX(t)-4)+'px';
	document.getElementById("m_con").style.top=(getY(t)+13)+'px';
	
}
function hmenu(){
	m_hide=true;
	setTimeout("h_menu()",400);
}
function h_menu(){
	if(m_hide){ document.getElementById("m_con").style.display="none"; m_l=0;
	}
}




Object.extend=function(destination,source){for(var property in source){destination[property]=source[property];}return destination;};var cb={attempt:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}return returnValue;}};function $(element){if(arguments.length>1){var elements=[];for(var i=0,length=arguments.length;i<length;i++){elements.push($(arguments[i]));}return elements;}if(typeof(element)=='string'){element=document.getElementById(element);}return element;};Object.extend(Function.prototype,{pass:function(args,bind){var fn=this;if(typeof(args)!='array'){args=[args];}return function(){return fn.apply(bind||fn,args);};},bind:function(bind){var fn=this;return function(){return fn.apply(bind,arguments);};},bindAsEventListener:function(bind){var fn=this;return function(event){fn.apply(bind,[event||window.event]);};},delay:function(ms,bind){return setTimeout(this.bind(bind||this),ms);},periodical:function(ms,bind){return setInterval(this.bind(bind||this),ms);}});var Ajax=ajax={initialize:function(url,options){this.url=url;this.setOptions(options);this.getTransport();},setOptions:function(options){this.options={method:'post',async:true,parameters:'',encoding:'UTF-8',contentType:'application/x-www-form-urlencoded',onComplete:this.empty,onFailure:this.empty,onStateChange:this.empty};Object.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();this.setParameters();},setParameters:function(){var parameters=this.options.parameters;if(typeof(parameters)=='string'){var params=parameters.trim().match(/[^?]*$/)[0];}else{var params=[];for(var key in parameters){params.push(key+'='+encodeURIComponent(parameters[key]?parameters[key]:undefined));}params=params.join('&');}this.options.parameters=params;if(this.options.method=='get'&&params){this.url+=(this.url.indexOf('?')>-1?'&':'?')+params;}},request:function(url,options){try{this.initialize(url,options);this.transport.open(this.options.method.toUpperCase(),this.url,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setHeaders();this.transport.send(this.options.method=='post'?this.options.parameters:null);}catch(e){this.options.onFailure.pass([this.transport.responseText,this.transport.responseXML],this).delay(30);}return this;},onStateChange:function(){this.options.onStateChange.delay(10,this);if(this.transport.readyState!=4)return;var status=0;try{status=this.transport.status}catch(e){}if(status>=200&&status<300){this.options.onComplete.pass([this.transport.responseText,this.transport.responseXML],this).delay(20);}else{this.options.onFailure.pass([this.transport.responseText,this.transport.responseXML],this).delay(20);}this.transport.onreadystatechange=this.empty;},getTransport:function(){this.transport=cb.attempt(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},setHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Codebreeder-Version':'1.0','Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.options.method=='post'){headers['Content-type']=this.options.contentType+(this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType){headers['Connection']='close';}}Object.extend(headers,this.options.requestHeaders);for(var key in headers){this.transport.setRequestHeader(key,headers[key]);}},empty:function(){}};