// JavaScript Document
	var req;
	var myinner;
	
	function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
	}

	function checkLogin(){
		var ran_unrounded=Math.random()*50000;
		var ran_number=Math.floor(ran_unrounded);
		url  =  '/REGISTER/LOGIN_CONTROL/index.htm?' + ran_number;
		loadXMLDoc(url);
	} 


	function loadXMLDoc(url) 
	{
	//	alert("loadXMLDoc");
		// branch for native XMLHttpRequest object
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send(null);    
		} else if (window.ActiveXObject) {// branch for IE/Windows ActiveX version
			try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}catch(e ){
					req = new ActiveXObject("Microsoft.XMLHTTP");
					}
			if (req) {
				req.onreadystatechange = processReqChange;
				req.open("GET", url, true);
				req.send();
				}
		}
	}
	
	function processReqChange() 
	{
			// only if req shows "complete"
		if (req.readyState == 4) {
			
			// only if "OK"
			if (req.status == 200) {
				// ...processing statements go here...
				var items = req.responseXML.getElementsByTagName("sonuc");			
				myinner="";
				for (var i = 0; i < items.length; i++) {
				
					loginInfo   = getElementTextNS("", "loginInfo", items[i], 0);			
					loginUser	= getElementTextNS("", "loginUser", items[i], 0);
				    
					if(trim(loginInfo)=="ok"){

						myinner = "<img src='/stellent/fragments/gp_assets/images/icon_uyegirisi.gif'" + "alt=" + "&Uuml;yelik Bilgileri" + "width='16' height='14' hspace='5' vspace='0' border='0' align='absmiddle'" + "/><a href=" + "/REGISTER/UPDATE_USER_PROFILE/index.htm?"+ (new Date()).getTime() + " ><span class='araclar'>&Uuml;yelik Bilgileri</span></a>";
						
						myinner+="<img src='/stellent/fragments/gp_assets/images/spacer.gif'" + " width='140' height='1' /></br>";
						
						myinner+="<img src='/stellent/fragments/gp_assets/images/line2.gif'" + " width='140' height='1' /></br>";
						
						myinner+="<img src='/stellent/fragments/gp_assets/images/spacer.gif'" + " width='140' height='1' /></br>";
		
						myinner+="<img src='/stellent/fragments/gp_assets/images/icon_uyegirisi.gif'" + " alt=" + "&Ccedil;&#305;k&#305;&#351;" + "width='16' height='14' hspace='5' vspace='0' border='0' align='absmiddle'" + "/><a href='/REGISTER/LOGOUT/index.htm'><span class='araclar'>&Ccedil;&#305;k&#305;&#351;</span></a>";
					}else{

					  	myinner+="<img src='/stellent/fragments/gp_assets/images/icon_uyegirisi.gif'" + "alt=" + "&Uuml;ye Giri&#351;i" + " width='16' height='14' hspace='5' vspace='0' border='0' align='absmiddle'" + "/><a href='/REGISTER/LOGIN/index.htm'><span class='araclar'>&Uuml;ye Giri&#351;i</span></a>";

      					myinner+="<img src='/stellent/fragments/gp_assets/images/spacer.gif'" + " width='140' height='1' /></br>";
						
						myinner+="<img src='/stellent/fragments/gp_assets/images/line2.gif'" + " width='140' height='1' /></br>";
						
						myinner+="<img src='/stellent/fragments/gp_assets/images/spacer.gif'" + " width='140' height='1' /></br>";
		
						myinner+="<img src='/stellent/fragments/gp_assets/images/icon_uyeol.gif'" + " alt=" + "&Uuml;ye Giri&#351;i" + "width='16' height='14' hspace='5' vspace='0' border='0' align='absmiddle'" + "/><a href='/REGISTER/index.htm'" + "><span class='araclar'>&Uuml;ye Ol</span></a>";
					}	
				}
	
				dtl  = document.getElementById('loginDiv');
				dtl.innerHTML = myinner;
				dtl.style.visibility='';
				
			} else {
				//alert("There was a problem retrieving the XML data:\n" + req.statusText);
			}
		}
	}
	
	// retrieve text of an XML document element, including elements using namespaces
	function getElementTextNS(prefix, local, parentElem, index) {
		var result = "";
		if (prefix) {
			// IE/Windows way of handling namespaces
			result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
		} else {
			// the namespace versions of this method (getElementsByTagNameNS()) operate differently in Safari and Mozilla, but both
			// return value with just local name, provided  there aren't conflicts with non-namespace element names
			//alert(local+','+index+','+parentElem.getElementsByTagName(local)[index]);	
			result = parentElem.getElementsByTagName(local)[index];
		}
		if (result) {
			// get text, accounting for possible whitespace (carriage return) text nodes 
			if (result.childNodes.length > 1) {
				return result.childNodes[1].nodeValue;
			} else {
				return result.firstChild.nodeValue;    		
			}
		} else {
			return "";
		}
	}
		