﻿function openInviteContestDiv(dn){    
    DivTitle = "Пригласите друзей";
    if(dn==2 || dn==3){
        if(dn==2){DivTitle = "Твиттер";}
        
        createCustomAlert(DivTitle,SetInnerHtmlDiv(),'605','405','','');
           ChangeInnerHtmlDiv(dn);
           if(dn == 2) 
           {
               getTwitterDetails();
           }    
           // Gygya Settings
         
            var pconf={
                widgetTitle: 'blogTV.com', 
                defaultContent: 'EmbedFlashPlayer', 
                UIConfig: '<config><display showEmail="true" showBookmark="true" /></config>'
            };
            Wildfire.initPost('102331', 'divWildfirePost', 400, 300, pconf);
    }else{
        
           createCustomAlert('Поделиться',SetInnerHtmlDiv(),'605','405','','');
           // Gygya Settings
            var pconf={
                widgetTitle: 'blogTV.com', 
                defaultContent: 'EmbedFlashPlayer', 
                UIConfig: '<config><display showEmail="true" showBookmark="true" /></config>'
            };
            Wildfire.initPost('102331', 'divWildfirePost', 400, 300, pconf);
   }
}
function SetInnerHtmlDiv(){
 
str= '<div id="divScheduleStep2" class="posAbs F12 C_GD DN" style="width:585px;height:360px;">'+
        '<div class="posAbs BGW BOGL" style="width:585px;height:335px;top:25px;left:0px;">'+
            '<div class="posAbs" style="width:366px;height:320px;top:0px;left:0px;">'+
                '<div class="posAbs TxtL FB F14 LH15" style="top:10px;left:5px;width:200px;">Пригласить по e-mail</div>'+
                '<div style="position:absolute;left:5px; top:5px;width:auto;height:auto;">'+
                    '<div class="posAbs TxtL" style="top:25px;width:100px;">От: </div>'+
                    '<div class="posAbs" style="top:25px;left:110px;width:240;height:auto;"><input type="text" value="'+CookieUserName+'" id="SenderName" class="Login" style="width:240px;" readonly></div>'+
                    '<div class="posAbs TxtL" style="top:50px;width:150px;">Кому: </div>'+
                    '<div class="posAbs TxtL" style="top:142px;width:100px;">Импортировать из:</div>'+
                    '<div class="posAbs TxtL" style="top:142px;width:150px;left:110px;">'+
                       '<img src="'+IMG_SERVER_URL+'mailinks.gif" border="0" align="absmiddle" usemap="#EMAILSUPIMG">'+       
                       '<map name="EMAILSUPIMG">'+
                                '<area shape=rect coords=89,0,144,30 onClick=makeRequest("/Importer/php_comp/aol.php") Href="javascript:void(0)">'+
                                '<area shape=rect coords=145,0,239,30 onClick=makeRequest("/Importer/php_comp/hotmail.php") Href="javascript:void(0)">'+
                                '<area shape=rect coords=0,0,88,30 onClick=makeRequest("/Importer/php_comp/yahoo.php") Href="javascript:void(0)">'+
                                '<area shape=rect coords=0,31,117,54 onClick=makeRequest("/Importer/php_comp/gmail.php") Href="javascript:void(0)">'+
                                '<area shape=rect coords=118,31,239,54 onClick=makeRequest("/Importer/php_comp/msn.php") Href="javascript:void(0)">'+
                       '</map>'+
                       '<input type="hidden" id="hMsgId" value="1"/>'+
                    '</div>'+
                    '<div class="posAbs F11 TxtL" style="top:50px;left:110px;width:200px;"><textarea id="FEmails" class="HPspradeLong" style="width:240px;height:70px;overflow:auto;"></textarea><br>Отделяется запятой</div>'+
                    '<div class="posAbs TxtL" style="top:205px;width:100px;">Ваше сообщение: </div>'+
                    '<div class="posAbs" style="top:205px;left:110px;"><textarea id="YourMailMsg" class="HPspradeLong" style="width:240px;height:70px;">Привет! Я сейчас выхожу в прямой эфир на BlogTV. Приходите посмотреть мою передачу, поддержать меня и пообщаться в режиме онлайн! </textarea></div>'+
                '</div>'+
                '<div class="posAbs TxtL" style="top:285px;left:110px;width:360px;"><input type="checkbox" id="saveMyEmails" checked /> Сохранить мой список e-mail адресов</div>'+
                '<div class="posAbs TxtL" id="EmailErrorDiv" style="top:305px;left:5px;width:360px;color:Red;"></div>'+
                '<div class="posAbs" style="top:307;left:350;">'+
                   writeBlackButtonJS(120,"ПРИГЛАСИТЬ","SendInvitation(0)")+
                '</div>'+
            '</div>'+
            '<div id="contactlist" class="posAbs BGW" style="width:366px;height:305px;top:25px;left:0px;display:none;overflow:auto;">'+
            '</div>'+
        '</div>'+    
        '<div class="posAbs" style="width:110px;height:19px;top:7px;left:-1px;">'+
            '<div class="leftSmallWhiteTab posAbs" style="left:0px;"></div>'+
            '<div class="posAbs BGW" style="left:5px;width:101px;height:19px;border-top:solid 1px #d7d7d7; text-align:center;font-weight:bold;">Через e-mail</div>'+
            '<div class="rightSmallWhiteTab posAbs" style="right:0px;"></div>'+
        '</div>'+        
        '<div class="posAbs CursorP" style="width:110px;height:18px;top:7px;left:114px;" onclick="ChangeInnerHtmlDiv(3);">'+
            '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
            '<div class="posAbs txtC FB" style="left:5px;width:101px;height:18px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;">Залить</div>'+
            '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
        '</div>'+                    
    '</div>'+ 
    '<div class="posAbs F12 DN C_GD" id="divScheduleStep3" style="width:585px;height:360px;">'+    
        '<div class="posAbs BGW BOGL" style="width:585px;height:330px;top:5px;left:0px;">'+
             '<div class="posAbs" style="width:366px;height:320px;top:0px;left:0px;">'+
                    '<div class="posAbs TxtL" style="top:20px;left:470px;width:100px;height:100px;"><img src="'+IMG_SERVER_URL+'twitterlogo.jpg" border="0" align="absmiddle"></div>'+
                    '<div class="posAbs TxtL" style="top:130px;left:300px;width:280px;height:170px;"><img src="'+IMG_SERVER_URL+'twitter-bird.jpg" border="0" align="absmiddle"></div>'+
                    '<div class="posAbs TxtL" style="top:30px;left:5px;width:150px;">Логин на Twitter: </div>'+
                    '<div class="posAbs" style="top:30px;left:115px;">'+
                        '<input type="text"  value="'+tUserName+'" class="Login" id="twitterMsgYourName" onfocus=claerText(this,"false");></div>'+
                    '<div class="posAbs TxtL" style="top:55px;left:5px;width:150px;">Пароль на Twitter: </div>'+
                    '<div class="posAbs" style="top:55px;left:115px;">'+
                        '<input id="twitterUserPsw" type="password" onfocus="ChangeBackPass(this.id);" value="'+tUserPsw+'" class="LoginPsw" />'+
                    '</div>'+
                    '<div class="posAbs TxtL" style="top:85px;left:5px;width:150px;">Ваше сообщение: </div>'+
                    '<div class="posAbs" style="top:85px;left:115px;">'+
                        '<textarea oninput="return cutText(this,this.value,140);" onpaste=return cutText(this,window.clipboardData.getData("Text"),140); onkeydown="return checkStrLen(this.value,event,0,140);" id="YourMsg" class="HPspradeLong" style="width:240px;height:70px;overflow:auto;">Сейчас я на blogTV.com  '+IIS_SERVER_LINK+'people/'+_ownerUserName+'</textarea>'+
                    '</div>'+
                    '<div class="posAbs" style="top:170px; left:5px;">';
                         if(CookieUsrId!=0){
                            str += "<input type='checkbox' name='saveTwitterDetails' id='saveTwitterDetails' onclick='CheckTwitterDetailsBox();' checked='checked' /> Сохранить данные моего Twitter'a";
                         }else{
                            str += "<input type='checkbox' name='saveTwitterDetails' id='saveTwitterDetails' disabled='disabled' /> Сохранить данные моего Twitter'a";
                         }
                    str += '' +
                    '</div>'+
                    '<div class="posAbs" style="top:190px; left:5px;">'+
                        "<input type='checkbox' name='followUsOnTwitter' id='followUsOnTwitter' checked='checked' /> Следуйте за blogTV в twitter"+
                    '</div>'+
                    '<div class="posAbs" style="top:210px; left:5px;">';
                        if(CookieUsrId!=0){
                            str += "<input type='checkbox' name='onStartBroadcast' id='onStartBroadcast' onclick='CheckStartBroadcastBox();' checked='checked' /> Добавлять в Twitter сообщение о каждом новом эфире";
                        }else{
                            str += "<input type='checkbox' name='onStartBroadcast' id='onStartBroadcast' disabled='disabled' /> Добавлять в Twitter сообщение о каждом новом эфире";
                        }
                    str += ''+     
                    '</div>'+
                    '<div class="posAbs DN" style="top:250px;left:5px;width:360px;color:Red;" id="twitterErrorDiv"></div>'+                    
                    '<div class="posAbs" style="top:290;left:130;">'+
                        writeBlackButtonJS(120,"Обновить","CheckTwitter(0);")+                       
                    '</div>'+
                    '<div class="posAbs" style="top:290;left:270;">'+
                        writeBlackButtonJS(120,"Закрыть","removeCustomAlert();")+                         
                    '</div>'+
            '</div>'+
        '</div>'+ 
        '<div class="posAbs DN" style="top:100px;left:240px;width:120px;height:120px;background-color:#000000;border:solid 1px #353535;" id="divSending">'+
            '<embed width="120" height="120" src="'+IMG_SERVER_URL+'presender_green.swf" type="application/x-shockwave-flash" allowFullScreen="false"></embed>'+
        '</div>'+                     
    '</div>'+    
    '<div id="divScheduleStep4" class="posAbs F12 C_GD" style="width:585px;height:360px;">'+    
        '<div class="posAbs BGW BOGL" style="width:585px;height:330px;top:5px;left:0px;">'+
             '<div class="posAbs" style="width:366px;height:320px;top:20px;left:90px;">'+
                   '<div id="divWildfirePost"></div>'+
                   '<textarea id="EmbedFlashPlayer" class="DN" >'+
                    '<embed width="330" height="330" src="'+IIS_SERVER_LINK+'livesdk/'+_liveEncEmbed+'" type="application/x-shockwave-flash" allowFullScreen="true"></embed>'+
                   '</textarea>'+
            '</div>'+
        '</div>'+ 
        
    '</div>';
    
return str;                
}





