// KOMPATIBILITA

var Br = new BrCheck()

function BrCheck()
{
	this.VER	= navigator.appVersion;
	this.AGENT	= navigator.userAgent.replace(/[\/]/g,' ');
	this.DOM	= document.getElementById ? true:false;

	this.OP5	= this.AGENT.indexOf("Opera 5")>-1							?true:false;
	this.OP6	= this.AGENT.indexOf("Opera 6")>-1							?true:false;
	this.OP7	= this.AGENT.indexOf("Opera 7")>-1							?true:false;
	this.OP8	= this.AGENT.indexOf("Opera 8")>-1							?true:false;
	this.OP		= (this.OP5 || this.OP6 || this.OP7 || this.OP8);

	this.IE4	= (document.all && !this.DOM && !this.OP)					?true:false;
	this.IE5	= (this.VER.indexOf("MSIE 5")>-1 && this.DOM && !this.OP)	?true:false; 
	this.IE6	= (this.VER.indexOf("MSIE 6")>-1 && this.DOM && !this.OP)	?true:false;
	this.IE7	= (this.VER.indexOf("MSIE 7")>-1 && this.DOM && !this.OP)	?true:false;
	this.IE8	= (this.VER.indexOf("MSIE 8")>-1 && this.DOM && !this.OP)	?true:false;
  this.IE9	= (this.VER.indexOf("MSIE 9")>-1 && this.DOM && !this.OP)	?true:false;
	this.IE		= (this.IE4 || this.IE5 || this.IE6 || this.IE7 || this.IE8 || this.IE9);

	this.NS4	= (document.layers && !this.DOM)							?true:false;
	this.NS7	= (this.DOM && parseInt(this.VER) >= 5 && this.AGENT.lastIndexOf('Netscape')<this.AGENT.lastIndexOf('7'))?true:false;
	this.NS6	= (this.DOM && parseInt(this.VER) >= 5 && !this.NS7)		?true:false;
	this.NS		= (this.NS4 || this.NS6 || this.NS7);

	return this;
}

function getE(objectID)     {   return document.getElementById(objectID); }
function getF(formName)     {	return document.forms[formName];}

function SetDSP(nDSP, sURL) {
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() + 14);

	if (nDSP==1) 
	{
		document.cookie="DSP=1; expires="+vyprs.toGMTString()+";path=\/";
	} 
	else 
	{
		document.cookie="DSP=0; expires="+vyprs.toGMTString()+";path=\/";
	}
	if (getE('RedirOnListCagChange')!=null) window.location.href=sURL;
}



// ###   FCE PRO DIALOG ZADANI VOLITELNYCH PARAMETRU   ###
var gsFormSuffix, gsFormIndex;

function BuyOrSetVariableParams(sFormSuffix,sFormIndex) {
	var sSelects, nWindowHeight;
	gsFormIndex = sFormIndex;
	gsFormSuffix = sFormSuffix;

	sSelects = getE("DivForPars" + sFormSuffix + sFormIndex).innerHTML;
	// ve skeletu musí být ve fci GetFormattedParams "ParamItem" psáno CASE-SENSITIVE !!!
	if (sSelects == "") {
		getF("BuyForm" + sFormSuffix + sFormIndex).submit();
	} else {
		// 22 je výška selectu - definováno raději i podle stylu!
		// nWindowHeight = 86 + 22 * (sSelects.split("ParamItem").length);
		getE('DivForParams').innerHTML = getE("DivForPars" + sFormSuffix + sFormIndex).innerHTML;
		getE('ParamCaption').innerHTML = getE("BuyForm" + sFormSuffix + sFormIndex).NameItem.value;
		getE('ParamTbl').style.top =  window.event.srcElement.offsetTop + 20;
		getE('ParamTbl').style.left =  window.event.srcElement.offsetLeft - 60;
		getE('ParamTbl').style.display = 'inline';
	}
}

function getParamItem(idForm){	
	var frm = getE(idForm)//.elements
	var strValue = "";
	//var frm = document.forms.idForm.elements;	
	var ParamItemElmnts = document.getElementsByName("ParamItemSelect");
	if(ParamItemElmnts!=null){	
	for(var i = 0 ;i < ParamItemElmnts.length;i++){
		var chr= String.fromCharCode(32 ,32 ,32, 32 ,32 )	
		strValue += ParamItemElmnts[i].value + chr + "  ";	
	}
	frm.ParamItem.value=strValue ;
	}
	
	return strValue ;
}
//========Validation number=====================================================

function extractNumberEX(obj, decimalPlaces, allowNegative)
{
	var temp = obj.value;

	// avoid changing things if already formatted correctly
	var reg0Str = '[0-9]*';
	if (decimalPlaces > 0) {
		reg0Str += '\\.?[0-9]{0,' + decimalPlaces + '}';
	} else if (decimalPlaces < 0) {
		reg0Str += '\\.?[0-9]*';
	}
	reg0Str = allowNegative ? '^-?' + reg0Str : '^' + reg0Str;
	reg0Str = reg0Str + '$';
	var reg0 = new RegExp(reg0Str);
	if (reg0.test(temp)) return true;

	// first replace all non numbers
	var reg1Str = '[^0-9' + (decimalPlaces != 0 ? '.' : '') + (allowNegative ? '-' : '') + ']';
	var reg1 = new RegExp(reg1Str, 'g');
	temp = temp.replace(reg1, '');

	if (allowNegative) {
		// replace extra negative
		var hasNegative = temp.length > 0 && temp.charAt(0) == '-';
		var reg2 = /-/g;
		temp = temp.replace(reg2, '');
		if (hasNegative) temp = '-' + temp;
	}
	
	if (decimalPlaces != 0) {
		var reg3 = /\./g;
		var reg3Array = reg3.exec(temp);
		if (reg3Array != null) {
			// keep only first occurrence of .
			//  and the number of places specified by decimalPlaces or the entire string if decimalPlaces < 0
			var reg3Right = temp.substring(reg3Array.index + reg3Array[0].length);
			reg3Right = reg3Right.replace(reg3, '');
			reg3Right = decimalPlaces > 0 ? reg3Right.substring(0, decimalPlaces) : reg3Right;
			temp = temp.substring(0,reg3Array.index) + '.' + reg3Right;
		}
	}
	
	obj.value = temp;

}
function blockNonNumbers(obj, e, allowDecimal, allowNegative)
{
	var key;
	var isCtrl = false;
	var keychar;
	var reg;
		
	if(window.event) {
		key = e.keyCode;
		isCtrl = window.event.ctrlKey
	}
	else if(e.which) {
		key = e.which;
		isCtrl = e.ctrlKey;
	}
	
	if (isNaN(key)) return true;
	
	keychar = String.fromCharCode(key);
	
	// check for backspace or delete, or if Ctrl was pressed
	if (key == 8 || isCtrl)
	{
		return true;
	}

	reg = /\d/;
	var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
	var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
	
	return isFirstN || isFirstD || reg.test(keychar);
}

