var params = {wmode:'transparent'};
swfobject.embedSWF("/swf/banner.swf?clickthru=/banner/t-29", "bannery", "170", "200", "9.0.0", "../swf/ei.swf", "", params, "");

function VA_GetElementById(divID, oDoc) {
  if( !oDoc ) { 
    oDoc = document; 
  }

  if( oDoc.layers ) {
    if( oDoc.layers[divID] ) {
      return oDoc.layers[divID];
    } else {
      /* repeatedly run through all child layers */
      for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
        /* on success, return that layer, else return nothing */
        y = VA_GetElementById(divID, oDoc.layers[x].document);
      }
      return y;
    }
  }

  if (oDoc.getElementById ) {
    return oDoc.getElementById(divID);
  }

  if( oDoc.all ) {
    return oDoc.all[divID];
  }

  return false;
}

function VA_FireChangeEvent(elem) {
  if (document.createEvent) {
    var newEvt = document.createEvent("HTMLEvents");
    newEvt.initEvent("change",true,true);
    elem.dispatchEvent(newEvt);
  } else {
    var evt = document.createEventObject();
    elem.fireEvent("onchange", evt);
    evt.cancelBubble = true;
  }
}

//- nospam
function nospamf(box, domain) {
 if(typeof(domain)=="undefined") domain="smarteo.cz";
 var proto=String.fromCharCode(109,97,105,108,116,111,58)
 w=window.open(proto+box+String.fromCharCode(64)+domain);
 if (w!=null) w.close(); //FF
}
function nospam(box, domain, attr) {
 if(typeof(domain)=="undefined") domain="smarteo.cz";
 if(typeof(attr)=="undefined") attr="";
 document.write("<a href=\"javascript:nospamf('"+box+"', '"+domain+"')\""+(attr.length>0?" ":"")+attr+">"+box+String.fromCharCode(64)+domain+"</a>");
}
function zavinac() {
 document.write(String.fromCharCode(64));
}
//- /nospam

function monthnum(month) {
  var arr_mon = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  
  for(i=0; i<arr_mon.length; i++) {
    if(month == arr_mon[i]) {
      return i+1;
    }  
  }
}

function unix2date(timestamp) {
  var date = new Date(timestamp * 1000);
  datestring = date.toGMTString();
	arr_datestring = datestring.split(" ");
  
  var month = monthnum(arr_datestring[2]);
  var day   = arr_datestring[1];
  var year  = arr_datestring[3];  
  
  //if(day <= 9) { day = "0" + day; }
  if(month <= 9) { month = "0" + month; }  
  
  return day + "." + month + "." + year;
}

function date2unix(day, month, year) {
  var date = new Date(Date.UTC(year, (month-1), day, 0, 0, 0));
	return (date.getTime()/1000.0);
}