function getFriendsEMails() { 
   if (http_request.readyState == 4) { 
       if (http_request.status == 200) { 
        var	clObj=document.getElementById("FEmails");
        clObj.innerHTML=http_request.responseText;
        } 
    } 
}

function ChangeInnerHtmlDiv(DivNum)
{   
    if(DivNum==1)
    {
        document.getElementById("divScheduleStep2").style.display="block";
        document.getElementById("divScheduleStep3").style.display="none";
        document.getElementById("divScheduleStep4").style.display="none";
    }
    else if(DivNum==2)
    {
        document.getElementById("divScheduleStep3").style.display="block";
        document.getElementById("divScheduleStep2").style.display="none";
        document.getElementById("divScheduleStep4").style.display="none";        
        //getTwitterDetails();
    }else if(DivNum==3){
         document.getElementById("divScheduleStep3").style.display="none";
        document.getElementById("divScheduleStep2").style.display="none";
        document.getElementById("divScheduleStep4").style.display="block";
    }
    
}
 var http_request = false; 
var _url="";
   function makeRequest(url) { 
       _url=url;
       if (window.XMLHttpRequest) { // Mozilla, Safari,... 
           http_request = new XMLHttpRequest(); 
       } else if (window.ActiveXObject) { // IE 
           http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
       } 
       http_request.onreadystatechange = alertContents; 
       http_request.open('GET', url, true); 
       http_request.send(null); 

   } 

   function alertContents() { 

       if (http_request.readyState == 4) { 
           if (http_request.status == 200) { 
            var	clObj=document.getElementById("contactlist");
	        clObj.innerHTML=http_request.responseText; 
	        clObj.style.display="block";
            } else { 
               alert('There was a problem with the request.'); 
            } 
       } 

   } 