//=========================================================================


// SELECT on/off
function SelectExcept(o){
	return !( (o.id == "AMenu1")||(o.id == "TabMenu1")||(o.id == "TabMenu5")||(o.id == "TabMenu6")||(o.id == "CellMenu1")||(o.id == "CellMenu2")||(o.id == "ImgMenu1")); 
}

function SelectHide(sStyle){
	SelectHideEx(sStyle,document);
	for (var i=0;i<window.frames.length;i++){
		SelectHideEx(sStyle,window.frames[i].document);
	}
}

function SelectHideEx(sStyle,odocument){	
	var o;
	o = odocument.getElementsByTagName("select");
	if (o !=null ){
		if (o.tagName == 'SELECT') {
			if (SelectExcept(o)) o.style.visibility=sStyle;
		} else {
			for(var i=0;i<o.length;i++){
				if (SelectExcept(o[i])) o[i].style.visibility=sStyle;
			}
		}
	}
}

// ###   FCE PRO PriceList ###

function SHModalDlgPricelist()
{
	var strReturn = showModalDialog("/Includes/EmailPricelist.htm","","status:no; center:yes; help:no; minimize:no;dialogWidth=320px;dialogHeight=124px;");
    if (strReturn == "") return;
	document.location.href = "/EmailPricelist.asp?EmailPricelist=" + strReturn;
}

// ##########


function InsertCookies(strName,strData){
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() - 365);
	document.cookie=strName+"="+strData+"; expires="+vyprs.toGMTString()+"; path=\/;";
	vyprs.setDate(365 + 365 + vyprs.getDate());
	document.cookie=strName+"="+strData+"; expires="+vyprs.toGMTString()+"; path=\/;";
}

function ExtractCookies(strName)
{
	var cookieList=document.cookie.split("; ");
	var cookieArray = new Array();
	var name = "#"
	for (var i=0; i < cookieList.length; i++)
	{
		if(cookieList[i].indexOf(strName)>-1)
		{
			if( cookieList[i].indexOf("=")>-1)  {   name = cookieList[i].split("=");}
		}
	}
	if (name != "#")
	{
		return name[1];
	}
	else
	{
		return "none";
	}
}

/***************************************************************************/
/***************************************************************************/
	
function ExtractCookies_simple(strName){
	var cookieList=document.cookie.split("; ");
	var cookieArray = new Array();
	var name = "#"
	for (var i=0; i < cookieList.length; i++){
		if(cookieList[i].indexOf(strName+'=')==0){
			return cookieList[i].substr(cookieList[i].search('=')+1);
		}
	}
	return "";
}

/***************************************************************************/
/***************************************************************************/

function FormatNumber(text){
	var mezi = BarterComma(text);
	mezi = ''+Math.round(parseFloat(mezi) * 100);
	var desetiny = mezi.substring(mezi.length-2, mezi.length);
	var cele = mezi.substring(0,mezi.length-2);
	if (parseFloat(mezi) < 1){
	        var mezi = "0."+desetiny;
	}else{
	        var mezi = cele+"."+desetiny;
	}
	return mezi;
}
function FormatFloat(nNumber,nDecimal){
	var sNumber = BarterComma(nNumber);
	sNumber = ''+Math.round(parseFloat(sNumber) * Math.pow(10,nDecimal));
	var sDedimal = sNumber.substring(sNumber.length-nDecimal, sNumber.length);
	var nInt = sNumber.substring(0,sNumber.length-nDecimal);
	if (parseFloat(sNumber) < 1){
	        var sNumber = "0."+sDedimal;
	}else{
	        var sNumber = nInt+"."+sDedimal;
	}
	return sNumber;
}

function FormatCurrency(nNumber,nDecimal){
	var sCurrency, iInsertSpace;
	sCurrency = FormatFloat(nNumber, nDecimal).replace('.',',');
	iInsertSpace = sCurrency.indexOf(',') - 3;
	while (iInsertSpace>0) {
		sCurrency = sCurrency.substring(0,iInsertSpace) + ' ' + sCurrency.substring(iInsertSpace,sCurrency.length);
		iInsertSpace -= 3;
	}
	if (nDecimal==0) sCurrency = sCurrency.substring(0,sCurrency.indexOf(","));
	return sCurrency;
}

function FUCJS(nNumber, nDecimal, bCurrSymbol) {
	var sCurrency;
	nDecimal = (nDecimal > 0) ? nDecimal : gbCurrencyDigitsAfterDecimalSeparator;
	if (parseFloat(nNumber))
		sCurrency = FormatCurrency(nNumber, nDecimal);
	else
		sCurrency = "0";
	sCurrency = sCurrency.replace(" ", gbCurrencyThousandSeparator);
	sCurrency = sCurrency.replace(",", gbCurrencyDecimalSeparator);
	
	if (nDecimal == 0) sCurrency = sCurrency + gbCurrencySuffixNotDecimal;
	
	if (bCurrSymbol) {
		if (gbCurrencyBeforeAmount)
			sCurrency = "<small>" + gbCurrencyName + "</small>&nbsp;" + sCurrency;
		else
			sCurrency = sCurrency + "&nbsp;<small>" + gbCurrencyName + "</small>";
	}
	return sCurrency;
}

function BarterComma(text){
	var mezi = ''+text;
	if (mezi.indexOf(',') != -1){
		mezi = mezi.split(",");
		mezi = mezi[0]+"."+mezi[1];
	}else{
		mezi = text;
	}
	return parseFloat(mezi);
}

function controlMaxNumber(value,nMax, obj){
		if(value > nMax && value >= 1){    
      alert("Číslo stránky musí být v rozmezí od 1 - " + nMax);
      return false;
    }else{
			if (obj.action.indexOf('pg-0') != -1) obj.action = obj.action.replace(/pg-0/,'pg-'+value)
			else if (obj.action.indexOf('PgID=0') != -1) obj.action = obj.action.replace(/PgID=0/,'PgID='+value)
      return true;
    }
}

