//this function show and hide product description
function showDescText(obj){
	if(document.getElementById){
		var el = document.getElementById(obj);
		var ar = document.getElementById("productsubdesc");
		if (ar)  //zpetna kompaktibilita v obecnem pouziti
		{
			ar = ar.getElementsByTagName("div");
		}

		if(el.style.display == "none"){
			if (ar) //zpetna kompaktibilita v obecnem pouziti
			{
				for (var i=0; i<ar.length; i++){
					ar[i].style.display = "block";
				}
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

//this function show only select id with prefix. Others will be hidden
function divIsVisible( objid )
{
	if( document.getElementById )
	{
		var el = document.getElementById( objid );
		return  el.style.display != "none";
	}
	return true;
}

//this funciton hide description on start
function infoldItems(){
	var par = document.getElementById("productsubdesc");
	if (par){
		var ar = par.getElementsByTagName("div");
		for(var i=0; i<ar.length; i++){
			ar[i].style.display = "none";
		}
	}
}

function sform_change_topic(){

	//zjistime ktera polozka je vybrana
	var cruseropts;
	cruseropts  = document.sales_form.cruser.options;
	var x = 1;
	var usingprd = "none_selected";
	do{
		if(cruseropts[x].selected == true){
			usingprd = cruseropts[x].value;
		}
	}while(++x < cruseropts.length);


	var finalarr = new Array();
	finalarr = chopts[usingprd];


	//vymazat stavajici polozky
	x = 0;
	do{
		document.sales_form.topic.options[x].value = "";
		document.sales_form.topic.options[x].text = "";

	}while(++x < document.sales_form.topic.options.length);

	//natahnout na pocatecni delku
	document.sales_form.topic.options.length = stopicsnum;

	//vsadit pozadovane polozky
	x = 0;
	do{
		document.sales_form.topic.options[x].value = finalarr[x];
		document.sales_form.topic.options[x].text = stopics[finalarr[x]];

	}while(++x < finalarr.length);

	//nastaveni vybrane polozky na hodnotu no_selected
	var a = 0;
	do{
		document.sales_form.topic.options[a].selected = false;
	}while(++a < document.sales_form.topic.options.length);
	document.sales_form.topic.options[0].selected = true;

	//odriznout prazdne polozky
	document.sales_form.topic.options.length = finalarr.length;

	//vynulovani incrementu
	x = null;
	a = null;
}//konec funkce sform_change_topics


/* funkce pro praci s tabs v e-shopu start */
function tabs_start () {

	var crttabs = document.getElementById("crttabs");
	crttabs.style.display = "block";

	var boxbuy = document.getElementById("boxbuy");
	boxbuy.className = "shpboxcrn";

	var tabbuy = document.getElementById("tabbuy");
	tabbuy.className =  "crttabla";

	var tabbuyin = document.getElementById("tabbuyin");
	tabbuyin.className = "crttabra";

	var abuy = document.getElementById("abuy");
	abuy.className = "shptaba";

	var boxrnw = document.getElementById("boxrnw");
	boxrnw.style.display = "none";

}

function sel_buy () {
	//window.alert("buy");
	tabs_start();
	var boxbuy = document.getElementById("boxbuy");
	boxbuy.style.display = "block";

	var tabrnw = document.getElementById("tabrnw");
	tabrnw.className =  "crttabl";

	var tabrnwin = document.getElementById("tabrnwin");
	tabrnwin.className = "crttabr";

	var arnw = document.getElementById("arnw");
	arnw.className = "shptab";

}


function sel_rnw () {
	//window.alert("rnw");

	var boxbuy = document.getElementById("boxbuy");
	boxbuy.style.display = "none";

	var boxrnw = document.getElementById("boxrnw");
	boxrnw.style.display = "block";
	boxrnw.className = "shpboxcrn";

	var tabbuy = document.getElementById("tabbuy");
	tabbuy.className =  "crttabl";

	var tabbuyin = document.getElementById("tabbuyin");
	tabbuyin.className = "crttabr";

	var abuy = document.getElementById("abuy");
	abuy.className = "shptab";

	var tabrnw = document.getElementById("tabrnw");
	tabrnw.className =  "crttabla";

	var tabrnwin = document.getElementById("tabrnwin");
	tabrnwin.className = "crttabra";

	var arnw = document.getElementById("arnw");
	arnw.className = "shptaba";

}


/* funkce pro paci s tabs v e-shopu konec */


function fix_ie_links(url)
{
	if (!window.ActiveXObject)
	{
		return;
	}

	//window.alert('Spoustim fix_ie_links');

	var links = document.getElementsByTagName('a');
	if (links != null && links.length > 0)
	{
		for (var i = 0; i < links.length; i++)
		{
			if ( links[i].getAttribute( 'href' )) //dlabej na kotvy
			{
				switch(links[i].className)
				{
					case 'cart':
					case 'del':
					case 'info':
					case 'key':
					case 'ovrw':
					case 'srch':
					case 'updt':
					case 'dwn':
					case 'arr':
					links[i].style.backgroundImage = 'none';
					links[i].style.padding = '0px';
					var img = document.createElement('img');
					img.setAttribute('src', url + 'hyp_' + links[i].className + '.gif');
					img.style.cssText = "margin-bottom: -1px; margin-left: 3px; margin-right: 0px;";
					links[i].appendChild(img);
					break;

					case 'hide':
					links[i].style.backgroundImage = 'none';
					links[i].style.padding = '0px';
					var img = document.createElement('img');
					img.setAttribute('src', url+'hyp_info_hide.gif');
					img.style.cssText = "margin-bottom: -1px; margin-left: 3px; margin-right: 0px;";
					links[i].appendChild(img);
					break;

					case 'helps':
					case '':
					links[i].style.backgroundImage = 'none';
					links[i].style.padding = '0px';
					var img = document.createElement('img');
					img.setAttribute('src', url+'hyp.gif');
					img.style.cssText = "margin-bottom: -1px;  margin-left: 3px; margin-right: 0px;";
					links[i].appendChild(img);
					break;
				}
			}
		}
	}
}

/* funkce pro upravu rtpanelu */
function rtPanelPos( )
{
	var certin = document.getElementById("certin");
	var certpl = document.getElementById("certpl");

	var certinH = certin.clientHeight;
	var certplH = certpl.scrollHeight;

	var cssHeight = "";
	if( certplH > 144 )
	{
		certplH = 144;
		var cssHeight = " height: "+certplH+"px";
	}

	var topPos = 0;
	topPos = certinH - certplH - 6;

	certpl.style.cssText = "margin-top: "+topPos+"px;"+cssHeight;
}