function togglechecked(){ 
  var elms=document.getElementsByName("address");
  for (var i = 0; i < elms.length; i++) {
	var e = elms[i];

		if ((e.checked == true) && (e.type == "checkbox")) {
			e.checked = false;
		}
		else
		{
			e.checked = true;
		}
  }
}

function toggleselect(){ 
  document.getElementById("allbox").checked = !document.getElementById("allbox").checked;
  togglechecked();
}
	
function toggleselect2(){ 
  document.getElementById("allbox2").checked = !document.getElementById("allbox2").checked;
  togglechecked();
}
function valid_userform()
{
    if(document.demo.username.value=="")
    {
        alert("Please, Enter Your User ID.");
        document.demo.username.focus();
        return false;
    }
    else if(document.demo.password.value=="")
    {
        alert("Please, Enter Your Password.");
        document.demo.password.focus();
        return false;
    }
    else
    {
        return true;
    }
}
function makeContactRequest() { 
   
   if (window.XMLHttpRequest) { // Mozilla, Safari,... 
       http_request = new XMLHttpRequest(); 
   } else if (window.ActiveXObject) { // IE 
       http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
   } 
  
   document.getElementById("tdMessage").innerHTML="Находит данные...";
   var http_request_Params="username="+document.getElementById("User Id").value+"&password="+document.getElementById("Password").value+"&act="+document.getElementById("act").value;
      
   http_request.onreadystatechange = alertContactContents;
   
   http_request.open('Post', _url, true); 
   http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   http_request.setRequestHeader("Content-length", http_request_Params.length);
   http_request.send(http_request_Params);
} 

