function testMinRequirements()
{	
	requirementsPassed = true;
	browserPassed = true;
	
	detectBrowser();
	if ( ( (browser == 'IE') && (version <7) ) || ( (browser == 'Firefox') && (version <3) ) )
	{
		browserPassed = false;
		requirementsPassed = false;
	}
	

	if (!requirementsPassed)
	{

		// check client old browser
		browserOriginalCookie = getCookie("webix%2DbrowserOriginal");
		if (browserOriginalCookie == null)
		{
			createCookie("webix%2Dguid",guid(),365);
			createCookie("webix%2DbrowserOriginal",browser+''+version,365);
		}

		requirementsCookie = getCookie("webix%2DminRequirements");
		if (requirementsCookie == null)
		{
			createCookie("webix%2DminRequirements","yes",0); // session cookie
			minRequirementsAlert (browserPassed);
		}
	}
	else
	{
		// check client old browser
		browserOriginalCookie = getCookie("webix%2DbrowserOriginal");
		browserNewCookie = getCookie("webix%2DbrowserNew");
		if ( (browserOriginalCookie != null) && (browserNewCookie == null) )
		{
			createCookie("webix%2DbrowserNew",browser+''+version,365);
		}		
	}
}


var browser = '';
var version = '';
function detectBrowser()
{	
	userAgent = navigator.userAgent;
	
	
	if (userAgent.indexOf('MSIE') != -1)
		browser = 'IE'
	else if (userAgent.indexOf('Firefox') != -1)
		browser = 'Firefox'
	else browser = 'unknown';

	if (browser == 'IE')
	{
		BrowserStart_Pos = userAgent.indexOf('IE')
		BrowserEnd_Pos = userAgent.indexOf(';',BrowserStart_Pos)
		version = parseFloat(userAgent.substring (BrowserStart_Pos+2, BrowserEnd_Pos));
		
	}

	if (browser == 'Firefox')
	{
		BrowserStart_Pos = userAgent.indexOf('Firefox')
		BrowserEnd_Pos = userAgent.length;
		version = parseFloat(userAgent.substring (BrowserStart_Pos+8, BrowserEnd_Pos));
	}
}


function minRequirementsAlert(browserPassed)
{

	HTML = "<span style='font-size:14px; font-weight:bold; color:white; text-decoration:underline;'>הודעות מערכת</span><br/>";
	HTML += "<ul style=' list-style-type: disc; color:white;'>";

	if (!browserPassed)
	{

		if (browser == 'IE')
		{
			HTML += "<li>המערכת זיהתה כי הינך משתמש בדפדפן " + browser + " " + version + ".<br/>";
			HTML += "האתר מותאם לשימוש בדפדפן IE מגרסה 7 ומעלה.<br/>";
			upgradeBrowser_str = "<a href='http://www.microsoft.com/downloads/details.aspx?FamilyID=9ae91ebe-3385-447c-8a30-081805b2f90b&DisplayLang=en' target='_blank'>שדרוג</a> הדפדפן שלך.";
		}

		if (browser == 'Firefox')
		{
			HTML += "<li>המערכת זיהתה כי הינך משתמש בדפדפן " + browser + " " + version + ".<br/>";
			HTML += "האתר מותאם לשימוש בדפדפן Firefox מגרסה 3 ומעלה.<br/>";
			upgradeBrowser_str = "<a href='http://www.mozilla.com/en-US/firefox' target='_blank'>שדרוג</a> הדפדפן שלך.";
		}

		if (browser == 'unknown')
		{
			HTML += "<li>המערכת זיהתה כי הינך משתמש בדפדפן לא ידוע.<br/>";
			HTML += "האתר מותאם לשימוש בדפדפן IE מגירסה 7 ומעלה או Firefox מגרסה 3 ומעלה.<br/>";
			upgradeBrowser_str = "התקנת <a href='http://www.microsoft.com/downloads/details.aspx?FamilyID=9ae91ebe-3385-447c-8a30-081805b2f90b&DisplayLang=en' target='_blank'>IE</a> או <a href='http://www.mozilla.com/en-US/firefox' target='_blank'>Firefox</a>";
		}
	
		HTML += "בשל כך יתכן כי תיתקל/י בבעיות בזמן הגלישה באתר.<br/>";
		HTML += "אנו ממליצים על " + upgradeBrowser_str + "</li>";
	}
	HTML += "</ul>";
	//HTML += "<input type='checkbox' id='systemmessage_cookie' value='1'> אל תציג הודעה זו שנית<br/><br/>";
	HTML += "<span style='font-size:11px;'>המידע ניתן בגדר המלצה בלבד וכל שימוש בו יעשה<br/>באחריותו המלאה של הגולש.</span><br/>";
	HTML += "<div style='text-align:left'><input type='button' value='סגור' name='btn_close' onclick='popout_minRequirementsAlert();'> </div>";

	// calculate inner width and height for background div
	/*
	if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
		  winW = window.innerWidth-16;
		  winH = window.innerHeight-16;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
		  winW = document.body.clientWidth-2;
		  winH = document.body.clientHeight+18;
		 }
		}

		if (winH<570)
		{
			winH = 570;
		}
	


	 // create semi-transparent background
	 var BGContainer  = document.createElement('div');
	 BGContainer.id = 'systemMessage_BG';
	 BGContainer.style.position = 'absolute';
	 BGContainer.style.zIndex = '100';     
	 BGContainer.style.top = '1';
	 BGContainer.style.left = '1';
	 BGContainer.style.height = winH;
	 BGContainer.style.width = winW;     
	 BGContainer.style.backgroundColor = 'FFFFFF';  
	 BGContainer.style.filter =  'alpha(opacity=40);';  	 
	 BGContainer.style.opacity=0.4;

	 
	 document.body.appendChild(BGContainer);
	*/


	// create main container box
	 var mainContainer  = document.createElement('div');
	 mainContainer.id = 'systemMessage';
	 mainContainer.style.position = 'absolute';
	 mainContainer.style.zIndex = '2';     
	 //mainContainer.style.top = (winH / 2) - (168 / 2);
	 //mainContainer.style.left = (winW / 2) - (291 / 2);
	 mainContainer.style.top = '-200px';
	 mainContainer.style.right = '1px';
	 mainContainer.style.width = '320px';   
	 mainContainer.style.backgroundColor='#FF6262';
	 mainContainer.style.border = '1px solid black';
	 mainContainer.style.direction = 'rtl';
	 mainContainer.style.textAlign = 'right';
	 mainContainer.style.padding = '5px';
	 mainContainer.style.color = 'white';
	 mainContainer.style.display = 'none';
	 mainContainer.innerHTML = HTML;


	 document.body.appendChild(mainContainer);
	 //mainContainer.focus();

	 // animate
	 $("#systemMessage").animate( { top: "1px"}, { queue: false, duration: 2000 } )
	  				    .fadeIn (2000);

}



function popout_minRequirementsAlert()
{
    // animate
    $("#systemMessage").animate( { top: "-200px"}, { queue: false, duration: 2000 })
  					   .fadeOut (2000);

}


// cookie functions

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(NameOfCookie)
{


if (document.cookie.length > 0) 
{ 
	begin = document.cookie.indexOf(NameOfCookie+"="); 
	
	if (begin != -1) // Note: != means "is not equal to"
	{ 
	begin += NameOfCookie.length+1; 
	end = document.cookie.indexOf(";", begin);
	if (end == -1) end = document.cookie.length;

	return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}


function eraseCookie(name) {
	createCookie(name,"",-1);
}


// guid-like generator
function S4() {
   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function guid() {
   return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}

