var prevID="";
var flashUserID=0;
var months=Array('января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря');


function chkUserID(userID){
 flashUserID=userID;
 document.cookie="uid="+userID+"; path=/; domain=telesa.tv";
}

function mailto(mail)
{
  window.location.href = 'mailto:' + mail.substring(0,mail.indexOf('$')) + '@' + mail.substring(mail.indexOf('$')+1, mail.length);
}

function higlightURL(id) {
 if( document.getElementById("cmnt") )
   document.getElementById("cmnt").src='/comments/'+id+'?';

 while (id.indexOf("-") != -1) id = id.substring(0, id.lastIndexOf("-")) + id.substr(id.lastIndexOf("-")+1);
 while (id.indexOf(":") != -1) id = id.substring(0, id.lastIndexOf(":")) + id.substr(id.lastIndexOf(":")+1);
 if (document.all && !window.opera) {
	if (prevID!=null && prevID!="") this.prg[prevID].className = "";
	this.prg[id].className = "tv_sel";
 } else {
	if (prevID!=null && prevID!="") document.getElementById("prg").contentDocument.getElementById(prevID).className = "";
	document.getElementById("prg").contentDocument.getElementById(id).className = "tv_sel";
 }
 prevID=id;
}


function changePRG(prg) {
 str=new String(prg);
 rExp=/index\.prg/i;
 res=str.replace(rExp, 'schedule_js.html');
 rExp2=/(\d{4})\/(\d{2})\/(\d{2})/;
 results=str.match(rExp2);
 document.getElementById("schtitle").innerHTML=results[3]+' '+months[results[2]-1]+' '+results[1]+' г.';
 document.getElementById("prg").src=res;
}

