﻿function cancelsubmit(evt){
	evt = (evt) ? evt : event;	
	var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
	if (charCode == 13 || charCode == 3) 
	{
		return false;
	}
	return true;
}
var win2;
function openForgotPopup(_fullscreenhref,_emailboxid){
	var email = document.getElementById(_emailboxid).value;
	var _url = "forgotpasswordpopup.aspx?emailboxid="+_emailboxid+"&email="+email;
	var _width = 265;
	var _height = 320;
	var ua=navigator.userAgent.toLowerCase();	
	if(ua.indexOf("msie")!=-1 && ua.indexOf("opera")==-1){
		try{
			var ret = window.showModalDialog(_url,null,"dialogWidth:"+_width+"px; menubar:0; dialogHeight:"+_height+"px");
			if (ret != null && ret != "")
			{
				document.getElementById(_emailboxid).value=ret;
			}
		}catch(e){
			self.location=_fullscreenhref;
		}
	}else{
		var winl = (screen.width - _width) / 2;
		var wint = (screen.height - _height) / 2;
		var winprops = 'height='+_height+',width='+_width+',top='+wint+',left='+winl+', modal=yes,scrollbars=no,resizable';
		win2 = window.open(_url, "win2", winprops);
		if(!win2){
			self.location=_fullscreenhref;
		}else{
			win2.focus();
		}
	}
	return false;
}

function openOfferPricePopup(_fullscreenhref,_itemid){
	var _url = "offerpricepopup.aspx?itemid="+_itemid;
	var _width = 245;
	var _height = 350;
	var ua = navigator.userAgent.toLowerCase();	
	if(ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1){
		try{
			window.showModalDialog(_url,null,"dialogHeight: "+(_height+100+"px; dialogWidth: "+_width)+"px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
			//dialogWidth:"+()+"px; menubar:0; dialogHeight:"++"px");
		}catch(e){
			//alert(e)
			self.location=_fullscreenhref;
		}
	}else{
		var winl = (screen.width - _width) / 2;
		var wint = (screen.height - _height) / 2;
		var winprops = 'height='+_height+',width='+_width+',top='+wint+',left='+winl+', modal=yes,scrollbars=no,resizable';
		win2 = window.open(_url, "win2", winprops);
		if(!win2){
			self.location=_fullscreenhref;
		}else{
			win2.focus();
		}
	}
	return false;
}

function showalreadyinbasketmsg(){
	return confirm('מוצר כבר בסל קניות.\nלהוסיף עוד אחד?');
}

var popup;

function showFullImage(imageurl, title){
	var html = "<html"+"><head"+"><title"+">" + title + "</title>" 
	+ "<style>body{margin:0px; height:100%; width:100%; font-family:arial; font-size: 15px; COLOR: #2462c0; }</style>" 
	+ "<script language=\"javascript\"><!--\n" 
	+ "function init(_imgpre){\n" 
	
	//+ "window.setTimeout(function(){"
	
	+ "_imgpre.style.display=\"none\";\n" 
	+ "document.getElementById(\"image\").style.display=\"\";\n" 
	+ "document.getElementById(\"waitText\").style.display=\"none\";\n" 
	+ "window.moveTo((screen.width-document.getElementById(\"image\").width)/2,(screen.height-document.getElementById(\"image\").height)/2);\n"
	+ "window.resizeTo(document.getElementById(\"image\").width+30,document.getElementById(\"image\").height+70);\n"
	
	//+ "}, 1000);"
	
	+ "}\n"
	+ "function onimageerror(_imgpre){\n"
	+ "document.getElementById(\"waitText\").innerHTML=\"<h3>הדף המבוקש לא נמצא...</h3>\";\n"
	+ ""
	+ "}\n"
	+ "--></"+"script>" 
	+ "</"+"head><"+"body><table style=\"height:100%; width:100%\" cellSpacing=\"0\" cellPadding=\"0\"><tr><td align=\"center\">" 
	+ "<a href=\"#סגור חלון\" style=\"display:block; height:100%; line-height:200px; width:100%; text-decoration:none;\" onclick=\"javascript:opener.focus();window.close();return false;\" title=\"סגור חלון\">"
	+ "<span id=\"waitText\" style=\"width:200px;\"><marquee direction=\"right\">.התמונה נטענת. אנא המתן</marquee></span>"
	+ "<img src='" + imageurl + "' border=\"0\" id=\"image\" " + " style=\"display:none\">" 
	+ "</a>" 
	+ "<img src='" + imageurl + "' border=\"0\" width=\"1\" height=\"1\" onload=\"init(this)\" onerror=\"onimageerror(this)\"></td></tr></table>" 
	+ "</"+"body></"+"html>";
	popup = window.open("","image","left="+(screen.width/2-100)+",top="+(screen.height/2-100)+",width = 300, height=200, toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1");
	popup.document.open();
	popup.document.write(html);
	popup.document.close();
	popup.focus();	
	return false;
};

