function openWindowScroll(url,popW,popH)
{
	w = window.screen.width;
	h = window.screen.height;

	popW = popW +6;
	popH = popH+45;

	var leftPos = (w-popW)/2;
	var topPos = (h-popH)/2;
	var options = 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left='+leftPos + ',resizable=1, status=0, titlebar=0 ,scrollbars=1';

	var regExStr = /add_to_favorites/i;
	if (regExStr.test (url)) {
		var k = window.open(url,'add_to_favorites',options);
	} else {
		var k = window.open(url,'new_win',options);
	}
	k.resizeTo(popW,popH);
	return k;
}

function mouseEventHandle (num,evnt) {

	if (evnt) {
		document.getElementById ('product'+num).className = 'productOver';
		document.getElementById ('href'+num).className = 'blackproductsOver';
		var elid = document.getElementById ('price'+num);
		if (elid) {
			document.getElementById ('price'+num).className = 'priceOver';
			document.getElementById ('dprice'+num).className = 'priceOver';
		}
	} else {
		document.getElementById ('product'+num).className = 'product';
		document.getElementById ('href'+num).className = 'blackproducts';
		var elid = document.getElementById ('price'+num);
		if (elid) {
			document.getElementById ('price'+num).className = 'price';
			document.getElementById ('dprice'+num).className = 'price';
		}
	}

}

function addBookmark (ptitle,url) {
	if (window.sidebar) {
		alert ("Press Ctrl+D to Bookmark This Site.");
	} else if (document.all) {
		window.external.AddFavorite (url,ptitle);
	} else if (window.opera && window.print) {
		return true;
	}
}


function correctInput (el,e, id) {

	var val = el.value;
		val = val.replace (/[^0-9]+/g,"");
		el.value = val;
	if (el.getAttribute('total_pages')) {
    	var max_value = parseInt(el.getAttribute('total_pages'));
    	if (val && max_value) {
			if (parseInt(val) > max_value || parseInt(val) < 1) {
				val = max_value;//val.substr(0, (val.length - 1));
				el.value = val;
			}
		}
 	}
}

