//Spry.Debug.enableTrace = false; 
var scrollSpryTop = 0;
function redirectSetVal(){
	var rredir = location.pathname+location.search+location.hash;
	if($("input#accesscheck").length > 0){
		$("input#accesscheck").val(rredir);
	}
	var pathCheckout = location.pathname.indexOf("/checkout.php");
	if(pathCheckout != 3 && pathCheckout != 0){
		document.cookie="REFERER="+escape(rredir)+"; path=/";
	}
}
$(document).ready(function () {
	scrollSpryTop = $("a#scrollTo").position().top;
	var lPass = $("#l_pass");
	if(lPass.length > 0 && lPass.val() != ""){
		$("#log_pass").addClass("textfieldValidState");
	}
	$(".setBorder tr:odd").addClass("odd");
	$(".setBorder tr:even").addClass("even");
	redirectSetVal();
});
$(window).bind("hashchange", function() {
	$('meta[property="og:url"]').attr("content", encodeURIComponent(window.location));
	redirectSetVal();
});
function termsWindow(url, width, height) {
	var w = (typeof(width) == "undefined") ? 650 : width;
	var h = (typeof(height) == "undefined") ? 450 : height;
	var scX = (screen.width - w) / 2;
	var scY = (screen.height - h) / 2;
	mwin = 'width='+w+',height='+h+',top='+scY+',left='+scX+'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no';
	win = window.open(url, 'viewDetails', mwin);
	win.window.focus();
	return false;
}
$.ajaxSetup ({
    // Disable caching of AJAX responses */
    cache: false
});
var dsSearch = new Spry.Data.XMLDataSet("/xml/xml_search.php?pSize=10&w=50&h=50&zc=1", "ResultSet/item", {useCache: false});
dsSearch.setColumnType("title", "html");
dsSearch.setColumnType("image", "image");
dsSearch.setColumnType("image/@width", "number");
dsSearch.setColumnType("image/@height", "number");
function submitSearch(){
	setTimeout((function(){
		document.getElementById('fSearchForm').submit();
	}), 500);
}
function fbShareWindow(url) {
	var w = 650;
	var h = 450;
	var scX = (screen.width - w) / 2;
	var scY = (screen.height - h) / 2;
	mwin = 'width='+w+',height='+h+',top='+scY+',left='+scX+'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no';
	win = window.open(url, 'viewDetails', mwin);
	win.window.focus();
	return false;
}