//kontroluje, jestli je číslo zadáno správně, a vrátí buď false, nebo třídu, která obsahuje číslo rozdělené do částí
//povolený jsou jenom číslice, "." "," " " jako oddělovače, mezera jenom jako oddělovač tisícovek
function splitNumberIntoParts(vstup, desetinyAllowed) {
	var delka = vstup.length;
	var rslt = MakeClass(Array(Array("desetiny", "''"), Array("tisice", "new Array()")));
	var desetinFound = 0; //0:číslo neobsahuje desetiny, 1:číslo moľná obsahuje desetiny, uvidí se podle daląích oddělovacích znaků, 2: číslo určitě obsahuje desetiny
	var desetinZnak = "";
	var tisiceZnak = "";
	var actualPart = "";
	var lastSep = 0;
	var beforeFirstSep = 0;
	if (delka !=0) {
		for (var i = delka-1; i >= 0; i--)	{ //budu procházet řetězec od konce
			var znak = vstup.substring(i,i+1);
			if ((znak < "0" || znak > "9")) { //cokoliv jinýho neľ číslice kontroluju
				if (znak == "," || znak == "." || znak == " ") { //povolený jsou jeno čárka, tečka a mezera
					if (znak != tisiceZnak) {
						if (tisiceZnak != "") { //jestliľe uľ vím, co je oddělovačem tisícovek, je jakejkoliv jinej znak neľ číslice a oddělovač tisícovek zakázanej
							rslt = false;
							break;
						}
						if (znak == " ") {
							//jestliľe se dostanu sem, vím určitě, ľe nemám nadefinovanej oddělovač tisícovek.
							//a mezera je povolená jenom na oddělování tisícovek
							if (lastSep != 3) {
								rslt = false;
								break;
							}
							tisiceZnak = " ";
							rslt.tisice[rslt.tisice.length] = vstup.substring(i+1, i+4);
							actualPart = "";
							lastSep = 0;
							if (desetinFound == 1) {
								desetinFound = 2;
							}
						} else {
							//jestliľe se dostanu sem, vím určitě, ľe nemám nadefinovanej oddělovač tisícovek.
							if (desetinFound == 0) { //pokud jsem se jeątě nesetkal s moľným oddělovačem desetin, mohl by toto být oddělovač desetin
								desetinFound = 1;
								desetinZnak = znak;
								beforeFirstSep = lastSep;
								rslt.desetiny = vstup.substring(i+1, i+1+beforeFirstSep);
								actualPart = "";
								lastSep = 0;
							} else if (znak == desetinZnak) {
								//jestli se dostanu sem, vím určitě, ľe číslo neobsahuje desetiny, a tento oddělovač je oddělovačem tisícovek. Taky vím, ľe tenhle znak uľ je tady podruhé a zkontroluju, kolik číslic je před prvním oddělovačem
								if (lastSep != 3 || beforeFirstSep != 3) {
									rslt = false;
									break;
								}
								tisiceZnak = znak;
								rslt.tisice[rslt.tisice.length] = rslt.desetiny;
								rslt.desetiny = "";
								rslt.tisice[rslt.tisice.length] = vstup.substring(i+1, i+4);
								actualPart = "";
								lastSep = 0;
								desetinFound = 0;
							} else {
								//jestli se dostanu sem, vím určitě, ľe číslo obsahuje desetiny, a tento oddělovač je oddělovačem tisícovek
								if (lastSep != 3) {
									rslt = false;
									break;
								}
								tisiceZnak = znak;
								rslt.tisice[rslt.tisice.length] = vstup.substring(i+1, i+4);
								actualPart = "";
								lastSep = 0;
								desetinFound = 2;
							}
						}
					} else { //pokud se znak rovná znaku oddělujícímu tisícovky, kontroluju pouze jeho pozici
						if (lastSep != 3) {
							rslt = false;
							break;
						}
						rslt.tisice[rslt.tisice.length] = vstup.substring(i+1, i+4);
						actualPart = "";
						lastSep = 0;
					}
				}	else { //jakýkoliv jiný znak znamená ąpatné číslo
					rslt = false;
					break;
				}
			} else { //je to číslice, zvětąím počet číslic od posledního oddělovače
				lastSep++;
				if (desetinFound > 0 || rslt.tisice.length > 0) {
					if (lastSep == 4) {
						rslt.tisice[rslt.tisice.length] = actualPart;
						lastSep = 1;
						actualPart = "";
					}
				}
				actualPart = znak+actualPart;
			}
		} //end for
		if (desetinFound > 0) {
			if (desetinyAllowed == false) {
				rslt = false;
			}
		}
		if (rslt != false && actualPart != "") {
			rslt.tisice[rslt.tisice.length] = actualPart;
		}
		if (rslt != false && rslt.desetiny == "" && rslt.tisice[0] == vstup) {
			rslt.tisice = new Array();
			actualPart = "";
			lastSep = 0;
			for (var i=delka-1; i>=0; i--) {
				lastSep++;
				if (lastSep == 4) {
					rslt.tisice[rslt.tisice.length] = actualPart;
					lastSep = 1;
					actualPart = "";
				}
				actualPart = vstup.substring(i, i+1)+actualPart;
				if (i == 0)
					rslt.tisice[rslt.tisice.length] = actualPart;
			}
		}
	}
	return rslt;
} //end function splitNumberIntoParts