function alertContactContents() { 

   if (http_request.readyState == 4) {
       if (http_request.status == 200) 
		document.getElementById("contactlist").innerHTML=http_request.responseText;
	   else
        alert('There was a problem with the request.'); 
        
   } 

} 
function addEmails(){
 objTxt=document.getElementById("FEmails");
 if(objTxt.value!="")objTxt.value+",";
 var elms=document.getElementsByName("address");
 for (var i = 0; i < elms.length; i++) {
	var e = elms[i];
	if ((e.checked == true) && (e.type == "checkbox")) {
		objTxt.value+=e.value.split(":")[1]+",";
	}		
 }
 document.getElementById("contactlist").style.display="none";
}

function SendInvitation(ShowId){
    ErrObj=document.getElementById("EmailErrorDiv");
    ErrObj.innerHTML="";
    
    iSenderMsg = document.getElementById("YourMailMsg").value; 
    iSenderName=document.getElementById("SenderName").value;
    iEmailStr = new String(removeAllSpaces(document.getElementById("FEmails").value));
    if(iSenderName==""){
        ErrObj.innerHTML="Укажите свое имя";
        document.getElementById("SenderName").focus();
        return false;        
    }
   
    if(iEmailStr=="")
    {
        ErrObj.innerHTML="Пожалуйста, укажите e-mail адреса друзей";
        document.getElementById("FEmails").focus();
        return false;        
    }
	var emailSum=0;
    if(iEmailStr.indexOf(",")>0)
    {
        EmailArr = iEmailStr.split(",");	
        for(E=0;E<=EmailArr.length;E++)
        {
            TheEmail = new String(removeAllSpaces(EmailArr[E]));
            if((TheEmail != "") && (TheEmail!="undefined"))
            {	            
                 if(!isEmail(TheEmail))
                 {
                    ErrObj.innerHTML="Пожалуйста, укажите действующие e-mail адреса ";
                    document.getElementById("FEmails").focus();
                    return false;
                 }
                 emailSum++;
            }
        }
    }
    else
    {
       if(!isEmail(iEmailStr))
       {
            ErrObj.innerHTML="Пожалуйста, укажите действующие e-mail адреса ";
            document.getElementById("FEmails").focus();
            return false;
       } 
       emailSum=1;
    }
    if(iSenderMsg=="")
    {
        ErrObj.innerHTML="Введите сообщение ";
        document.getElementById("YourMailMsg").focus();
        return false;        
    }
    var objMid=document.getElementById("hMsgId");
    var mid=0;
    if(objMid){
        mid=objMid.value;
    }
    var SEmail=0;
	if (document.getElementById("saveMyEmails").checked)
	    SEmail=1;
    xmlPage = "/Ajax/Email_InviteContest.asp";
    parm = "YourName="+encodeURI(iSenderName)+"&ShowId="+ShowId+"&YourMsg="+ encodeURI(iSenderMsg)+"&FEmails="+ encodeURI(iEmailStr)+"&mid="+mid+"&SaveMails="+SEmail;
    RegionObjXml = CreateObjXML();
    RegionObjXml.open("POST", xmlPage ,true); 
    RegionObjXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    RegionObjXml.send(parm); 
    ErrObj.innerHTML=emailSum+" сообщение(ий) отправлено";
    document.getElementById("FEmails").value="";
    return true;
   
}