function ControlFloat(){
	if (!Br.IE) return;
	if (((event.keyCode < 48) || (event.keyCode > 57)) && (event.keyCode !=46) && (event.keyCode !=44)) event.returnValue = false;
}

function ControlNumber(e){
	var keynum
	var keychar
	var numcheck
	
	if(window.event){
		keynum = e.keyCode
	}
	else if(e.which){
		keynum = e.which
	}
	return ((keynum >= 48) && (keynum <= 57)) || keynum == 8 || keynum == 13
}

function ControlPhone() {
	if (!Br.IE) return;
    if (((event.keyCode < 48) || (event.keyCode > 57)) && (event.keyCode != 32)  && (event.keyCode!=40) && (event.keyCode!=41) && (event.keyCode!=43))
		event.returnValue = false;
}
function ControlPSC() {
	if (!Br.IE) return;
    if (((event.keyCode < 48) || (event.keyCode > 57)) && (event.keyCode != 32))
		event.returnValue = false;
}

function ShowSearchMenu(x){
    if (x == 1){
        getE('Searchtable').style.display='';
    }else{
        getE('Searchtable').style.display='none';
    }
}

function ValidateAccount(sAccount) {
	var u1,u2,t1,t2,i;
	var vahy = new Array("1","2","4","8","5","10","9","7","3","6")
	u1 = sAccount.substring(0,sAccount.length - 10);
	u2 = sAccount.substring(sAccount.length - 10,12);
	t1 = 0;t2 = 0;
	for(i=u1.length ;i>0;i--) {
		t1 += u1.charAt(i - 1)*vahy[10 - i];
	}	  
	for(i=u2.length ;i>0;i--) {
		t2 += u2.charAt(i - 1)*vahy[10 - i];
	}
	if (((t2%11) == 0)&&((t1%11 == 0))) {
		return true;
	} else {
		return false;
	}
}

// ##### PriceList BEEND #######################################################
function PutCategoriesIdNameToSelect(saCatIdName, nIndex, bStart) {
	var arrData, arrSubData, saCatID, el;
	arrData = saCatIdName.split("*");
	saCatID = "";
	for (var i=0; i<arrData.length-1; i++) {
	    arrSubData = arrData[i].split("/")
		el = document.createElement("OPTION")
	    el.value = arrSubData[0];
	    el.text = arrSubData[1];
		saCatID += arrSubData[0] + "$"
		if (bStart==true) {
			if (i==0) {
				el.text='-Všechny kategorie-';
				document.PL['Categ'+nIndex].options.add(el);
			}
		} else
		    document.PL['Categ'+nIndex].options.add(el);
	}
		
	document.PL['CatID' + nIndex].value = saCatID.substr(0,saCatID.length - 1);
	if (saCatIdName == "") {
		document.PL['Categ'+nIndex].style.display = "none";
		getE("ChooseCateg"+nIndex).style.display  = "inline";
	} else {
		document.PL['Categ'+nIndex].style.display = "inline";
		getE("ChooseCateg"+nIndex).style.display  = "none";
	}
}

function GetCategoriesIdNameForSelect(nTree,bAlsoDisabled,nIndex,nUserType) {
	var saCatID,nProID,sProNM;
	var r;
	
	nProID = document.PL['ProdID'+nIndex].value;
	
	sProNM = document.PL['ProdID'+nIndex].options[document.PL['ProdID'+nIndex].selectedIndex].innerHTML
	saCatID = document.PL['CatID' + nIndex].value;
	if(Br.IE){
		var strReturn = showModalDialog("/Includes/PriceListSelectCatsOfProd.asp?TREE="+nTree+"&ProID="+nProID+"&DIS="+bAlsoDisabled+"&CatIDs="+saCatID+"&ADM="+nUserType+"&ProNM="+sProNM,"Info","status:no; center:yes; help:no; minimize:no;dialogWidth=470px;dialogHeight=450px");
		if (typeof(strReturn) == 'undefined') return;
		with(getE("Categ"+nIndex)){
			r = options.length;
	       		for (var i=0; i<r; i++) {
	               		options.remove(options.length-1);
	       		}
		}
		PutCategoriesIdNameToSelect(strReturn, nIndex, false);
	}else{
		window.open("/Includes/PriceListSelectCatsOfProd.asp?TREE="+nTree+"&ProID="+nProID+"&DIS="+bAlsoDisabled+"&CatIDs="+saCatID+"&ADM="+nUserType+"&ProNM="+sProNM+"&nIndex="+nIndex,"okno","toobar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=470,height=450,left=0,top=0");
	}
	
}
function ClearCategories(nIndex) {

	while(document.PL['Categ'+nIndex].length>0) {
		document.PL['Categ'+nIndex].options[0] = null;	
		}
	
	document.PL['CatID' + nIndex].value = "";
	document.PL['Categ'+nIndex].style.display = "none";
	getE("ChooseCateg"+nIndex).style.display  = "inline";
}

// ##### PriceList END #####

function ShowImage(sImgPath) {
		window.open('/ShowImage.asp?IMG=' + sImgPath, "Foto","scrollbars=0,status=0,toolbar=0,location=0,directories=0,height=100,width=100,resizable=1");
}

function ShowHide(element) {
	var e = getE( element );
	if (e.style.display=="none") {
		if (!Br.OP) SelectHide('hidden');
		e.style.display = "" }
	else {
		if (!Br.OP) SelectHide('visible');
		e.style.display = "none" };
//	if (!Br.IE) this.blur(); //aby nam nezustaval v mozile oznacen klikaci text
}

function ShowHideEx(element) {
	var e = getE( element );
	if (e.style.display=="none") {
		e.style.display = "" }
	else {
		e.style.display = "none" };
//	if (!Br.IE) this.blur(); //aby nam nezustaval v mozile oznacen klikaci text
}

function styleChange(elementId,classNameStr) {	var e = getE( elementId );	e.className = classNameStr;}

