function bookMark(title, url) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if ( window.external ) { // IE Favorite
		window.external.AddFavorite(url, title); 
	}
}

function inputClick(id, defval) {
	val = document.getElementById(id).value;
	if (val == defval) {
		document.getElementById(id).value = '';
	}
}

function inputBlur(id, defval) {
	val = document.getElementById(id).value;
	if (val == '') {
		document.getElementById(id).value = defval;
	}
}

function changeVar(v) {
	$('cartadded').empty();
	
	var url = "/inc/ajax/varprice.php?v=" + v;
	new Ajax(url, {method: 'get', update: $('varprice')}).request();

}

function changeVarYear(v) {
	var col = false;
	if (isNaN(v)) col = true;

	if (v.length == 0) {
		$('subcol').empty();
		$('varprice').empty();
	} else {
	
		if (col) {
			var url = "/inc/ajax/subcol.php?v=" + v;
			new Ajax(url, {method: 'get', update: $('subcol')}).request();
		} else {
			var url = "/inc/ajax/varprice.php?v=" + v;
			new Ajax(url, {method: 'get', update: $('varprice')}).request();		
		}
	
	}
}


function changeVarCol(v) {
	var strarr = v.split('|');
	v = strarr[0];
	var c = strarr[1];
	var url = "/inc/ajax/varprice.php?v=" + v + "&c=" + c;
	new Ajax(url, {method: 'get', update: $('varprice')}).request();		
}

function addToCart(p,v,c) {
	var url = "/inc/ajax/addtocart.php?p=" + p + "&v=" + v;

	if (c.length > 0) url += "&c=" + c;
	
	new Ajax(url, {method: 'get', update: $('cartadded')}).request();	
	
	var url = "/inc/ajax/topcart.php";
	new Ajax(url, {method: 'get', update: $('topcartinner')}).request();	
}

function searchFilter() {	
	document.location = '/searchbounce.php?srt=' + $('sortby').value + '&npp=' + $('perpage').value;
}

function prodFilter(from) {	
	document.location = '/searchbounce.php?srt=' + $('sortby').value + '&from=' + from;
}

function showstates(sel,scon) {
	var value = sel.options[sel.selectedIndex].value;
	if (value == "28") {
		document.getElementById(scon).style.display = "block";
	} else {
		document.getElementById(scon).style.display = "none";
	}
}