function openContestTerms(){
    xmlPage = "/en/EventsFolder/Include/ContestTerms.htm";
    ObjXml = CreateObjXML();
    ObjXml.onreadystatechange = getContestTerms;
    ObjXml.open("Get", xmlPage ,true); 
    ObjXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    ObjXml.send(null); 
}
function getContestTerms(){
    if (ObjXml.readyState == 4) {
       if (ObjXml.status == 200) {
		str=ObjXml.responseText; 
		str="<div class='posRel BGW BOGL' style='width:580px;height:360px;overflow: auto;'>"+str+"</div>";
        createCustomAlert('Правила пользования',str,'605','405','',''); 
       }
   }   
}

//Counter To Blog TV Programs
var SetCount;
var countdownTimeout = 0;
function countdownContest(year, month, day, hour, minute, ProgId, ServerTime)
{  
     if(ServerTime=='')
     {
         Str="TD="+day+"&TM="+month+"&TY="+year+"&TH="+hour+"&TMi="+minute;
         TimeobjXML = CreateObjXML();
         TimeobjXML.open("POST", "/Ajax/Schedule_GetTImeFromServer.asp" ,false); 
         TimeobjXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
         //TimeobjXML.onreadystatechange=batchRsChange;
         TimeobjXML.send(Str);
         if (TimeobjXML.responseXML)
         { 	       
             var Today = TimeobjXML.responseXML.getElementsByTagName("Tdate");
             Today = new Date(Today[0].firstChild.data);          	     
             var Tzone = TimeobjXML.responseXML.getElementsByTagName("Tzone");
             Tzone =  Tzone[0].firstChild.data
             var TargetTime = TimeobjXML.responseXML.getElementsByTagName("TargetTime");
             TargetTime = new Date(TargetTime[0].firstChild.data);                 
             Todays_Year = Today.getFullYear() - 2000;
             Todays_Month = Today.getMonth() + 1;                  
             
             //Convert both today's date and the target date into miliseconds.                           
             Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                     Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 		        
	         if(ProgId!='0')
	         {
		        DivSchedTime="SchedTime"+ProgId;
	         }  		
	         else
	         {
		        DivSchedTime="SchedTime";
	         }	             
             if(document.getElementById(DivSchedTime))
             {
                document.getElementById(DivSchedTime).innerHTML=Tzone+"<br>";
             }
             else
             {
                return false;
             }
             year=parseInt(TargetTime.getFullYear()-2000); 
             month=parseInt(TargetTime.getMonth()+1); 
             day=TargetTime.getDate(); 
             hour=TargetTime.getHours(); 
             minute=TargetTime.getMinutes();
             Target_Date = (new Date(year,month,day,hour,minute, 00)).getTime();
         }	    
     }
     else
     {   
         TempTime = new Date(ServerTime);    
         Today = new Date(TempTime.getFullYear(),TempTime.getMonth(),TempTime.getDate(),TempTime.getHours(),TempTime.getMinutes(),TempTime.getSeconds()+1);
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;          
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                                           
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();
     }                          
     //Find their difference, and convert that into seconds.                  
     Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
     
     if(Time_Left < 0)
        Time_Left = 0;
     
    
    //More datailed.
    days = Math.floor(Time_Left / (60 * 60 * 24));
    Time_Left %= (60 * 60 * 24);
    hours = Math.floor(Time_Left / (60 * 60));
    Time_Left %= (60 * 60);
    minutes = Math.floor(Time_Left / 60);
    Time_Left %= 60;
    seconds = Time_Left;
	if(ProgId!='0')
	{
		DivCounter="countdownSTR"+ProgId;
		DivCountertext="textcountSTR"+ProgId;
	}  		
	else
	{
		DivCounter="countdownSTR";
		DivCountertext="textcountSTR";
	}
    if(seconds < 10) Tseconds = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + seconds + "</b></font></td>";
    if(minutes < 10) Tminutes = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + minutes + "</b></font></td>";
	else 
	{
		Tminutes = "<td align='left' valign='top'><font class='TitlesLWhite'><b>" + Math.floor(minutes / (10)) + "</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + (minutes-Math.floor(minutes / (10))*10) + "</b></font></td>";
	}		
    if(hours < 10) Thours = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + hours + "</b></font></td>";
	else 
	{
		Thours = "<td align='left' valign='top'><font class='TitlesLWhite'><b>" + Math.floor(hours / (10)) + "</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + (hours-Math.floor(hours / (10))*10) + "</b></font></td>";
	}				
	if(days < 10) Tdays = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + days + "</b></font></td>";
	else 
	{
		Tdays = "<td align='left' valign='top'><font class='TitlesLWhite'><b>" + Math.floor(days / (10)) + "</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + (days-Math.floor(days / (10))*10) + "</b></font></td>";
	}		
	
    CoObj = eval(document.getElementById(DivCounter));
	TextObj = eval(document.getElementById(DivCountertext));
    if(CoObj)
    {
        StrCounter = "";
		if(ProgId!='0')
		{			
			StrCounter += "<table width='166' align='center' cellpadding='0' cellspacing='0' border='0'>"+	
							   "<tr><td height='3'></td></tr>"+
							   "<tr><td width='10'></td>";	
			StrCounter += Tdays + "<td width='14'></td>";
			StrCounter += Thours + "<td width='14'></td>";
			StrCounter += Tminutes;							   
			StrCounter += "</tr></table>";
		}
		else
		{
			StrCounter += "<table width='220' align='center' cellpadding='0' cellspacing='0' border='0'>"+	
							   "<tr><td width='32'></td>";	
			StrCounter += Tdays + "<td width='10'></td>";
			StrCounter += Thours + "<td width='10'></td>";
			StrCounter += Tminutes + "<td width='20'></td>";							   
			StrCounter += "</tr></table>";
		}
        CoObj.innerHTML = "";    
		CoObj.innerHTML += StrCounter;                 
        //Recursive call, keeps the clock ticking.
        if (days != 0 || hours != 0 || minutes != 0 || seconds != 0)
        {
			if(SetCount=='True')
			{
				TextObj.innerHTML = "<b>Время, оставшееся до первого обновления</b>";
            	countdownTimeout = setTimeout('countdownContest(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + ProgId + ',"'+Today+'");', 1000);
			}
			else
			{
				 TextObj.innerHTML = "<b>Время, оставшееся до первого обновления</b>"
			}
        }
        else
        {
            TextObj.innerHTML = "Время, оставшееся до первого обновления"
        }
   }                  
}    