// AvaibilityBox - Avaibility Dialog
function showAvaibilityDialog( code, posX, posY ) {

	
	clearTimeout;
	if (!Br.OP) SelectHide('hidden');
	var e = getE( "avaibilitybox" );
	fadeInObject ( "avaibilitybox", 0 );
	e.style.zIndex = 999;
	e.style.position = "absolute";
	e.style.top = topScroll() + 150+'px';
	e.style.left = (document.body.clientWidth/2 - 250)+'px';
//	setTimeout("hideAvaibilityDialog();", 10000);
	
	
// 	e.style.display = "";
// 	e.style.position = "absolute";
// //	e.style.top = (posY + 50)+'px';
// //	e.style.left = (posX + 50)+'px';
// 	e.style.top = (document.body.scrollTop + document.body.clientHeight/2 -200)+'px';
// 	e.style.left = (document.body.clientWidth/2 - 100)+'px';
	document.forms.avaibilityform.elements.code.value = code;
	document.getElementById("avaibilityFrame").src = "/Avaibility.asp?sCode=" + code;
	document.forms.avaibilityform.elements.count.value = "Zjišťuje se...";
}
function hideAvaibilityDialog() {
	var e = getE( "avaibilitybox" );
	e.style.display = "none";
//	var e = getE( "avaibilitybox" );
//	e.style.display = "none";
}




/* positions */

function topScroll() {
	if (window.innerHeight) {
		  return ( window.pageYOffset )
	} else if (document.documentElement && document.documentElement.scrollTop) {
		return ( document.documentElement.scrollTop )
	} else if (document.body) {
		  return ( document.body.scrollTop )
	}
}

// specialitky

var fadeInOut;
function fadeInObject ( objID, speed, opacity ) { // fce necha plynule zobrazit libovolny objekt na strance dle jeho ID; speed je 1-100; opacity je nepovinna vychozi hodnota
	window.clearTimeout(fadeInOut);
	var obj = getE(objID);
	if (!(opacity>0)) opacity = 0;
	if (!(speed>0)) speed = 5;
	opacity+=speed;
	
	
	if(Br.IE7){
		
	
	}else if (Br.IE) {
		obj.style.filter = 'alpha(Opacity='+opacity+')';
		if (opacity<100) { fade=setTimeout("fadeInObject('"+objID+"',"+speed+","+opacity+");", 0) } else { obj.style.filter='' }
	} else if (Br.NS) {
		
		obj.style.MozOpacity = opacity/100;
		if (opacity<100) { fade=setTimeout("fadeInObject('"+objID+"',"+speed+","+opacity+");", 0) } else { obj.style.MozOpacity=1; }
		
	}
	
	if (obj.style.display=='none') obj.style.display='block';
}
function fadeOutObject ( objID, speed, opacity ) { // fce necha plynule zmiznout libovolny objekt na strance dle jeho ID; speed je 1-100; opacity je nepovinna vychozi hodnota
	window.clearTimeout(fadeInOut);
	var obj = getE(objID);
	if (!(opacity>0)) opacity = 100;
	if (!(speed>0)) speed = 5;
	opacity-=speed;
	if (Br.IE) {
		obj.style.filter = 'alpha(Opacity='+opacity+')';
		if (opacity>0) { fade=setTimeout("fadeOutObject('"+objID+"',"+speed+","+opacity+");", 0) } else { obj.style.display='none'; obj.style.filter=''; }
	} else if (Br.NS) {
		obj.style.MozOpacity = opacity/100;
		if (opacity>0) { fade=setTimeout("fadeOutObject('"+objID+"',"+speed+","+opacity+");", 0) } else { obj.style.display='none'; obj.style.MozOpacity=1; }
	}
	if (obj.style.display=='block') obj.style.display='none';
}


// AvaibilityBox - Avaibility Dialog
// function showAvaibilityDialog( code, posX, posY ) {
// 	var e = getE( "avaibilitybox" );
// 	e.style.display = "";
// 	e.style.position = "absolute";
// //	e.style.top = (posY + 50)+'px';
// //	e.style.left = (posX + 50)+'px';
// 	e.style.top = (document.body.scrollTop + document.body.clientHeight/2 -200)+'px';
// 	e.style.left = (document.body.clientWidth/2 - 100)+'px';
// 	document.forms.avaibilityform.elements.code.value = code;
// 	document.forms.avaibilityform.elements.count.value = "Zjišťuje se...";
// 	document.frames.avaibilityFrame.document.location = "Avaibility.asp?sCode=" + code;
// }
// function hideAvaibilityDialog() {
// 	var e = getE( "avaibilitybox" );
// 	e.style.display = "none";
// //	var e = getE( "avaibilitybox" );
// //	e.style.display = "none";
// }

//ShopPreviewDialog
function showShopPreviewDialog(nDPG) {
	if (!Br.OP) SelectHide('hidden');
	var e = getE( "shopPreviewBox" );
	getE('previewFrame').src = "/PreviewPage.asp?PWID="+nDPG
	ShowHideEx("shopPreviewBox");
	e.style.zIndex = 999;
	e.style.position = "absolute";
	e.style.top = topScroll() + 50 + 'px';
	e.style.left = (document.body.clientWidth/2 - 244)+'px';
}

function hideShopPreviewDialog() {
	var e = window.parent.getE('shopPreviewBox');
	if (e && e.style.display=='') {
		e.style.display = "none" }
	if (!Br.OP) SelectHide('visible');
}



// ShopInfoBox

function showShopInfoDialog() {
	clearTimeout;
	if (!Br.OP) SelectHide('hidden');
	var e = getE( "shopinfobox" );
	fadeInObject ( "shopinfobox", 0 );
	e.style.zIndex = 999;
	e.style.position = "absolute";
	e.style.top = topScroll() + 150+'px';
 // alert(e.pageY);
	e.style.left = (document.body.clientWidth/2 - 250)+'px';
	setTimeout("hideShopInfoboxDialog();", 10000);
}

function hideShopInfoboxDialog() {
	var e = getE( "shopinfobox" );
	fadeOutObject ( "shopinfobox", 100);
	clearTimeout;
	if (!Br.OP) SelectHide('visible');
}

function showShopConfirmDialog() {
	clearTimeout;
	hideShopInfoboxDialog();
	if (Br.IE) {
		if (getE('sortingSelector')) getE('sortingSelector').style.visibility='hidden';
		if (getE('producerSelector')) getE('producerSelector').style.visibility='hidden';
	}
	var e = getE( "shopconfirmbox" );
	fadeInObject ( "shopconfirmbox", 0 );
	e.style.position = "absolute";
	e.style.top = topScroll() + 300+'px';
	e.style.left = (document.body.clientWidth/2 - 250)+'px';
	if (getE('boxformcount')) getE('boxformcount').focus();
}

function hideShopConfirmDialog() {
	if (getE('itemsOnPageSelect')) { getE('itemsOnPageSelect').style.visibility='visible'; }
	if (getE('sortingSelector')) getE('sortingSelector').style.visibility='visible';
	if (getE('producerSelector')) getE('producerSelector').style.visibility='visible';
	var e = getE( "shopconfirmbox" );
	fadeOutObject ( "shopconfirmbox", 10 );
}

