function form_focus(strElementId) {
    document.getElementById(strElementId).focus();	
}

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function ManageLessMore(iCase) {
	var iMax = document.getElementById('qmax').value*1;
	var q = document.getElementById('quantity');
	var qCur = q.value*1;
	if(iCase==1&&qCur<iMax) q.value=++qCur;
	if(iCase==-1&&qCur>1) q.value=--qCur;
	if(iCase==0&&qCur>iMax) { 
		q.value=iMax;
		qCur=iMax; }
	document.getElementById('divquantity').innerHTML=qCur;
	if(qCur>1) {
		document.getElementById('divless').style.display='';
		document.getElementById('divnoless').style.display='none';}
	else {
		document.getElementById('divnoless').style.display='';
		document.getElementById('divless').style.display='none';}
	if(qCur<iMax) {
		document.getElementById('divmore').style.display='';
		document.getElementById('divnomore').style.display='none';}
	else {
		document.getElementById('divnomore').style.display='';
		document.getElementById('divmore').style.display='none';}
} 

function ShowHide(idDiv)
{
	var obj=document.getElementById(idDiv).style;
	if(obj) {
		if(obj.display=='none') obj.display='';
		else obj.display='none';
	}
}

function ShowSell(sCase, iCase, iTotal) {
	if(iCase==0) iCase=iTotal;
	if(iCase>iTotal) iCase = 1;
	for(i=1;i<=iTotal;i++) {
		if(i==iCase) {
			document.getElementById(sCase+'_'+i).style.display='';
			obj = document.getElementById(sCase+'Count_'+i);
			if(obj) obj.style.display='';}
		else { 
			document.getElementById(sCase+'_'+i).style.display='none';
			obj = document.getElementById(sCase+'Count_'+i);
			if(obj) obj.style.display='none';}
	}
}

function checkVoucher(frm) {
	intDay = frm.voucher_before.value.substring(0, 2); 
	intMonth = frm.voucher_before.value.substring(3, 5); 
	intYear = frm.voucher_before.value.substring(6, 10);  
	
	if (frm.voucher.value.length > 0 && frm.voucher_check.value.length > 0 && frm.voucher_used.value != '1') {
		if (frm.voucher.value == frm.voucher_check.value)
			if (new Date() <= new Date(intYear, intMonth-1, intDay))
				frm.submit();
			else
				alert('Voucher was valid until ' + frm.voucher_before.value);
		else
			alert('Voucher is not correct');
	}
	else {
		frm.submit();
	}
}

function EmptyField(pid) {
	document.getElementById(pid).focus();
	document.getElementById(pid).select();
}

function checkAgree() {
  if (!(document.getElementById('agree').checked))
	    alert(document.getElementById('message').value);
	else
	    document.frmBasket.submit();
}

function ShowLightBox(){  
	var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;  
	var layer = document.createElement('div');  
	layer.style.zIndex = 2000;  
	layer.id = 'layer';  
	layer.style.position = 'absolute'; 
	layer.style.top = '0px';  
	layer.style.left = '0px';  
	layer.style.height = document.documentElement.scrollHeight + 'px';  
	layer.style.width = width + 'px';  
	layer.style.backgroundColor = 'black';  
	layer.style.opacity = '.6';  
	layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");  
	document.body.appendChild(layer);  
	var div = document.createElement('div');  
	div.style.zIndex = 3000;  
	div.id = 'box';  
	div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';  
	div.style.top = '200px';  
	div.style.left = (width / 2) - (900 / 2) + 'px';   
	div.style.height = '408px';  
	div.style.width = '892px';  
	// div.style.backgroundColor = 'none';  
	div.style.border = '0px solid silver';  
	div.style.padding = '0px'; 
	document.body.appendChild(div);  
	var sContent = document.getElementById('getCarrousel');
	if(sContent) sContent = sContent.innerHTML.replace('maskCarousel','carousel'); else sContent = '';
	var p = document.createElement('div');  
	p.innerHTML = sContent;  
	div.appendChild(p);  
	/*
	var a = document.createElement('a');  
	a.innerHTML = 'Close window';  
	a.href = 'javascript:void(0)';  
	a.onclick = function()  {    
		document.body.removeChild(document.getElementById('layer'));    
		document.body.removeChild(document.getElementById('box'));  
	};   
	div.appendChild(a);
	*/
	$('#carousel').infiniteCarousel({
		transitionSpeed: 4000,
		displayTime: 0,
		displayProgressBar: false,
		displayThumbnails: false,
		displayThumbnailNumbers: false,
		displayThumbnailBackground: false,
		imagePath: '/jquery/infinitecarousel2/images/',
		easeLeft: 'linear',
		easeRight: 'linear',
		inView: 2,
		padding: '4px',
		advance: 1,
		showControls: false,
		autoHideControls: false,
		autoHideCaptions: false,
		autoStart: true,
		prevNextInternal: true
	});
}