//=== Get User Twitter Account Details
tUserName = "";
tUserPsw = "";
tUserMsg = "";
//tempp = "Сейчас я на blogTV.com " + IIS_SERVER_LINK + "people/" + _ownerUserName;
function getTwitterDetails()
{   
    _TwitterMsg = SetTwitterMsg();    
    url = "/Ajax/Users_GetTwitterAccountDetails.asp";
    str = "UserId=UserId";
    objLangXML = CreateObjXML();
    objLangXML.open("POST", url ,true); 
    objLangXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objLangXML.onreadystatechange = batchGetTwitterDetails;
    objLangXML.send(str);
}

function batchGetTwitterDetails()
{
   if (objLangXML && objLangXML.readyState==4)
   {
        if (objLangXML.responseXML)
		{  
            var Str1 = objLangXML.responseXML.getElementsByTagName("tUserName");
            tUserName = Str1[0].childNodes[0].data;
            var Str2 = objLangXML.responseXML.getElementsByTagName("tUserPsw");
            tUserPsw = Str2[0].childNodes[0].data;
            var Str3 = objLangXML.responseXML.getElementsByTagName("tUserMsg");
            tUserMsg = Str3[0].childNodes[0].data;
            var Str4 = objLangXML.responseXML.getElementsByTagName("tFollowUs");
            tFollowUs = Str4[0].childNodes[0].data;
                     
            if(tUserName != "" && tUserName != undefined)
            {
                $g("twitterMsgYourName").value = tUserName;
                //$g("saveTwitterDetails").checked = true;
            }
            else
            {
                $g("twitterMsgYourName").value = TwitterUsername;
            }
            
            if(tUserPsw != "" && tUserPsw != undefined)
            {
                ChangeBackPass($g("twitterUserPsw").id);
                $g("twitterUserPsw").value = tUserPsw;
            }
            else
            {
                $g("twitterUserPsw").value = "";
            }
            
            tUserMsg = _TwitterMsg; 
            if(tUserMsg != "" && tUserMsg != undefined)
            {
                $g("YourMsg").innerHTML = tUserMsg;
            } 
            if(tFollowUs==0 && tUserPsw != ""){
                $g("followUsOnTwitter").checked = false;
            }
        }
    }
}
 
 