function GetBuy(frm,sAction,sTarget) {
	frm.action = sAction;
	frm.target = sTarget;
	frm.elements.AUO.value = 'ok';
//	alert (e.clientY);
//	alert (e.screenY);
}


function getMouse() {
  if (!document.all){
  alert(e.clientY);
  getMouseMoz();
  }
  else
  {
  return getMouseIE();
  }
}


function getMouseIE()
{
return event.y;
}
function getMouseMoz(e)
{
return e.pageY;
}


/* hover images in commodity list */
var bHoverName = 0, bHoverImage = 0, nLastImageId = 0; // jestli mame mys nad nazvem a obrazkem
function hideHoverImage( hoverWhat, idImage ) {
	if (hoverWhat==1) bHoverName = 0;
	if (hoverWhat==2) bHoverImage = 0;
	setTimeout("if (bHoverName==0 & bHoverImage==0) getE('hover_"+idImage+"').style.display='none';", 500); //getE('hover_'+idImage).style.display='none';
}

function showHoverImage( hoverWhat, idImage ) {
	clearTimeout;
	if (idImage!=nLastImageId) { 
		bHoverName = 0; 
		bHoverImage = 0; 
		if (getE('hover_'+nLastImageId)) getE('hover_'+nLastImageId).style.display='none';
	}
	if (hoverWhat==1) bHoverName = 1;
	if (hoverWhat==2) bHoverImage = 1;
	nLastImageId = idImage;
	getE('hover_'+idImage).style.display='block';
}

function EmailControl(sEmail){
	var regEx  = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/;
  //regEx.ignoreCase = true;
		
	if (regEx.test(sEmail) == false)	{
		alert('Nesprávný formát emailu');
		return false;
	}
	return true;
}

function CheckWatchDogForm()
{
	var emailObj         = document.forms.WatchDogForm.sEmail;
	var loginPassObj = document.forms.WatchDogForm.sLoginPass
	
	if (!EmailControl(emailObj.value))  {emailObj.focus(); return false;}
	
	if (loginPassObj.value.length < 5)
	{
		alert('Heslo musí obsahovat minimálně  5 znaků!');
		loginPassObj.focus();
		return false
	}
	return true;
}

function checkCount( myCount, minCount, sUnit, onlyMultiplied ) {
	myCount = parseInt(myCount.replace(",","."));
	minCount = parseInt(minCount.replace(",","."));
	if ( myCount == 0 ) return true;
	
	if ( myCount < minCount ) {
		alert('Toto zboží lze objednat v minimálním počtu '+minCount+' '+sUnit+'.'); return false;
	}
	if ( (onlyMultiplied==1) && ( (myCount*10) % (minCount*10) != 0) ) {
		alert('Toto zboží lze zakoupit pouze v násobcích '+minCount+' '+sUnit+'.'); return false;
	}
	return true;
}

function confirmEmptyBasket()    {	return confirm('"&GLS(190,"Přejete si zrušit objednávku a vyprázdnit košík?")&"');}
function GoToPage(nPage, sParam) {  document.location.href = '?pgID=' + nPage + sParam;}
function trim(str)               {  return str.replace(/^\s*|\s*$/g,"");}

function ShowCalendar(oid)
 {
  var cal = document.getElementById('divcal');
  var calframe = document.getElementById('diviframcal');
  var tbox = document.getElementById(oid);
  var ssrc = '/Includes/Calendar_INC.asp?el=' + oid + '&selDate=' + tbox.value;
  
  cal.style.top = tbox.offsetTop + tbox.offsetHeight;
  cal.style.left = tbox.offsetLeft;
  
  calframe.src = ssrc;
  cal.style.display = 'block';
 }
 
function Bookmark(url,title){
	if (window.sidebar){
		window.sidebar.addPanel(title, url,"");
	}
	else if( document.all){
		window.external.AddFavorite(url, title);
	}
	else{
		return true;
	}
}
 
function getTxtTo(objThis,objTo,sTxt){
if(objTo !=null){objTo.value= objThis.value }
	
}

function changesh(link,id)
{

 for (i=1;obj=document.getElementById("fb"+i);i++)
     {
     obj1=document.getElementById("fdh"+i);
     if (i!=id)
     {obj.style.display='none';obj1.className="foEx";}
     else
     {obj.style.display='block';obj1.className="foEx foSel";}
     }
     
 return false;
}


function setOption(selName, optId) {

  var selectObj = getE(selName);
  
	for (var i=0;i<selectObj.options.length;i++){
		if (parseInt(selectObj[i].value) == parseInt(optId)) {
      selectObj.selectedIndex = i ;
    }
	}
 

}


function setOptionString(selName, optId) {

  var selectObj = getE(selName);
  
	for (var i=0;i<selectObj.options.length;i++){
		if (selectObj[i].value == optId) {
      selectObj.selectedIndex = i ;
    }
	}
 

}


function setOptionTxt(selName, optId) {

  var selectObj = getE(selName);
  
	for (var i=0;i<selectObj.options.length;i++){
		if (selectObj[i].value == optId) {
      selectObj.selectedIndex = i ; 
    }
	}

}

function ChangeBrand() {

  
  if (getE('Dimension') != null) {
    getE('Dimension').value = 0;
  }
  
  if (getE('TypeChose') != null) {
    getE('TypeChose').value = 0;
  }

  if (getE('ModelChose') != null) {
    getE('ModelChose').value = 0;
  }

  if (getE('Dimension') != null) {
    
    getE('Dimension').value = getE('Dimension').options[0].value;
  }




  getE('alcarFrm').submit();

}

function ChangeType() {

  
  if (getE('ModelChose') != null) {
    getE('ModelChose').value = 0;
  }
  
  if (getE('Dimension') != null) {
    getE('Dimension').value = getE('Dimension').options[0].value;
  }



  getE('alcarFrm').submit();

}

function ChangeModel() {

  
  if (getE('Dimension') != null) {
    getE('Dimension').value = getE('Dimension').options[0].value;
  }

  getE('alcarFrm').submit();

}


