﻿$(document).ready(function () {
	rszorderformmodal();
	setcntr('orderform', 700, 490);
	$(window).scroll(rszorderformmodal).resize(rszorderformmodal);

	$('#newshot .dvr, #newshot .dvl').live(
		'click', function (event) {
			location.href = $(this).parent().attr('href');
		}
	);
});



function rszorderformmodal() {
	var div = $$("orderformmodal");
	div.style.position = "absolute";
	div.style.top = "0";
	//div.style.zIndex = "999997";
	if (oBw.konqueror) { div.style.backgroundColor = "transparent" }
	else {
		if (oBw.ie) { div.style.filter = "alpha(opacity=70)" }
		else { div.style.opacity = "0.7" }
	}
	var z = getPageSize();
	div.style.height = (z[1] + 20) + "px";
	var m = document;
	if (oBw.isIE) { div.style.left = m.documentElement.scrollLeft; div.style.width = m.documentElement.clientWidth }
	else { div.style.left = "0"; div.style.width = "100%" }
}

function setaFav(type) {
	var title = document.title;
	var url = location.href;
	switch (type) {
		case "fav":
			if (window.sidebar) { // Mozilla Firefox
				window.sidebar.addPanel(title, url, "");
			}
			else if (window.external && document.all){// if the browser is IE open the add favorite window
				window.external.AddFavorite(url, title);
			}
			else if (window.opera && window.print) {
				window.external.AddFavorite(url, title);
			}
			else {// Display and alert box for any other browser.
				alert("מצטערים אך הדפדפן שלך לא תומך במאפיין זה." +
					"\nנא להשתמש במועדפים של הדפדפן כדי לשמור את כתובת האתר.");
			}
			break;
		case "google":
			open('http://www.google.co.il/');
			//open('http://www.google.com/bookmarks/mark?op=add&bkmk=' + encodeURI(location.href) +
			//	'&title=' + encodeURI(document.title) + '&annotation=');
			break;
		case "tweeter":
			open('http://twitter.com/home?status=' + encodeURI(document.title + '\r\n' + location.href));
			break;
		case "facebook":
			open('http://www.facebook.com/share.php?u=' + encodeURI(location.href));
			break;
	}
}



function tgldtls(obj) {
	var j = $(obj);
	if (j.hasClass("onn")) {
		j.css("background-position", "0 0");
		j.removeClass("onn");
		var h = j.parent().parent().height() - j.next(".dvdtlstbl").height() - 15;
		j.parent().animate({ height: h }, "fast");
		//j.next(".dvdtlstbl").css("display", "none");
		j.next(".dvdtlstbl").css("visibility", "hidden");
		//j.next(".dvdtlstbl").hide("blind", null, "fast");
		return false;
	}

	j.css("background-position", "0 -21px");
	j.addClass("onn");

	//j.next(".dvdtlstbl").css("display", "block");
	var p1 = j.parent().parent().offset();
	var p2 = j.parent().offset();
	//alert(j.parent().parent().outerHeight());
	j.next(".dvdtlstbl").css("top", p1.top - p2.top + j.parent().parent().outerHeight() - 15 + "px");


	j.next(".dvdtlstbl").css("visibility", "visible");
	var h = j.parent().parent().height() + j.next(".dvdtlstbl").height() + 15;
	j.parent().animate({ height: h }, "fast");
	j.next(".dvdtlstbl").show("blind", null, "fast");

	return false;
}

var lstsbctgry = null;
function tglctgrymnu(obj) {
	var j = $(obj);
	if (lstsbctgry == null && j.next().css("display") == "block")
		lstsbctgry = j;
	if (lstsbctgry != null) {
		if (lstsbctgry.get(0) == j.get(0)) {
			lstsbctgry = null;
		} else {
			lstsbctgry.next().hide("blind", null, "fast");
			j.next().show("blind", null, "fast");
			lstsbctgry = j;
			return false;
		}
		if (j.next().css("display") == "block") {
			lstsbctgry = null;
		}
		j.next().hide("blind", null, "fast");
		return false;
	}

	j.next().show("blind", null, "fast");

	lstsbctgry = j;
	return false;
}



var banner_order_clicked = false;
function banner_order_DoFSCommand(command, args) {
	run_bod(0);
}
function run_bod(prvt) {
	if (banner_order_clicked) return;
	banner_order_clicked = true;
	setTimeout('banner_order_clicked=false', 500);
	//alert("banner_order_DoFSCommand cm: '"+command+"' arg: '"+args+"'");
	try {
		setCmd('order_open', '' + __order_cat_id + '#' + __order_subcat_id + '#' + __order_offer_id + '#' + (prvt >= 1 || prvt <= 4 ? prvt : 0), 1);
	} catch (e) { ; }
}

var banner_signup_clicked = false;
function banner_signup_DoFSCommand(command, args) {
	if (banner_signup_clicked) return;
	banner_signup_clicked = true;
	setTimeout('banner_signup_clicked=false', 500);
	//alert("banner_signup_DoFSCommand cm: '"+command+"' arg: '"+args+"'");
	try {
		location.href = '/profile.html';
	} catch (e) { ; }
}

