function viewBig(oImg)
{
//	Slimbox.open(oImg.src.replace("/preview/", "/fullsize/"));
//	bigImg = window.open("", "_blank", "resizable=1, scrollbars=1");
//	bigImg.document.write("<html><body onload='window.moveTo(0 ,0);window.resizeTo(document.getElementById(\"Img\").width+18, document.getElementById(\"Img\").height+60);' onclick='window.close();' style='margin:0px;padding: 0px;'><img id='Img' src='"+oImg.src.replace("/preview/", "/fullsize/")+"' /></body></html>");
//	bigImg.document.close();
}// end of function viewBig(oImg)

function viewBigOld(oImg)
{
	bigImg = window.open(oImg.src.replace("/preview/", "/fullsize/"), "_blank", "none");
}// end of function viewBig(oImg)

//#######################################################################################
function open_href(objHref, strTarget)
{// function for open window in XHTML 1.1 strict - no target by anchor is allowed
 	window.open(objHref.href, strTarget);
 	return false;
}// end of function window_open_href(objHref)

function fireChangeEvent(control, targetWindow) 
{ 
	if(!targetWindow)targetWindow = window;
    if (document.all) 
    { 
        control.fireEvent("onchange"); 
    } 
    else 
    { 
		var changeevent=targetWindow.document.createEvent("HTMLEvents")
		changeevent.initEvent("change", true, true)
		control.dispatchEvent(changeevent)
    } 
}// end of function fireChangeEvent(control, targetWindow) 

function shopCheckDeposit(oInput, strDeposit, variantSelectType, strAlert)
{
	var maxDeposit = -1;
	var	idSelectedVariant = 0;
	// 1 - get variant select type and selcted variant value
	if(strDeposit.indexOf(",") != -1)
	{// are variants
		arrDeposit = strDeposit.split(",");
		if(variantSelectType == 0)
		{// checkbox
			// get checked variant
			for(i=0; i< arrDeposit.length; ++i)
			{
				arrDepositVariant = arrDeposit[i].split("-");
				oChkbox = document.getElementById("variant_radio_"+arrDepositVariant[0]);
				if(oChkbox && oChkbox.checked)
					idSelectedVariant = arrDepositVariant[0];
			}// end of for 
			
		}else
		{// selectbox
			idSelectedVariant = document.getElementById("IdVariant-"+parseInt(arrDeposit[0])).value;
		}// end of else

		// get max items on deposit
		for(i=1; i< arrDeposit.length; ++i)
		{
			arrDepositVariant = arrDeposit[i].split("-");
			if(arrDepositVariant[0] == idSelectedVariant)
				maxDeposit = arrDepositVariant[1];
		}// end of for 
			
	}// end of if are variants
	// if is no deposit by variant or are no variants use deposit from article
	if(maxDeposit == -1)
		maxDeposit = parseInt(strDeposit.substr(strDeposit.indexOf("-")+1));// there are no variants
	if(maxDeposit != -1 && parseInt(oInput.value) > parseInt(maxDeposit))
	{
		oInput.value=maxDeposit;
		window.alert(strAlert.replace("{Count}", maxDeposit));
	}// end of if is value more than maxDeposit	
}// end of function shopCheckDeposit(oInput, strDeposit, variantSelectType, alert)

function displayHideSubmenu()
{
	var submenu = document.getElementById('menu_item_2');
	
	if(submenu.style.display == 'none')
		submenu.style.display = '';
	else
		submenu.style.display = 'none';
	
	return false;
}

function displayHideEnhancedSearch()
{
	var submenu = document.getElementById('vyhledavani_rozsirene');
	
	if(submenu.style.display == 'none')
	{
		//submenu.style.display = '';
		jQuery(enhSearch).slideDown('slow');
		setcookie(filename+"EnhSearchVisible", "1", 31*6);//6 months
	}
	else
	{
		//submenu.style.display = 'none';
		jQuery(enhSearch).slideUp('slow');
		setcookie(filename+"EnhSearchVisible", "1", 31*6);//6 months
	}
	
	return false;
}

/*
// zakaz kopirovani textu
function disabletext(e){return false}
function reEnable(){return true} 
//if the browser is IE4+
document.onselectstart=new Function ("return false") 
//if the browser is NS6
if (window.sidebar){
	document.onmousedown=disabletext
	document.onclick=reEnable
} 
*/

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

/*
// disable right click
var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
*/

function setcookie(name,value,duration)
{
 window.document.cookie = name+"="+escape(value)+ ";expires="+getexpirydate(duration)+";path=/";
}// end of function setcookie(name,value,duration)

function getcookie(name)
{
 var cookiestring=""+window.document.cookie;
 var index1=cookiestring.indexOf(name);
 if (index1==-1) return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(cookiestring.substring(index1+name.length+1,index2 ));
}// end of function getcookie(name)

function getexpirydate(nodays)
{
 var UTCstring;
 Today = new Date();
 nomilli=Date.parse(Today);
 Today.setTime(nomilli+nodays*24*60*60*1000);
 UTCstring = Today.toUTCString();
 return UTCstring;
}// end of function getexpirydate(nodays)

/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/
 
var Url = {
 
  // public method for url encoding
  encode : function (string) {
    return escape(this._utf8_encode(string));
  },
 
  // public method for url decoding
  decode : function (string) {
    return this._utf8_decode(unescape(string));
  },
 
  // private method for UTF-8 encoding
  _utf8_encode : function (string) {
    string = string.replace(/\r\n/g,"\n");
    var utftext = "";
 
    for (var n = 0; n < string.length; n++) {
 
      var c = string.charCodeAt(n);
 
      if (c < 128) {
        utftext += String.fromCharCode(c);
      }
      else if((c > 127) && (c < 2048)) {
        utftext += String.fromCharCode((c >> 6) | 192);
        utftext += String.fromCharCode((c & 63) | 128);
      }
      else {
        utftext += String.fromCharCode((c >> 12) | 224);
        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
        utftext += String.fromCharCode((c & 63) | 128);
      }
 
    }
 
    return utftext;
  },
 
  // private method for UTF-8 decoding
  _utf8_decode : function (utftext) {
    var string = "";
    var i = 0;
    var c = c1 = c2 = 0;
 
    while ( i < utftext.length ) {
 
      c = utftext.charCodeAt(i);
 
      if (c < 128) {
        string += String.fromCharCode(c);
        i++;
      }
      else if((c > 191) && (c < 224)) {
        c2 = utftext.charCodeAt(i+1);
        string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
        i += 2;
      }
      else {
        c2 = utftext.charCodeAt(i+1);
        c3 = utftext.charCodeAt(i+2);
        string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
        i += 3;
      }
 
    }
 
    return string;
  }
 
}

// standart string replace functionality
function str_replace(haystack, needle, replacement) {
  var temp = haystack.split(needle);
  return temp.join(replacement);
}