function WriteAlcarCarInfoCookies() {
    
  var sAlcarInfo = '';
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() + 14);


  if (getE('BrandChose') != null && getE('BrandChose').value != 0) {
    sAlcarInfo = getE('BrandChose')[getE('BrandChose').selectedIndex].innerHTML +  ', ';
  }

  
  if (getE('TypeChose') != null && getE('TypeChose').value != 0) {
    sAlcarInfo += getE('TypeChose')[getE('TypeChose').selectedIndex].innerHTML +  ', ';
  }

  if (getE('ModelChose') != null && getE('ModelChose').value != 0) {
    sAlcarInfo += getE('ModelChose')[getE('ModelChose').selectedIndex].innerHTML +  ', ';
    document.cookie="AlcarCarInfoModel="+ getE('ModelChose').value +"; expires="+vyprs.toGMTString()+";path=\/";
  }

    
    if (getE('Dimension') != null && getE('Dimension').value != 0) {
    sAlcarInfo += getE('Dimension').value +  ' ';
  }
  
  //alert(sAlcarInfo);

  document.cookie="AlcarCarInfo="+ sAlcarInfo.replace(";",",") +"; expires="+vyprs.toGMTString()+";path=\/";
  
}


function WriteAlcarSteelCarInfoCookies() {
    
  var sAlcarInfo = '';
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() + 14);


  if (getE('BrandChose') != null && getE('BrandChose').value != 0) {
    sAlcarInfo = getE('BrandChose')[getE('BrandChose').selectedIndex].innerHTML +  ', ';
  }

  
  if (getE('TypeChose') != null && getE('TypeChose').value != 0) {
    sAlcarInfo += getE('TypeChose')[getE('TypeChose').selectedIndex].innerHTML +  ', ';
  }

  if (getE('ModelChose') != null && getE('ModelChose').value != 0) {
    sAlcarInfo += getE('ModelChose')[getE('ModelChose').selectedIndex].innerHTML +  ', ';
    document.cookie="AlcarCarInfoModel="+ getE('ModelChose').value +"; expires="+vyprs.toGMTString()+";path=\/";
  }

    
    if (getE('Dimension') != null && getE('Dimension').value != 0) {
    sAlcarInfo += getE('Dimension').value +  ' ';
  }
  
  //alert(sAlcarInfo);

  document.cookie="AlcarSteelCarInfo="+ sAlcarInfo.replace(";",",") +"; expires="+vyprs.toGMTString()+";path=\/";
  
}

function setAlacarAvail(sCode, sAvailText) {
  
  sAvailText = sAvailText.replace('dostupné', '<span>Skladem</span>');
  sAvailText = sAvailText.replace('Skladem - 5 prac. dní', 'dostupné - 5 prac. dní');
  
  sAvailText = sAvailText.replace('objednáno u výrobce', 'Na dotaz');
  
  
  if (getE('av' + sCode) != null) {
    getE('av' + sCode).innerHTML = sAvailText;

  }

  if (sAvailText == "<span>Skladem</span>") {
    getE('avT' + sCode).innerHTML = "<div class='deEx1'><strong>2-3 dny</strong>Termín dodání: </div>";

  }
  
}


function rowBetter(obj){
 
  obj.style.borderBottom  = "1px solid #8A0606";
}

function rowBetterOut(obj){
  
  obj.style.borderBottom  = "1px solid #F2EEE6";
}


//AJAX
function getRegisterControl(url,elementContainer,formtoproceed,submitform){
   // wnd=window.open(url,'','');
    /*wnd.close();*/
    //alert(url);
   // window.parent.document.getElementById(elementContainer).innerHTML = '<blink class="redtxt">Loading...<\/blink>';
    var theHttpRequest = getNewHttpObject();
    theHttpRequest.onreadystatechange = function() {processRegisterControl(formtoproceed,submitform);};
    theHttpRequest.open("GET", url);
    theHttpRequest.setRequestHeader("encoding", "UTF-8");
    theHttpRequest.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
    theHttpRequest.send(false);

        function processRegisterControl(formtoproceed,submitform){
           var outputString,arrErrors, arrErrorsRow
           if (theHttpRequest.readyState == 4) {
               if (theHttpRequest.status == 200) {

               //arrErrors=decodeURI(theHttpRequest.responseText).split("|");
               arrErrors=unescape(theHttpRequest.responseText).split("|");

               //alert(arrErrors);

               for (i=1;arrErrors[i];i++)
                   {
                  // alert(arrErrors[i]);
                   arrErrorsRow=arrErrors[i].split("#")
                   if(arrErrorsRow[1])
                     {
                     outputString=decodeURI(arrErrorsRow[0]).replace("|","");


                     
                   //  window.parent.document.getElementById(elementContainer).innerHTML = outputString;
                     window.parent.document.getElementsByName(arrErrorsRow[1])[0].style.border = "3px solid red";
                     window.parent.document.getElementsByName(arrErrorsRow[1])[0].title= outputString;

                      wcell = window.parent.document.getElementsByName(arrErrorsRow[1])[0].parentNode;

                  if (window.parent.document.getElementById(arrErrorsRow[1]+'W')){
                      window.parent.document.getElementById(arrErrorsRow[1]+'W').innerHTML = outputString;
                      window.parent.document.getElementById(arrErrorsRow[1]+'W').className = 'requiredfield';
                      }
                      

                     }
                   }


                   if (arrErrors[1])
                   {
                   //alert(arrErrors[1].split("#")[1]);
                    window.parent.document.getElementsByName(arrErrors[1].split("#")[1])[0].onchange=function(){ControlUserDataSubmitAX(window.parent.document.getElementById(formtoproceed),false);};
                    try
                    {
                    window.parent.document.getElementsByName(arrErrors[1].split("#")[1])[0].focus();
                    }
                    catch(err)
                    {}
                   }
                   else if(submitform)
                   {

                    if (formtoproceed == "OrderForm") {
                      getE("buttonContainer").innerHTML = "Chvíli strpení, objednávka se odesílá...";
                    }

                    window.parent.document.getElementById(formtoproceed).onsubmit="";
                    window.parent.document.getElementById(formtoproceed).submit();
                   
                   }
               }
               else {
                   window.parent.document.getElementById(elementContainer).innerHTML="<p><span class='redtxt'>Error!<\/span> HTTP request return the following status message: " + theHttpRequest.statusText +"<\/p>";
                    }
           }
        }

}

function getNewHttpObject() {
    var objType = false;
    try {
        objType = new ActiveXObject('Msxml2.XMLHTTP');
    } catch(e) {
        try {
            objType = new ActiveXObject('Microsoft.XMLHTTP');
        } catch(e) {
            objType = new XMLHttpRequest();
        }
    }
    return objType;
}


