// Default JavaScript Document
eval("try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}");

function obj(id) {
	return document.getElementById(id);
}
/* Obecné funkce */
function a_href(url) {
	if (url == "#") return false;
	var w = window.self;
	w.location.href = url;
}
function a_href_win(url) {
	if (url == "#") return false;
	var w = window.open(url);
}
function openWin(name,url,w,h,scrll) {
	if (!scrll) { scrll = "no"; }
	var winL = (screen.width - w) / 2;
	var winT = (screen.height - h) / 2;
	var prop = 'menubar=no,resizable=no,scrollbars='+scrll+',status=no,toolbar=no,locationbar=no,directories=no';
	prop += ',width='+w+',height='+h+',left='+winL+',top='+winT;
	Win = window.open(url,name,prop);
	Win.focus();
}
function showOfficeMap(loc) {
  openWin('office', loc, 820, 544, 1);
	return false;
}
function clearInput(o,defaultValue) {
	if (o.value == defaultValue ) o.value = "";
	focusObj = o;
}
function defaultInput(o,defaultValue) {
	if (o.value == "" ) o.value = defaultValue;
}
/* BrowserCheck Object */
function supportedBrowser() {
  try {
    var strVersion = $.browser.version;
    var index = strVersion.indexOf(".");
    if (index > -1) {
      var index2 = strVersion.indexOf(".", index + 1);
      if (index2 == -1) index2 = strVersion.length; 
      strVersion = strVersion.substr(0, index2);
    }
    
    var version = parseFloat(strVersion);
    
    if ($.browser.msie && version >= 6) return true;
    if ($.browser.mozilla && version >= 1.5) return true;
    if ($.browser.opera && version >= 9) return true;
    if ($.browser.safari) return true;
  } catch (err) {
    return false;
  }
}
if (supportedBrowser()) {
  $(document).ready(function() {
  	if ($(".objWidgetHide")) $(".objWidgetHide").hide("fast");
  	if ($(".objWidgetShow")) $(".objWidgetShow").show("fast");
  	if ($(".objLogMenu")) $(".objLogMenu").hide("fast");
});
}
/* Rychlá navigace*/
function manageShow(idObj)	{
  if (supportedBrowser()) {
    var elmFired = $("#obj-" + idObj).get(0);
  	$("#obj-" + idObj).slideToggle("normal");
	var _actAnchorID = "#a-" + idObj;
    $(_actAnchorID).get(0).focus();
	$(_actAnchorID).toggleClass("hide-item").toggleClass("show-item");
		
		$(".objWidgetHide").each(
      function(i){
        if (this != elmFired && this.style.display != 'none') $(this).slideUp();
      }
    );
		
		$(".objWidgetShow").each(
      function(i){
        if (this != elmFired && this.style.display != 'none') $(this).slideUp();
      }
    );
		
  	return false;
  }
}
/* Log menu */
function manageLogMenu(idObj)	{
  if (supportedBrowser()) {
    var elmFired = $("#obj-" + idObj).get(0);
  	$("#obj-" + idObj).slideToggle("normal");
	var _actAnchorID = "#a-" + idObj;
    $(_actAnchorID).get(0).focus();
	$(_actAnchorID).toggleClass("show-item").toggleClass("hide-item");
		$(".objLogMenu").each(
      function(i){
        if (this != elmFired && this.style.display != 'none') $(this).slideUp();
      }
    );
  	return false;
  }
}
/* JS k produktu Novera Komplet office */
var currentType = 0;
function showType(index) 
{ 
	document.getElementById("type" + index).style.display = "block"; 
}
function hideType(index) 
{ 
	document.getElementById("type" + index).style.display = "none"; 
}
function initTypesBlocks()
{
  hideType(2);
  hideType(3);
	document.getElementById("linkType1").className = "strong-b";
	document.getElementById("imgType1").src = "/img/u/4css/ICO_link_arrow-black.gif";
	currentType = 1;
}
function setType(index)
{
	if ( currentType > 0 )
	{
	  hideType(currentType);
	  document.getElementById("linkType" + currentType).className = "";
	  document.getElementById("imgType" + currentType).src = "/img/u/4css/ICO_link_arrow-blue.gif";
	}
  showType(index);
  document.getElementById("linkType" + index).className = "strong-b";
  document.getElementById("imgType" + index).src = "/img/u/4css/ICO_link_arrow-black.gif";
  currentType = index;
  return false;
}

/* COOKIE FUNCTION */
/* nastaveni */
function qSet_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
/* zjistí zda existuje */
function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) &&
	( name != document.cookie.substring( 0, name.length ) ) )
	{
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
/* smaže zavolané cookie */
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}	
// Cookie pro NOVERA Partner ID
var cid = Get_Cookie('partner_cid');

