
acount = 0;
count = 0;
mcount = 0;

function typeNews(){
	if(str[acount][0]){
		timer = setInterval("move()", typespeed);
		}
	}


function move(){
	clength = str[acount][0].length;
	if(count <= clength){
				newHTML = '<a href="'+str[acount][1]+'">'+str[acount][0].substr(0, count)+'</a>';
				if(count > letc){
					newHTML = '<a href="'+str[acount][1]+'">'+str[acount][0].substr(mcount, letc+2)+'</a>';
					mcount++;
					}
				box = document.getElementById("stroka");
				box.innerHTML = newHTML;
				count++;
	} else {
		clearInterval(timer);
		count = 0;
		mcount = 0;
		acount++;
		if(acount >= str.length){acount = 0;}
		setTimeout("typeNews()", delay);
		}
	}

function SubmitOpi(id){
	expiredays = 40;
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie="opinion=" +id+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
	document.forms['opinsubm'].submit();
	}
    
function getCheckedValue(radioObj) {
    if(!radioObj)
        return "";
    var radioLength = radioObj.length;
    if(radioLength == undefined)
        if(radioObj.checked)
            return radioObj.value;
        else
            return "";
    for(var i = 0; i < radioLength; i++) {
        if(radioObj[i].checked) {
            return radioObj[i].value;
        }
    }
    return "";
}

// -----> pull

function actPull(){
    $('pullS').onclick = function(e){
   // e = new Event(e).stop();
    
    rad = document.forms['opforma'].elements['opini']
    chb = getCheckedValue(rad);
    
    if(chb === ""){
        alert("Вы не выбрали вариант ответа!")} else{
                   
    pid = $('opiid').value
        if(Cookie.get("pid") != pid){
            Cookie.set('pid', pid, {duration: 90});
                   
                   var str = 'pid='+pid+'&ch='+chb+'&aj=1';
                   var url = "/mods/ajax.php";    
                   
                   new Ajax(url, {
                        method: 'post',
                        data: str,
                        update: $('updpull'),
                        evalScripts: true 
                        }).request(); 
        }
    }
    }       
    }
    
function start(){
    typeNews();
    if($('pullS')) actPull();
    }