// function updParamSearch(frm) {
// 
// 	var parameters = "";
// 	var catID = frm.CatID.value;
//   var cbfRes = function(JScode)
//     {
//       eval(JScode);
//     }
// 
// 		
//   for(var i = 0 ;i < frm.elements.length;i++){
//     if (frm.elements[i].tagName == 'SELECT') {
//       if (trim(frm.elements[i].value) != '' ) {
//           parameters +=  "&" + frm.elements[i].name + "=" + frm.elements[i].value ;
// //          parameters += "['" + (frm.elements[i].name.replace(' ', '%20')) + "','" + (frm.elements[i].value) + "'],";
//       } 
//     }
// 	}
// 
// 
// 	var ajax = new Ajax('/AdvancedSearchBack.asp?catida="+ catID +"'+ parameters, 'get', cbfRes);
// 	ajax.sendRQ('' , false);
//   
// }

function updParamSearch(frm) {

	var parameters = "";
	var catID = frm.CatID.value;
  var cbfRes = function(JScode)
    {
      eval(JScode);
    }

		
  for(var i = 0 ;i < frm.elements.length;i++){
    if (frm.elements[i].tagName == 'SELECT') {
      if (trim(frm.elements[i].value) != '' ) {
          parameters += "['" + encodeURI(frm.elements[i].name) + "','" + encodeURI(frm.elements[i].value) + "'],";                  
//          parameters += "['" + (frm.elements[i].name.replace(' ', '%20')) + "','" + (frm.elements[i].value) + "'],";
      } 
    }
	}


	parameters = "[" + parameters + "['catid','" + catID + "']]"
	var ajax = new Ajax('/AdvancedSearchBack.asp', 'post', cbfRes);
	ajax.sendRQ(eval(parameters), false);
  
}


function fillAdvSearch (data) {
  var obj;    
  var sHTML = "<option value=''></option>";  
  var sParamTemp = '';    
  var bFirstParam = true;    

  var sParams = getE('paramsOrder').value;
  var arrData = sParams.split("|");    
  for(var i = 0 ;i < arrData.length;i++)  
    {
      sLastName = arrData[i];
    }

  

  var sel = "";
	var opt = "";
	var opt_txt = "";
  


 for(var i=0;i<data.length;i++)
	{


    if (sParamTemp == '') {
        sParamTemp = data[i][0];
     //   if (sLastName != sParamTemp) {
        sel = getF('AdvancedSearchFrm')[sParamTemp];
      if (sel != undefined) {
  	    opt = "";
  	    opt_txt = "";      
        sel.innerHTML = "";    
        }    
      //}

    } 

    if (data[i][0] == sParamTemp) {
        sHTML += "<option value='"+ data[i][1] +"'>"+ data[i][1] + "</option>";
        opt = document.createElement("option");
				opt_txt = document.createTextNode(data[i][1]);
				opt.appendChild(opt_txt);
				opt.setAttribute("value", data[i][1]);
				sel.appendChild(opt);
          
    } else {
      
      if (bFirstParam == true) {
        getF('AdvancedSearchFrm')[sParamTemp].disabled = false; 
               
      }
        sel = getF('AdvancedSearchFrm')[data[i][0]];      
  	    opt = "";
  	    opt_txt = "";
        sel.innerHTML = "";          

        opt = document.createElement("option");
				opt_txt = document.createTextNode(data[i][1]);
				opt.appendChild(opt_txt);
				opt.setAttribute("value", data[i][1]);
				sel.appendChild(opt);
      
      sHTML = "<option value=''></option><option value='"+ data[i][1] +"'>"+ data[i][1] + "</option>";      
    }
    
    sParamTemp = data[i][0];    
            
	}

      if (bFirstParam == true) {
        if (getF('AdvancedSearchFrm')[sParamTemp] != undefined) {
          getF('AdvancedSearchFrm')[sParamTemp].disabled = false;        }    
       }
  
}


function updateDisSel(frm, selS) {
          
  var bNextStop = false;
  var sParams = getE('paramsOrder').value;
  var arrData = "";    
  var ActSel ;

  if (selS == null) {  
      arrData = sParams.split("|");    

      // pokud je prvotni nacteni a neni pozadavek ze selectu
      for(var i = 0 ;i < frm.elements.length;i++){
        if (frm.elements[i].tagName == 'SELECT') 
          {              
          if (frm.elements[i].name != arrData[0]) 
          {
            frm.elements[i].disabled = true;            
          }
        }
    	}
   
   } else {
    
    // projdeme vsechny selecty a postupne disablujem    
    arrData = sParams.split("|");    
    for(var i = 0 ;i < arrData.length;i++)
        {                
          frm[arrData[i]].disabled = true;
        }

    // prochazime postupne selecty znovu
    for(var i = 0 ;i < arrData.length;i++)
      {
        
        if (arrData[i] == selS.name && selS.value == '') 
        {
         
          frm[arrData[i]].disabled = false;
       
         for(var a = i ;a < arrData.length;a++)
          {
            frm[arrData[a]].options[0].selected = true;
          }
          
          break;
        } 


        frm[arrData[i]].disabled = false;
        
        if (bNextStop == true) {
          
         ActSel = frm[arrData[i]]; 
                
         for(var a = i ;a < arrData.length;a++)
          {
            frm[arrData[a]].options[0].selected = true;
          }          
          
          // Pokud nema nasledujici zaznam, potom aktivujeme i dalsi                                    
          if (ActSel.length == 1) {
            if (frm[arrData[i+1]] != undefined)            
              {
                frm[arrData[i+1]].disabled = false;                
              }
          }

         

          break;
        
        }

        if (arrData[i] == selS.name) 
          {  
                 
            bNextStop = true;
          }
       }

    }
}


