String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
if (typeof DomLoaded == 'undefined') var DomLoaded = {
	onload: [],
	loaded: function() {
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis)
	{
		this.onload.push(fireThis);
		if (document.addEventListener) document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent))
		{ 
			var _timer = setInterval(function()	{
				if (/loaded|complete/.test(document.readyState)) {
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "src='javascript:void(0)'";
		if (location.protocol == "https:") proto = "src=//0";
		document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() { if (this.readyState == "complete") DomLoaded.loaded();	};
		/*@end @*/
	   window.onload = DomLoaded.loaded;
	}
};

//function returning bounds of the element
var getBounds=function(p){var left=p.offsetLeft,top=p.offsetTop,w=p.offsetWidth;h=p.offsetHeight;while(p=p.offsetParent){left+=p.offsetLeft;top+=p.offsetTop;}return{left:left,top:top,width:w,height:h};};

/* x,y    - window x and y
*  sx,sy  - screen x and y
*  px,py  - page x and y (with scrolling) */
var getSize=function(){var x,y,sx,sy,px,py;if(self.innerHeight){x=self.innerWidth;y=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}else if(document.body){x=document.body.clientWidth;y=document.body.clientHeight;}if(self.pageYOffset){sx=self.pageXOffset;sy=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){sx=document.documentElement.scrollLeft;sy=document.documentElement.scrollTop;}else if(document.body){sx=document.body.scrollLeft;sy=document.body.scrollTop;}var test1=document.body.scrollHeight;var test2=document.body.offsetHeight;if(test1>test2){px=document.body.scrollWidth;py=document.body.scrollHeight;}else{px=document.body.offsetWidth;py=document.body.offsetHeight;}return {x:x,y:y,sx:sx,sy:sy,px:px,py:py};};

//function updating parent's location with current height (if present)
var updateParent = function() { if (window.top != window) parent.location = pageUrl + getSize().py; };

var addToFavourites = function(){
  if (window.external&&(typeof window.external.AddFavorite=='unknown')) window.external.AddFavorite(location.href,document.title);
  else if (window.sidebar&&window.sidebar.addPanel) window.sidebar.addPanel(document.title, location.href, "");
  else alert('Please press CTRL-D to bookmark the page!');
  return false;
};

var lockSite = function(){
  if(location.protocol.toLowerCase() == 'https:') alert("The site is already secure as using 128 bit SSL technology to protect your personal information.");
  else {
    location.href = location.href.replace('http', 'https');
    alert("Your web browser has now been set to browse our website using 128 bit SSL technology.\n\nThis will protect any personal information you choose to send to us or that we send to you visa our website.\n\nPlease note that the site is secure while the padlock icon is showing in the address bar of your web browser.");
  }
};

var createLIwA = function(liId, linkText, handler) {
  var li = document.createElement('li');
  li.id = liId;
  var lnk = li.appendChild(document.createElement('a'));
  lnk.href='#';
  lnk.appendChild(document.createTextNode(linkText));
  lnk.onclick = handler;
  
  return li;
};

var prepareLinks = function(){
  var mainMenu = document.getElementById('mainMenu');
  if (mainMenu) { //we create these links only if menu is there
    //mainMenu.insertBefore(createLIwA('mmiBookmark', 'Bookmark this site', addToFavourites), mainMenu.firstChild);
    mainMenu.insertBefore(createLIwA('mmiSecure', 'Secure site', lockSite), document.getElementById('mmiTracking'));
  }      
};

//crossbrowser mouse coordinates
//var getCoords=function(e){var posx=0;var posy=0;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}return {x:posx,y:posy};};
var getCoords=function(e){
	var posx=0;
	var posy=0;
	if(!e)
		var e=window.event;
	if(e.pageX||e.pageY){
		posx=e.pageX;
		posy=e.pageY;
	}else 
		if(e.clientX||e.clientY){
			posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
			posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
		}
	return {x:posx,y:posy};
};


Function.prototype.bind = function(object){var self = this; return function() { return self.apply(object, arguments); } };

var err;

function printError(text) {	alert (text); };

function getCurrencySymb(curr){
	switch(curr){
		case "USD": return "<SMALL>$</SMALL>";
		case "RUR": return "<SMALL>rubles</SMALL>";
		case "GBP": return "<SMALL>&#163;</SMALL>";
		case "EUR": return "<SMALL>&#8364;</SMALL>";
	}
}

var hideElement = function(elem){
   
   //elem.interval = window.setInterval(
};

function getToolTip(e, obj, createShim){

   if (typeof arguments.callee.tooltip == 'undefined') {

   		var t = document.createElement('div');
   		var title  = t.appendChild(document.createElement('div'));
   		var content = t.appendChild(document.createElement('div'));
   		var closing = t.appendChild(document.createElement('div'));
   		t.id = 'myToolTip';
   		title.id = 'myToolTipTitle';
   		content.id = 'myToolTipContent';
   		closing.id = 'myToolTipCross';
   		closing.innerHTML = '&times;';
   		closing.onclick = function(e){ this.parentNode.style.display = 'none'; var shim = document.getElementById('myShim'); if(shim) shim.style.display='none'; if(window.event) window.event.cancelBubble = true; if (e) e.stopPropagation(); };
   		t.onclick = function(e){ this.style.display = 'block'; if (window.event) window.event.cancelBubble = true; if (e) e.stopPropagation(); };
   		
   		t.setTitle = function(ttl){ this.firstChild.innerHTML = ttl; };
   		t.setContent = function(cnt) { this.childNodes[1].innerHTML = cnt; };
   		t.style.position = 'absolute';
   		t.style.zIndex = '9999';
   		
   		arguments.callee.tooltip = document.body.appendChild(t);
   		
   }

   var mc = getBounds(obj);
   with(arguments.callee.tooltip.style) {
     display = 'block';
     left = mc.left + 'px';
     top = (mc.top + mc.height + 10) + 'px';
   }
   
   if (createShim) {
     //we need to create shim only once and hide it, then position it when required
     if (typeof arguments.callee.shim == 'undefined') {
       var shim = document.createElement('iframe');
       shim.id = 'myShim';
       shim.src = "javascript:'<html></html>'";
       with (shim.style) {
         position = 'absolute';
         zIndex = '1';
         background = 'red';
       }
       arguments.callee.shim = document.body.appendChild(shim);
     }
     
     arguments.callee.shim.style.display = 'block';
     //now position it right under the tooltip
     /*with(arguments.callee.shim.style) {
       display = 'block';
       top = arguments.callee.tooltip.style.top;
       left = arguments.callee.tooltip.style.left;
     }*/
   }
   
   return arguments.callee.tooltip;
}

var getImgTitle = function(){
  if (typeof arguments.callee.myHover == 'undefined') {
    var t = document.createElement('div');
    var arr  = t.appendChild(document.createElement('div'));
   	var content = t.appendChild(document.createElement('div'));
    //content.innerHTML = text //+ '<br>Click on the image for more info!';
    arr.id = 'myHoverArrow';
    content.id = 'myHoverContent';
 	t.id = 'myHover';
    arguments.callee.myHover = document.body.appendChild(t);
   }
   return arguments.callee.myHover;
};

var hideImgTitle = function(e){
  var imgTitleHolder = getImgTitle();
  imgTitleHolder.style.display = 'none';
};
var smoothScrollTo = function(){ //nice scrolling (well, kind of) 
   window.scrollBy(0, 5);
   smoothScrollTo.value = smoothScrollTo.value - 5;
   if (smoothScrollTo.value <= 0) window.clearInterval(smoothScrollTo.interval);
}; 

function st(e,img) {
//alert(img.nodeName)
  var tooltip = getToolTip(e, img, oldIE);
  var sid = (typeof img.sid != 'undefined') ? img.sid : img.getAttribute('sid');

  //we need to use either img.title or img.hoverText if image has been already hovered at least once and therefore title was cleared  
  var title = img.title == '' ? img.hoverText : img.title;
  //alert([title, title.length])
  //if the title text is too big, we reduce the font-size
  var titleBox = document.getElementById('myToolTipTitle'); 
  if (titleBox) titleBox.style.height = title.length > 34 ? '34px' : '18px';
  tooltip.setTitle(title); 
  tooltip.setContent(services[sid]);
  
  tooltip.style.marginLeft = '0';
  var tooltipXY = getBounds(tooltip),
      viewportXY = getSize(),
      elementOffset = tooltipXY.top, //element's offset from the top of the page
      viewportScrollOffset = viewportXY.sy, //viewport's scroll offset (how much it's been scrolled)
      elementHeight = tooltipXY.height, //element's height
      viewportHeight = viewportXY.y, //height of the screen (visible viewport)  
      elementRelY = elementOffset - viewportScrollOffset + elementHeight, //bottom border of the element is so far from the current screen top
      notFitting = viewportHeight - elementRelY; //if it's positive, then the element is within boundaries, if negative - some of it's part is outside    
	
  //if the element doesn't fit
  if (notFitting < 0) {
     
      //in normal environment we scroll to it
      if (window.top==window) {
         smoothScrollTo.value = notFitting * -1 + 10;
         smoothScrollTo.interval = window.setInterval(smoothScrollTo, 10);
      } 
      //in iframed environments we shift it vertically (and a little bit to the right) so that it fits
      else {
	     tooltip.style.top = (tooltipXY.top - (notFitting * -1)) + 'px';
         tooltip.style.left = (tooltipXY.left + 12) + 'px';
      }
     
     
  } else {
  
  }
        
  
  //we scroll element only in non-iframed environments
/*  if (window.top==window) {

	  //so if the tooltip doesn't fit
	  if (notFitting < 0) {
	      //we scroll to it if the window is not in the iframe
          smoothScrollTo.value = notFitting * -1 + 10;
          smoothScrollTo.interval = window.setInterval(smoothScrollTo, 10);
	  } else {
//	      tooltip.style.top = (tooltipXY.top - (notFitting * -1)) + 'px';
//	      tooltip.style.left = (tooltipXY.left - 270) + 'px';
	  }
  
  } else {
  
    if (document.body.id == 'step4') {
     tooltip.style.marginLeft = '30px'; 
     tooltip.style.top = '400px';
     tooltip.style.width = '400px';
    } else {
      if (notFitting < 0) {
        tooltip.style.top = (tooltipXY.top - (notFitting * -1)) + 'px';
        tooltip.style.left = (tooltipXY.left - 270) + 'px';
      }
    
    }
  }*/
       
  if(window.event) window.event.cancelBubble = true
  if(e.stopPropagation) e.stopPropagation();
  
  return false;
}

function showStep6Tooltip(e,div) {
  var tooltip = getToolTip(e, div, false);
  tooltip.style['width'] = '250px';
  /*@cc_on tooltip.style.marginTop = '-140px'; @*/
  tooltip.setTitle('');
  text = "<p>You may reserve a ticket up to 180 days before departure of the train without payment.</p>"
  text += "<p>Within 75 days of departure of the train we will confirm in writing the current ticket price(s) for your requested journey.</p>"
  text += "<p>Within 60 days of departure full payment at the current ticket price is required to maintain the reservation or your request will be automatically cancelled. </p>"
  text += "<p>On day 45 before departure (the day the tickets become available for sale) we will book and issue the ticket and an adjustment of the ticket price paid may be made, that is either you will need to pay or we will refund the difference between the pre-payment and the final price.</p>"
  
  tooltip.setContent(text);

  if(window.event) window.event.cancelBubble = true
  if(e.stopPropagation) e.stopPropagation();
  
  return false;
}


function tbcPrice(e,img) {
  var tooltip = getToolTip(e, img);
  tooltip.style['width'] = '150px';
  var sid = (typeof img.sid != 'undefined') ? img.sid : img.getAttribute('sid');
  tooltip.setTitle('Price information');
  tooltip.setContent('Price of tickets to be confirmed by our operators on receipt of your request');

  if(window.event) window.event.cancelBubble = true
  if(e.stopPropagation) e.stopPropagation();
  
  return false;
}

function tbcCount(e,img)
{
  var tooltip = getToolTip(e, img);
  var sid = (typeof img.sid != 'undefined') ? img.sid : img.getAttribute('sid');
  tooltip.setTitle('Tickets availability');
  tooltip.setContent('Availability of tickets to be confirmed by our operators on receipt of your request');

  if(window.event) window.event.cancelBubble = true
  if(e.stopPropagation) e.stopPropagation();
  
  return false;
}

function tooltip45(e, obj) {
  //for IE6 we will create an iframe shim (only this step contains "select" elements)
  var createShim = false; /*@cc_on if(oldIE) createShim = true; @*/
  var tooltip = getToolTip(e, obj, createShim);

  tooltip.setTitle('45 days window');
  tooltip.setContent('As Russian Railways do not provide confirmed train information before 45 days of the requested departure date our system will show you the exact published schedule with estimated ticket classes and prices.');

  if(window.event) window.event.cancelBubble = true
  if(e.stopPropagation) e.stopPropagation();
  
  return false;
}

var ASC = 5;
var DESC = 6;

var getHeaders = function(table){
  for (var a=table.getElementsByTagName('thead')[0].rows[0].childNodes, i=0, b=[], l=a.length; i<l; ++i) if (a[i].nodeType != 3) b.push(a[i]);
  return b;
};
var getRows = function(table){ return table.getElementsByTagName('tbody')[0].rows; };
var getTbody = function(tblId){
  if(typeof document.querySelectorAll != 'undefined') return document.querySelector('#' + tblId + ' tbody');
  return document.getElementById(tblId).getElementsByTagName('tbody')[0];
}


var sortCallback = function(a, b) {
    //we have cellIndex bound to this.ci here and sort direction bound to this.sd (false=ASC, true=DESC)
    var ind = this.ci;
    //alert('comparing prices: ' + a.keys[ind] + ' and ' + b.keys[ind]);
    var c, d;

    if ((ind != 3) || (this.cc == 'All')) {
        c = a.keys[ind];
        d = b.keys[ind];

        //if the column is departure/arrival, we need to check if it's arrival or a departure part the column's sorted by
        if (ind == 1) {
            //var dt1 = new Date(c.split('-')[this.dateIndex] * 1000), dt2 = new Date(d.split('-')[this.dateIndex] * 1000);
            c = c.split('-')[this.dateIndex];
            d = d.split('-')[this.dateIndex];
        }

        if (c == 'TBC') return d == 'TBC' ? 0 : 1; else if (d == 'TBC') return -1;
        if (this.sd == 6) return parseInt(d, 10) - parseInt(c, 10); else return parseInt(c, 10) - parseInt(d, 10);
    } else {
        //we have a special procedure for sorting ticket classes column when user has specified that he wants to see only the specific class
        if (this.sd == 5) { c = a; d = b; } else { c = b; d = a; }
        if ((typeof c.prices[this.cc] == 'undefined') || (c.prices[this.cc] == '0') || (c.prices[this.cc] == '')) return typeof d.prices[this.cc] == 'undefined' ? 0 : 1;
        else if (typeof d.prices[this.cc] == 'undefined') return -1;
        return c.prices[this.cc][0] - d.prices[this.cc][0]; //we always sort by minimal price in class
    }
};

var sortTable = function(){
  //we get the object from the array of prepared tables
  var tbl = window.preparedTables[this.tblId];

  //we go through all the headers of the prepared table and set sorting arrow symbol only for the current one
  for(var i=0,l=tbl.headers.length,ci=this.cellIndex,reg1=new RegExp('sortedByHeaderA'),reg2=new RegExp('sortedByHeaderD'),hdr; i<l; ++i) { 
    hdr = tbl.headers[i];
    //if clicked = current
    if (hdr.cellIndex == ci) {
      //if currentSorted = current one, then we swap direction
      if (tbl.ci == ci) {
        if (reg1.test(hdr.className)) hdr.className = hdr.className.replace(' sortedByHeaderA', ' sortedByHeaderD');
        else {
          if (reg2.test(hdr.className)) hdr.className = hdr.className.replace(' sortedByHeaderD', ' sortedByHeaderA');
          else hdr.className += ' sortedByHeaderD';
        }
        hdr.sortDir = hdr.sortDir == ASC ? DESC : ASC;     
      } else {
        //otherwise we set set direction to the default value (ASC)  
        hdr.sortDir = ASC;
        hdr.className += ' sortedByHeaderD';
      }
    } else {
      hdr.className = hdr.className.replace(' sortedByHeaderA', '').replace(' sortedByHeaderD', '');
      hdr.sortDir = ASC;
    }
  }
  tbl.ci = ci;  //save currently sorted cellIndex for future use
  //alert('sortSelect-' + this.tblId)
  var sortSelect = document.getElementById('sortSelect-' + this.tblId);
  var val = sortSelect.options[sortSelect.selectedIndex].value;

  //we sort the array of rows in TBODY by sortCallBack
  tbl.rows.sort(sortCallback.bind({ ci: this.cellIndex, sd: this.sortDir, cc: tbl.showClassesMode, dateIndex: val == 'arrivalTime' ? 1 : 0 }));

  sortSelect.selectedIndex = [4, (val == 'arrivalTime' ? 2 : 1), 3, 0][tbl.ci];
  tbl.headers[0].parentNode.className = 'sorted_' + sortSelect.options[sortSelect.selectedIndex].value;

  //and then we just reorder rows by appending them to actual TBODY from our sorted array
  reg = new RegExp('no');  
  for( var i=0,tbody=getTbody(this.tblId),l=tbl.rows.length, k=0, row; i<l; ++i) {
    row = tbody.appendChild(tbl.rows[i]);
    if (!reg.test(row.className)) row.className = k++%2 ? 'even' : 'odd';
  }
};

var prepareTable = function(tbl) {
  //if our global array of prepared tables is not defined yet, we define it here
  if (typeof window.preparedTables == 'undefined') window.preparedTables = []; 
  
  //alert(tbl.id);
  //we prepare the table only if it hasn't been prepared yet
  if (typeof window.preparedTables[tbl.id] == 'undefined') { 
    var rows = getRows(tbl);
    
    var currentTblNum = {'yui-dt0-bodytable': 0, 'yui-dt1-bodytable': 1}[tbl.id];
    var currentTrId = 'passed_' + currentTblNum;
    var currentTrainNum = isNaN(trainsPassed[currentTblNum]) ? 0: trainsPassed[currentTblNum];

    //we colorify odd/even rows - could be done via CSS nth selectors, but Trident currently doesn't support it
    for (var i=0, l=rows.length, rowsArray = [], tr, ts, tp, j, m, pr1, pr2; i<l; ++i) {
      tr = rows[i];
      tr.className = i%2 ? 'even' : 'odd';
      
      //the array of keys is saved as the row's attribute 
      tr.keys = (tr.keys || tr.getAttribute('keys')).split('|');
      
      //if a train number has been passed, mark its TR
      if (currentTrainNum == parseInt(tr.keys[0], 10)) {
    	  tr.id = currentTrId;
    	  tr.getElementsByTagName('input')[0].checked = true;
      }

      //the array of ticket types is saved as the row's attribute
      tr.tTypesJs = tr.tTypesJs || tr.getAttribute('tTypesJs'); //ts.substring(0, ts.length-1).split(',')
      
      //the object with prices per ticket type is saved as well
      tr.prices = {};
      tp = (tr.keys_prices || tr.getAttribute('keys_prices')).split(',');
      for(j=0, m=tp.length;j<m;++j) {
        pr1 = tp[j];
        tr.prices[pr1.substring(0,3)] = pr1.substring(4,pr1.length-3).split('-'); 
      }
      
      //all the rows are added to an array for further sorting 
      rowsArray.push(tr);
    }
    
//    alert(getHeaders(tbl)[0]);
    //then we set onclick handlers for TH's 
    for(var i=0,headers=getHeaders(tbl),l=headers.length,dontSort=false,hdr; i<l; ++i) {
      hdr = headers[i]; 
      //if (hdr.nodeType == 3) continue; //skip the empty text nodes
      if (typeof hdr.getAttribute('dontSort') == 'string') continue;
      //if ((typeof hdr.dontSort != 'undefined') || (typeof hdr.getAttribute('dontSort') != 'undefined')) continue;
      hdr.tblId = tbl.id;
      hdr.onclick = sortTable;
    }

    //and save our rows array, sortedCell is -1 by default and showClassesMode is All
    window.preparedTables[tbl.id] = {headers: headers, rows: rowsArray, sortedCellId: -1, showClassesMode: 'All'};
  }
  
  return window.preparedTables[tbl.id];
};

var doSorting = function(tblId, dd) {
    //alert('doSorting has just been called');
    var index = [3, 1, 1, 2, 0][dd.selectedIndex];
    var headers = getHeaders(document.getElementById(tblId));

    //here we just fire an onclick event to launch sorting
    headers[index].onclick();
};

var setClass = function(tblId, dd){
  var val = dd.options[dd.selectedIndex].value.substring(0,3);
  var tbl = window.preparedTables[tblId];
  
  //we set current classes display mode 
  tbl.showClassesMode = val;
  document.getElementById(tblId).className = 'trainsTable so' + val;

  //if we use 'gi', the lastIndex is advanced on any iteration with a match and is set to 0 on all others.
  //so if there's two, say, VIP class TRs right next to each other, the second one won't match because of the lastIndex being set to 2
  var reg = new RegExp(val, 'i');    
  var noClass = 'no' + val + ' ';
  //then we go through all the rows and set those which don't have current class to hide 
  for (var i=0, rows=tbl.rows, k=0, row, ttypes; (row=rows[i]); ++i) {
     
     // if it's 'All' then we need to set odd/even for all rows 
     // else if there's a selected class - just odd/even for shown rows
     //      else - noClass
     if (val == 'All') row.className = i%2 ? 'odd' : 'even';    
     else {
       if (!reg.test(row.tTypesJs)) row.className = noClass;
       else row.className = ++k%2 ? 'odd' : 'even';
     }
     
     ///if ((val!='All') && (!reg.test(row.tTypesJs))) { row.className += noClass; continue; }
     
     //row.className = ++k%2 ? 'odd' : 'even';
  }
  updateParent();
};

function setStepLinks(){
	var elem = document.getElementById("stepLink1");
	if(elem && (typeof breadCrumbsLink1 != 'undefined'))
		elem.href = breadCrumbsLink1;
	elem = document.getElementById("stepLink2");
	if(elem && (typeof breadCrumbsLink2 != 'undefined'))
		elem.href = breadCrumbsLink2;
	elem = document.getElementById("stepLink3");
	if(elem && (typeof breadCrumbsLink3 != 'undefined'))
		elem.href = breadCrumbsLink3;
	elem = document.getElementById("stepLink4");
	if(elem && (typeof breadCrumbsLink4 != 'undefined'))
		elem.href = breadCrumbsLink4;						
} 

function otrackRefresh(){
	setTimeout('window.location.replace("otrack.php")', 10000)
}

function showHideDiv(self, postfix){
	var hm
	var p = self.parentNode
	for(var i=0; i<p.childNodes.length; i++){
		if(p.childNodes[i].className)
			hm = p.childNodes[i].className.match(/hiddable/)
		else
			continue
		if(p.childNodes[i].className == 'ex_img' || p.childNodes[i].className == 'ex_points' || p.childNodes[i].className == 'ex_details' || hm){
			if(p.childNodes[i].style['display'] == 'block' || p.childNodes[i].style['display'] == ''){
				p.childNodes[i].style['display'] = 'none'
				self.innerHTML = postfix+' information'
			}else{
				p.childNodes[i].style['display'] = 'block'
				self.innerHTML = 'hide information'
			}
		}
	}
	return false
}

function setExImgBtns(){
	var links = document.getElementsByTagName('a')
	for(var i=0; i<links.length; ++i){
		if(links[i].className == 'ex_img_btn'){
			links[i].onclick = function(){var self=this;return showHideDiv(self,'more')}
		}
		if(links[i].className == 'ex_points_btn'){
			links[i].onclick = function(){var self=this;return showHideDiv(self,'more')}
		}
	}
	var divs = document.getElementsByTagName('div')
	for(var i=0; i<divs.length; ++i){
		if(divs[i].className == 'ex_img'){
			divs[i].style['display'] = 'none'
		}
		if(divs[i].className == 'ex_points'){
			divs[i].style['display'] = 'none'
		}
		if(divs[i].className == 'ex_details'){
			divs[i].style['display'] = 'none'
		}
		if(divs[i].className == 'ex_cities'){
			for(var j=0; j<divs[i].childNodes.length; ++j){
				if(!divs[i].childNodes[j].className)
					continue
				var hm = divs[i].childNodes[j].className.match(/hiddable/)
				if(hm){
					divs[i].childNodes[j].style['display'] = 'none'
				}
			}
		}
	}

}

DomLoaded.load(function(){

 //as IE6 on XP SP3 machine now reports 5.7 for @jscript_version, we can't check if it's IE6 or IE7 by using conditional compilation as before
 //that's why we have to use conditional comments (see bottom.tpl) to set global variable for IE6 only 
 if (typeof window.oldIE == 'undefined') window.oldIE = false;

 //prepare links in the main navigation
 prepareLinks();

 //prepare breadcrumbs links
 //setStepLinks();

 setExImgBtns()

 if(typeof(jQuery)!='undefined' && typeof(jqReady)!='undefined')jqReady()
});


