﻿
function Initialize()
{
	try	{req = new ActiveXObject("Msxml2.XMLHTTP");}
	catch(e)
	{
		try	{req = new ActiveXObject("Microsoft.XMLHTTP");}
		catch(oc) {req = null;}
	}
	if(!req && typeof XMLHttpRequest!="undefined")
	{
		req = new XMLHttpRequest();
	}
} 
//------------------------------------------------------------
function Process()
{
	if (req.readyState == 4)
	{
		if (req.status == 200)
		{
		    var sResults = req.responseText
			if(sResults == "false")
			{
			    document.getElementById("errMsgDiv").innerHTML = "שם משתמש/סיסמה שגויים!";
			    document.getElementById("errMsgDiv").style.color = "red";						    
			}
			else
			{
			    document.getElementById("errMsgDiv").innerHTML = "זוהית בהצלחה. <a target='_blank' href='http://www.gto.co.il/client/globestradeone.exe'>לחץ כאן להורדת התוכנה</a>";
			    document.getElementById("errMsgDiv").style.color = "#0fff19";			    
			}
		}
		else
		{ 
			alert("req.status= " + req.status)
		}
	}	
}
//------------------------------------------------------------
function SendQuery()
{
    Initialize();	
    var username = document.getElementById("username_GTO_mishtamesh").value
	var password = document.getElementById("password_GTO_mishtamesh").value
	var url = "login.aspx?username="+username+"&password="+password
	try
	{
		req.onreadystatechange = Process
		req.open("GET", url, true);
		req.send(null);
	}
	catch(err) {}
}
//------------------------------------------------------------
function HeaderInputs()
	{
	var UsernamePassword_Obj="";
	UsernamePassword_Obj+='<div style="width:961px; height:132px; background-image:url(images/bgimages_01.png); background-repeat:no-repeat;">';
	UsernamePassword_Obj+='<div style="float:right; height:116px; width:470px; padding-top:10px; color:#FFFFFF; font-family:Arial; font-size:12px; font-weight:bold;">';
	UsernamePassword_Obj+='<div style=" padding:20px 50px 0px 0px; text-align:right; direction:rtl"><div style="float:right; padding-left:50px;"> כניסה למערכת </div> <div style="color:red;" id="errMsgDiv">&nbsp;</div> </div>';
	UsernamePassword_Obj+='<div style=" padding:10px 50px 0px 0px; text-align:right; direction:rtl; float:right; color:#7e98ab">';
	UsernamePassword_Obj+='שם משתמש:';
	UsernamePassword_Obj+='<br/>';
	UsernamePassword_Obj+='<input type="text" tabindex="1" value="" id="username_GTO_mishtamesh" name="username_GTO_mishtamesh" style="border:1px solid #7e98ab; background-color:#000000; width:130px; height:20px; color:#FFFFFF;" />';
	UsernamePassword_Obj+='</div>';
	UsernamePassword_Obj+='<div style=" padding:10px 30px 0px 0px; text-align:right; direction:rtl; float:right; color:#7e98ab;">';
	UsernamePassword_Obj+='סיסמא: <span><a tabindex="4" href="forgetPassword.html" style="margin:0px 28px 0px 28px;">שכחתי סיסמא</a></span>';
	UsernamePassword_Obj+='<br/>';
	UsernamePassword_Obj+='<input type="password"  tabindex="2" value="" id="password_GTO_mishtamesh" name="password_GTO_mishtamesh" style="border:1px solid #7e98ab; background-color:#000000; width:130px; height:20px; color:#FFFFFF;" />';
	UsernamePassword_Obj+='</div>';
	UsernamePassword_Obj+='<div style="float:right; padding:25px 0px 0px 0px; margin:0px -20px 0px 0px;">';
	UsernamePassword_Obj+='<img tabindex="3" src="images/arraow_01.png" width="22" height="22" align="תתחבר" border="0" style="cursor:pointer;;" onclick="SendQuery()" />';
	UsernamePassword_Obj+='</div>';;
	UsernamePassword_Obj+='</div>';
	UsernamePassword_Obj+='<div style="float:right; height:116px;width:470px; padding-top:10px; padding-left:20px;"><a href="#"><img src="images/logo_GTO.png" width="468" height="116" alt="TradeOne-גלובס" border="0" /></a></div>';
	UsernamePassword_Obj+='</div>';
	return UsernamePassword_Obj;
	}
//------------------------------------------------------------	