$(document).ready(function() {


  $('.dostup1').mouseenter(function (e) {
          
          var pos = $(this).position();
          var id = $(this).attr("title");
      
          if (id==undefined) {id = 0;}
      
           $.ajax({
                   type: "GET",
                   url: "/Back_AvailInfo.asp",
                   cache: false,
                   async:false, 
                   data: ({id: id}),
                   dataType: "html",
                   beforeSend: function (data) {
                                                 $('#availIn').html("<strong class='loading'><img src='/img/ajxw.gif' alt='ajxw.gif' />Zjišťuji, mějte prosím strpení...</strong>");
                                                 $('#avaibilitybox').css( { "right": (pos.left - 210) + "px", "top":pos.top - 55 + "px" } );
                                                 $('#avaibilitybox').show();
                                                },
                                        
                   success: function (data) {
                          $('#availIn').html(data);
                         $('#avaibilitybox').css( { "right": (pos.left - 210) + "px", "top":pos.top - 55 + "px" } );
                         $('#avaibilitybox').show();
                    }
           });
       
    });


  $('.dostup1').mouseleave(function () {
       $('#avaibilitybox').hide();
    });


  $('#det_av strong').mouseenter(function (e) {
          
          var pos = $(this).position();
          var id = $(this).attr("title");
      
          if (id==undefined) {id = 0;}
      
           $.ajax({
                   type: "GET",
                   url: "/Back_AvailInfo.asp",
                   cache: false,
                   async:false, 
                   data: ({id: id}),
                   dataType: "html",
                   beforeSend: function (data) {
                                                 $('#availIn').html("<strong class='loading'><img src='/img/ajxw.gif' alt='ajxw.gif' />Zjišťuji, mějte prosím strpení...</strong>");
                                                 $('#avaibilitybox').css( { "right": (pos.left) + "px", "top":pos.top + "px" } );
                                                 $('#avaibilitybox').show();
                                                },
                                        
                   success: function (data) {
                          $('#availIn').html(data);
                           $('#avaibilitybox').css( { "right": (pos.left - 110) + "px", "top":pos.top + "px" } );
                           $('#avaibilitybox').show();
                    }
           });
       
    });


  $('#det_av strong').mouseleave(function () {
       $('#avaibilitybox').hide();
   });

  $('.com_avail').live("click", function(event){
    var pos = $(this).position();
    
    //kod
    var code = $(this).closest("form").children("input[name=Code]").val();
    $("#code_pneu").val(code);
    
    //nazev
    var name = $(this).closest("form").children("input[name=NameItem]").val();
    $("#name_pneu").val(name);

    //url
    var url = $(this).closest("form").children("input[name=prodUrl]").val();
    $("#url_pneu").val(url);
        
    
    $('#avaibilityboxAsk').css( { "right": (pos.left - 150) + "px", "top":pos.top - 150 + "px" } );
    $('#avaibilityboxAsk').show();
  });
  
  $('#ask_close').live("click", function(event){
    $('#avaibilityboxAsk').hide();
  });


  $('#ask_send').live("click", function(event){
      
          var sEmail = $('.av_body [name=email]').val();
          var count  = $('.av_body [name=count]').val();
          var ask = $('.av_body [name=ask]').val();
          var name_pneu = $('.av_body [name=name_pneu]').val();
          var code_pneu = $('.av_body [name=code_pneu]').val();
          var url_pneu = $('.av_body [name=url_pneu]').val();
                   
          if (!EmailControl(sEmail))  {return false;}
          if(count == "") {alert('Zadejte počet kusů dotazovaného produktu.'); return false;}
          if(ask == "") {alert('Zadejte dotaz na dostupnost.'); return false;}
          
           $.ajax({
                   type: "GET",
                   url: "/Back_AvailInfo.asp",
                   cache: false,
                   async:false, 
                   data: ({type: 'send', sEmail: sEmail, count: count, ask: encodeURI(ask), name_pneu: name_pneu, code_pneu: code_pneu, url_pneu: url_pneu}),
                   dataType: "html",
                   success: function (data) {
                      if (data == "ok") {
                        alert('Dotaz na dostupnost byl v pořádku odeslán.');
                        $('#avaibilityboxAsk').hide();
                      }
                   }
           });
     
       
    }); 

  //Alcar image
  $(".alcarProducts .productImg a").click(function(){
    
    var code = $(this).parents(".productImg").children("input[name=Code]").val();
    var sUrl = '';
    
      for (var i = 0; i < carsImg.length; i++) {
        if (carsImg[i][0] == code) {
            sUrl = carsImg[i][1];
            break;
        }
    }
    
    sUrl = sUrl.replace("&amp;","&")
    sUrl = sUrl.replace("&amp;","&")
    sUrl = sUrl.replace("&amp;","&")
    sUrl = sUrl.replace("&amp;","&")
   
    if (sUrl > "")
    {
       var  ifrm = document.createElement("iframe");
      ifrm.setAttribute("name", "imgPic");
      ifrm.setAttribute("id",  "imgPic");
      ifrm.setAttribute("src", sUrl);
      ifrm.width = "640px";
      ifrm.height = "300px";
    
    
     $(".imgContainer").html(ifrm);
     $('html,body').animate({scrollTop: $("#alcarFrm").offset().top},'slow');
     
     
    } 
    
    return false;
  });

  //Alcar image detail
  
  if ($("#imgContainerDetail").length) { 
 
      var code = $("input[name=Code]").val();
      var sUrl = '';
      
        for (var i = 0; i < carsImg.length; i++) {
          if (carsImg[i][0] == code) {
              sUrl = carsImg[i][1];
              break;
          }
      }
      
      sUrl = sUrl.replace("&amp;","&")
      sUrl = sUrl.replace("&amp;","&")
      sUrl = sUrl.replace("&amp;","&")
      sUrl = sUrl.replace("&amp;","&")
     
      if (sUrl > "")
      {
         var  ifrm = document.createElement("iframe");
        ifrm.setAttribute("name", "imgPic");
        ifrm.setAttribute("id",  "imgPic");
        ifrm.setAttribute("src", sUrl);
        ifrm.width = "640px";
        ifrm.height = "300px";
      
      
       $(".imgContainerDetail").html(ifrm);
       
      } 

  }

});

function SteelConfigGenerate(brand, type, model, dimension) {

     $.ajax({
                   type: "GET",
                   url: "/alcarocel.aspx",
                   cache: false,
                   async:true, 
                   data: ({getBrand: "1", brand: brand, type: type, model: model, dimension: dimension}),
                   dataType: "html",
                   success: function (data) {
                      if (data != "") {
                        data = data.replace("##ZNACKA##","ZNAČKA");
                        data = data.replace("##ROKVYROBY##","MODELOVÁ ŘADA");
                        data = data.replace("##PROVEDENI##","PROVEDENÍ");
                        data = data.replace("##ROZMERKOLA##","ROZMĚR KOLA");
                        $('#steel_config').html(data);
                      }
                   }
           });
}

function SteelConfigDetail(code, model) {

     $.ajax({
                   type: "GET",
                   url: "/alcarocel_detail.aspx",
                   cache: false,
                   async:true, 
                   data: ({code: code, model: model}),
                   dataType: "html",
                   success: function (data) {
                      if (data != "") {
                            eval(data);                
                      }
                   }
           });
}


