function trAddClass(elem,clname){
	elem = document.getElementsByTagName(elem);
	for (var i = 0; i < elem.length; i++) elem[i].className=clname;
}
function trDelClass(elem){
	elem = document.getElementsByTagName(elem);
	for (var i = 0; i < elem.length; i++) elem[i].className='';
}

function sendSimpleEvent(category_title, action_title){
	if(typeof(pageTracker) != "undefined"){
		pageTracker._trackEvent(category_title + '', action_title + '', location + '');//yantar: location + ''  is important!
	}
}
function printVers(){
	trAddClass('body','print');
	if(typeof(pageTracker) != "undefined"){
		pageTracker._trackEvent("print", "print-view", location + '');//yantar: location + ''  is important!
	}
	document.getElementById("hidloc").style.display="block";
	document.getElementById("hidprint").style.display="block";
	window.setTimeout("print(location)",1000);
}

function screenVers(){
	trDelClass('body');
	if(typeof(pageTracker) != "undefined"){
		 pageTracker._trackEvent("print", "screen-view", location + '');//yantar: location + ''  is important!
	}

}
function GetCorrectWord(iNum, aWords, bSkipNum){
	var iLast=Number(String(iNum).substr(-1));
	var sResult;
	if(iNum >= 5 && iNum <= 20)
		sResult=aWords[2];
	else{
		switch(iLast){
			case 1:  sResult=aWords[0]; break;
			case 2:
			case 3:
			case 4:  sResult=aWords[1]; break;
			default: sResult=aWords[2]; break;
		}
	}
	return (bSkipNum) ? sResult : iNum+' '+sResult;
}



//function ToggleView(id1){oElem1 = document.getElementById(id1); oElem1.style.display = oElem1.style.display == 'none' ? '' : 'none';}


   function msieversion() //ie version
   {
      var ua = window.navigator.userAgent
      var msie = ua.indexOf ( "MSIE " )
      if ( msie > 0 )      // If Internet Explorer, return version number
         return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
      else                 // If another browser, return 666
         return 666
   }

/* submission forms */
function letterForm () {
    var formWindow = window.open (
        "http://www.travel.ru/scripts/exec/letter/form",
        "xperienceForm",
        "scrollbars=yes,resizable=yes,menubar=no,location=no,width=600,height=600"
    );
    formWindow.focus ();
}

function xperienceForm ( countryId, topicIds ) {
    var formWindow = window.open (
        "http://www.travel.ru/scripts/exec/xperience/form?ref_uri=" + location.href +
            "&country_id=" + countryId +
            "&topic_ids="  + ( topicIds ? topicIds : '' ),
        "xperienceForm",
        "scrollbars=yes,resizable=yes,menubar=no,location=no,width=800,height=600"
    );
    formWindow.focus ();
}

function xperienceFormHotel (countryId, cityId) {
    var formWindow = window.open (
        "http://www.travel.ru/scripts/exec/xperience/form2?rtype=h&ref_uri=" + location.href +
        "&country_id=" + countryId + "&city_id=" + cityId,
        "xperienceForm", "scrollbars=yes,resizable=yes,menubar=no,location=no,width=900,height=700"
    );
    formWindow.focus ();
}

function xperienceFormAirline (airlineId) {
    var formWindow = window.open (
        "http://www.travel.ru/scripts/exec/xperience/form2?rtype=a&ref_uri=" + location.href +
        "&airline_id=" + airlineId,
        "xperienceForm", "scrollbars=yes,resizable=yes,menubar=no,location=no,width=900,height=700"
    );
    formWindow.focus ();
}

