var IfIE = CheckIfIE();
/*------------------------------------------------------*/
function CheckIfIE(){
	var browser;
	/*-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - */
	if (CheckIfIE_checkIt('konqueror')) browser = "Konqueror";
	else if (CheckIfIE_checkIt('safari')) browser = "Safari"
	else if (CheckIfIE_checkIt('omniweb')) browser = "OmniWeb"
	else if (CheckIfIE_checkIt('opera')) browser = "Opera"
	else if (CheckIfIE_checkIt('webtv')) browser = "WebTV";
	else if (CheckIfIE_checkIt('icab')) browser = "iCab"
	else if (CheckIfIE_checkIt('msie')) browser = "Internet Explorer"
	else if (!CheckIfIE_checkIt('compatible')) browser = "Netscape Navigator"
	else browser = "An unknown browser";
	return (browser=="Internet Explorer")
}
/*-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */
function CheckIfIE_checkIt(string)
{
	var detect = navigator.userAgent.toLowerCase();
	/*-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - */
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
/*------------------------------------------------------*/
function Error_off(){
	ErrorBox.style.display = 'none';
}
/*------------------------------------------------------*/
function CheckBeforeSubmit(frm){
	//var RealUrl = frm.RealUrl.value;
	var RealUrl = document.getElementById("RealUrl").value;
		RealUrl=RealUrl.toLowerCase();
	var ErrorArea = document.getElementById("ErrorArea");
	var Error = null;
	//===========================
	if ((RealUrl.indexOf("://")<1) && (RealUrl.indexOf("@")<1)) Error = '<Div>עליך להשתמש בפרוטוקול כלשהו, לדוגמא <span dir=ltr>http://</span></Div>';
	if ((RealUrl=="http://") || (RealUrl.length<1)) Error = '<Div>עליך למלא כתובת כלשהי לקיצור, לדוגמא - <BR><span dir=ltr>http://www.google.co.il/search?hl=iw&q=Israel</span></Div>';
	//===========================
	if (Error!=null) {
		ErrorArea.innerHTML = Error;
		ErrorArea.style.visibility = 'visible';
		return false;
	}else return true;
}
/*------------------------------------------------------*/
function Error_Highlite(mode){
	var ErrorBox = document.getElementById("ErrorBox");
	if (mode=='on')	ErrorBox.style.filter = 'alpha(opacity=100)';
	else ErrorBox.style.filter = 'alpha(opacity=80)';
}
/*------------------------------------------------------*/
function Error_on(Sign, ErrorStr){
	if (!IfIE){
		ErrorStr.Replace('<BR>', '\n');
		alert(ErrorStr);
	} else {
		var clientWidth = document.body.clientWidth;
		var clientHeight = document.body.clientHeight;
		var ErrorBox = document.getElementById("ErrorBox")
		var ErrorBoxStr = document.getElementById("ErrorBoxStr")
		/*-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - */
		var Param;
			if (ErrorStr.length<=30) Param=5;
			else if (ErrorStr.length<=60) Param=3;
				 else Param=2.5;
		var Width = clientWidth/Param;
		var Height = clientHeight/Param;
		var posTop = (clientHeight/2)-Height;
			if (posTop<=0) posTop = clientHeight/4;
		var posRight = (clientWidth/2)-Width/2-110/2;  //(110 is the Padding-Left)
		/*-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - */
		ErrorBox.style.display = 'inline';
		if (Param==5) ErrorBox.style.height = 100;  // so that we will be able to see the sign
		ErrorBox.style.width = Width;
		ErrorBox.style.top = posTop;
		ErrorBox.style.right = posRight;
		/*-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - */
		ErrorBoxStr.innerHTML = ErrorStr + ErrorBoxStr.innerHTML;
		//Sign = '!';
		if (Sign=='i') ErrorBox.className = "Info";
		else {ErrorBox.className = "Attention"; ErrorBoxStr.className = "ErrorBoxStr_When_Attention";}
	}
}
/*------------------------------------------------------*/

