//************************************************************************//
//   QShop E-Commerce Solutions                                           //
//   Copyright @ VISUAL TECHNOLOGIES INC  2002-2009                       //
//   http://qshop.com.pl qshop@qshop.com.pl                               //
//************************************************************************//
//   This software is copyrighted, do not attempt to copy                 //
//   without permission                                                   //
//************************************************************************//
function change_opt(item) {
	param = item.options[item.selectedIndex].value;
	window.location.href = "show.php?id="+param;
}
function change_search_cat(obj) {
	catx_g = document.getElementById(obj.id).options[document.getElementById(obj.id).selectedIndex].value;
	document.getElementById(obj.id+'_search').value = catx_g;
	document.search_data_form.submit();
}
function update_co_quick(item) {
	newco = item.options[item.selectedIndex].value;
	document.location.href = 'quick_account.php?next=1'+replace_amp('&amp;')+'co='+newco;
}
function cart_comment_char() {
	if(document.getElementById('tran_comm').value.length>254) {
		document.getElementById('save_tran_comm').disabled = true;
	} else {
		document.getElementById('save_tran_comm').disabled = false;	
	}
	document.getElementById('tran_comm_left').innerHTML = 255-parseFloat(document.getElementById('tran_comm').value.length);
}
function show_zn() {
	window.open('_template/_znaczniki.php', 'Znaczniki', 'width=430,height=200,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function PoliczRate(koszyk,client_ID,wariantSklepu)	{
	 window.open('https://www.eraty.pl/symulator/oblicz.php?numerSklepu='+client_ID+'&wariantSklepu='+wariantSklepu+'&typProduktu=0&wartoscTowarow='+koszyk, 'Policz_rate','width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function nowe_okno() {
	window.open('https://www.zagiel.com.pl/kalkulator/jak_kupic.html', 'nowe_okno',
	'width=600,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function validate_Zagiel() {
	if (document.getElementById('agree').checked==false){
		alert ("Zanim złożysz zamówienie, zapoznaj sie z procedura udzielenia kredytu ratalnego eKredyt Żagiel.");
		return false;
	} else {
		return true;
	}
}
function linked(obj) {
	if(GE('view_linked_'+obj).style.display=='') {
		GE('view_linked_'+obj).style.display = 'none';
		GE('view_linked_pic_'+obj).src = dbv+'gif/plus.gif';
	} else {
		GE('view_linked_'+obj).style.display = '';
		GE('view_linked_pic_'+obj).src = dbv+'gif/minus.gif';
	}
}
function OWP(point) { 
	window.open('_template/points.php?point='+point,'',"resizable=no,width=470,height=350");
}
function call_url(obj) {
	document.location.href = obj;
}
function openhelp() {
	Height = 450;
	Width = 500;
	var L = (screen.width - Width) / 8; 
	var T = (screen.height - Height) / 8; 
	var par = "directories=no,fullscreen=no,height=" + Height + ",width=" + Width + ",left=" + L + ",top=" + T + ",";    par += "location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"; 
	window.open(dbv+"_template/_helpx.php", "", par); 
}
function change_cur_val(dbv,item) {
	param=item.options[item.selectedIndex].value;
	window.location.href = dbv+"index.php?show=start"+replace_amp('&amp;')+"action=change_current_val"+replace_amp('&amp;')+"new_val="+param;
}
function replace_amp(obj) {
	return obj.replace(/&amp;/g,'&');
}
function SCREEN_SIZE(wh) {
	if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape"||navigator.appName=="Opera") {
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight;
		}
	}
	if(wh=='width') {
		return winW;	
	} else { 
		return winH;
	}
}
function SCREEN_OFFSET(){ 
	var ns4 = (document.layers)? true:false; 
	if (ns4) 
		return (window.pageYOffset);              
	else 
		return (window.document.documentElement.scrollTop);  
}
// resize and scrolling
function WINDOW_RESIZE() {
	window_scrolling();
}
function GE(element) {
	return document.getElementById(element);	
}
function OPEN_POINTS(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function get_event() {
	WINDOW_RESIZE();
	window.onresize = function() { 
		WINDOW_RESIZE(); 
	}
	window.onscroll = function() { 
		WINDOW_RESIZE(); 
	}
	try {
		startw();
	}
	catch(Error) {
		
	}
}
function tab_over(id) {
	GE('tab_pic1'+id).src = dbv+'themes/'+current_theme+'/pl/backtab_left_normal1.jpg';
	elem = document.getElementById('tab_pic2'+id);
	elem.style.background = 'url('+dbv+'themes/'+current_theme+'/pl/backtab_normal1.jpg)';
	GE('tab_pic3'+id).src = dbv+'themes/'+current_theme+'/pl/backtab_right_normal1.jpg';
	GE('tab_pic_text'+id).className = 'menu_section_up_hover';
}
function tab_out(id) {
	GE('tab_pic1'+id).src = dbv+'themes/'+current_theme+'/pl/backtab_left_normal.jpg';
	elem = document.getElementById('tab_pic2'+id);
	elem.style.background = 'url('+dbv+'themes/'+current_theme+'/pl/backtab_normal.jpg)';
	GE('tab_pic3'+id).src = dbv+'themes/'+current_theme+'/pl/backtab_right_normal.jpg';
	GE('tab_pic_text'+id).className = 'menu_section_up';
}
var last_left_tab = null;
function show_tab_left(obj) {
	try {
		selects = document.getElementsByTagName("div");
		for (i = 0; i != selects.length; i++) {
			ElementID = selects[i].id; 
			if(ElementID.indexOf('left_tab')==0) {
				if(last_left_tab!=obj) {
					selects[i].style.display = "none";
				}
			}
		}
		if(GE(obj)!=null) {
			if(GE(obj).style.display=='none') {
				GE(obj).style.display = '';
				GE(obj+'_pic').src = dbv+'gif/minus.gif';
			} else {
				GE(obj).style.display = 'none';	
				GE(obj+'_pic').src = dbv+'gif/plus.gif';
			}
		}
	}
	catch(Error) {
		
	}
	last_left_tab = obj;
}
function qty_ask(obj) {
	Height = 250;
	Width = 500;
	var L = (screen.width - Width) / 8; 
	var T = (screen.height - Height) / 8; 
	var par = "directories=no,fullscreen=no,height=" + Height + ",width=" + Width + ",left=" + L + ",top=" + T + ",";    par += "location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"; 
	window.open(dbv+"_template/_ask_about_qty.php?itemId="+obj, "", par); 
}
function main() {
	this.objects_sel_catx = function(item) {
		catx = item.options[item.selectedIndex].value
		document.location.href = dbv+catx+','+item.options[item.selectedIndex].text;
	}
	this.objects_sel_producer = function(item,catx) {
		producer = item.options[item.selectedIndex].value;
		if(producer!="0") {
			document.location.href = dbv+item.options[item.selectedIndex].text+'-'+producer+'.html';
		}
	}
	this.objects_sel_caty = function(item,prod_id,nazwa) {
		caty = item.options[item.selectedIndex].value;
		if(caty!="0") {
			document.location.href = dbv+nazwa+'-'+prod_id+','+caty+'.html';
		}
	}
	this.objects_sel_model = function(item) {
		model = item.options[item.selectedIndex].value;
		if(model!="0") {
			document.location.href = dbv+'category.php?caty='+model;
		}
	}
	this.objects_sel_producer_caty = function(item,caty) {
		marka = item.options[item.selectedIndex].value;
		if(marka!="0") {
			document.location.href = dbv+item.options[item.selectedIndex].text+'-'+marka+','+caty+'.html';
		}
	}
}
main = new main();