function format_price(price) {
	var formatted_price = "";
	var number;
	if (price != "") {
		number = splitNumberIntoParts(price, false);
		if (number == false) {
			formatted_price = "";
		} else {
			if (number.desetiny != "") {
				formatted_price = "" + number.desetiny;
			}
			for (var i=0; i < number.tisice.length; i=i+1) {
				if (i==0)
					formatted_price = number.tisice[i] + formatted_price;
				else
					formatted_price = number.tisice[i] + " " + formatted_price;
			}
		}
	}
	return formatted_price + ",- Kč";
} //end function formatujCenu

function clear_price_formatting(price) {
  price = price.replace(/,- Kč/g, "");  
  price = price.replace(/ /g, "");
  return price;
}

function MakeClass(iFields) {
	for (var i=0;i<iFields.length;i++) {
		eval("this."+iFields[i][0]+"="+iFields[i][1]);
	}
	return this;
}

function MakeClassArray(iFields, iPocet) {
	this.length = iPocet;
	for (var i=0;i<iPocet;i++)
		this[i] = new MakeClass(iFields);
	return this;
}

function MakeArray(iPocet) {
	this.length = iPocet;
	for (var i=0;i<iPocet;i++)
		this[i] = 0;
	return this;
}


function goback(step) {
  var VA_next_step = VA_GetElementById('VA_next_step');
  VA_next_step.value = step;
  VA_GetElementById('VA_action').value = 'b';
  document.f_product.action = document.f_product.action + '#f';
  document.f_product.submit();
}

function formcancel() {
  var VA_next_step = VA_GetElementById('VA_next_step');
  VA_next_step.value = 1;
  VA_GetElementById('VA_action').value = 'c';
  document.f_product.submit();
}

function payment_select (key, group) {
  var VA_step3_checked = new Array;
   VA_step3_checked[1] = VA_GetElementById('c-1').value;
   VA_step3_checked[2] = VA_GetElementById('c-2').value;

  var g = key.substr(0,1);
  for(i = 0; i < 10; i++)
  {
	  e = VA_GetElementById('row_'+g+i);
	  if(e)
	  {
	   e.className = 'row';	
	  }
  }
  
   
  var chbox = VA_GetElementById('chbox_'+key);
  var row = VA_GetElementById('row_'+key);
  
  var chbox_p = new Array;
   chbox_p[group] = 0;
  var row_p = new Array;
   chbox_p[group] = 0;
  
  if(VA_GetElementById('row_'+VA_step3_checked[group]) && VA_GetElementById('chbox_'+VA_step3_checked[group])) {
    chbox_p[group] = VA_GetElementById('chbox_'+VA_step3_checked[group]);
    row_p[group] = VA_GetElementById('row_'+VA_step3_checked[group]);
  }
  
  if(chbox_p[group] && row_p[group]) {
    chbox_p[group].checked = false;
    row_p[group].className = 'row';
  }
  
  chbox.checked = true;
  row.className = 'row-over';
    
  
  VA_step3_checked[group] = key;
  VA_GetElementById('c-'+group).value = key;
  
  return true;
}

function row_hover (event, key, group) {
  var VA_step3_checked = new Array;
   VA_step3_checked[1] = VA_GetElementById('c-1').value;
   VA_step3_checked[2] = VA_GetElementById('c-2').value;
  
  var row_h = VA_GetElementById('row_'+key);
  var chbox_h = VA_GetElementById('chbox_'+key);
  
  if(key != VA_step3_checked[group]) {
    if(event == "over") {
      row_h.className = 'row-over';
    } else if(event == "out") {
      if(chbox_h.checked != true) {
        row_h.className = 'row';
      }  
    }
  }
  
  return true;
}

this.tooltip = function(){	
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result				
	$("a.tooltip").hover(function(e){	
		this.t = this.title;
		this.title = "";									  
		$("body").append("<div id='tooltip'>"+ this.t +"</div>");
		$("#tooltip").css({
			"top": (e.pageY - xOffset) + "px",
			"left": (e.pageX + yOffset) + "px"
		});
		$("#tooltip").fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

//starting the script on page load
$(document).ready(function(){
	tooltip();
});