
function ShowHideCompanyDetails(boxID,value) 
	{
		var box = document.getElementById("companydetails"+boxID);

		if (value == "1")
			{
				box.style.display = "block";
			}//end if
			else
				{
					box.style.display = "none";
				}//end else
	}//end ShowHideCompanyDetails()
	
	
function getRadioUsersCheckedValue(oRadio) {

for(var i = 0; i < oRadio.length; i++) {

if(oRadio[i].checked) {
return oRadio[i].value;
}

}

return '';
}

function makeLoginRequest(serverPage, objID) 
	{
		var obj = document.getElementById(objID);
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() 
			{
				obj.innerHTML = '<img src="../app/img/icons/ajax-loader.gif" width="16" height="16" />';
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
					{
						obj.innerHTML = xmlhttp.responseText;
						/*Update v1.0 beta - pentru a nu aparea iconita de loading la apelare, in alte div-uri*/
						obj='';
						if (xmlhttp.responseText.indexOf("ajax-redirect-loader.gif") != -1)
							{
								referer=xmlhttp.responseText.substring((xmlhttp.responseText.indexOf("[")+1),xmlhttp.responseText.indexOf("]"));
								window.location=referer;
							}
						//aici va veni prin variabila unde sa redirecteze, toata calea, http....
						//totul citesc din alt, acolo voi scrie tot link-ul, intre []
							
					}
			}
		xmlhttp.send(null);
	}//end makeLoginRequest()
	
	
//------------------------------------------------------------------------------------------------------------------------

//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp7 = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp7 = new ActiveXObject("Msxml2.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer.");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using Internet Explorer.
xmlhttp7 = new ActiveXObject("Microsoft.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp7 = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp7 && typeof XMLHttpRequest != 'undefined') {
xmlhttp7 = new XMLHttpRequest();
//alert ("You are not using Microsoft Internet Explorer");
}	
	
function makerequestMyAccountTab(serverPage, objID, homePageUrl) 
	{
		
		var obj = document.getElementById(objID);
		xmlhttp7.open("GET", serverPage);
		xmlhttp7.onreadystatechange = function() 
			{
				if (homePageUrl != '')
					obj.innerHTML = '<img id="imageLoader" src="'+homePageUrl+'app/img/icons/ajax-loader.gif" width="16" height="16" />';
				if (xmlhttp7.readyState == 4 && xmlhttp7.status == 200) 
					{
						obj.innerHTML = xmlhttp7.responseText;
					}
			}
		xmlhttp7.send(null);
	}//end makerequestMyAccountTab()

//------------------------------------------------------------------------------------------------------------------------	
	
	
function selectMyAccountTab(selectedTab,numberOfTabs,activeClass,inactiveClass,homePageUrl)
	{
		//make the request
		makerequestMyAccountTab(homePageUrl+'app/plugins/users/show-page-type-17-tabs-request-content.php?tab='+selectedTab,'page-type-17-tabs-request-content',homePageUrl);
		
		change(selectedTab,activeClass);
		
		for (i=1; 1<=numberOfTabs; i++)
			{
				if ( ('tab'+i) != selectedTab)
					{
						change('tab'+i,inactiveClass);
					}//end if
					
			}//end for
	}//end selectMyAccountTab()

	
function showHidePageType17TabRequest(divForHide,divForShow)
	{
		var divForHide = document.getElementById(divForHide);
		var divForShow = document.getElementById(divForShow);
		
		/* If the selected box is currently invisible, show it */
		if(divForShow.style.display == "none" || divForShow.style.display == "") 
			{
				divForHide.style.display = "none";
				divForShow.style.display = "block";
				
			}//end if
			else
				{
					divForHide.style.display = "block";
					divForShow.style.display = "none";
				}//end else
	}//end showHidePageType17TabRequest()
	
	
function overMyAccountTab(selectedTab,tabClass,activeClass)
	{
		if (document.getElementById(selectedTab).className != activeClass)
			document.getElementById(selectedTab).className=tabClass;
	}//end overMyAccountTab()
	

//------------------------------------------------------------------------------------------------------------------------

//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp8 = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp8 = new ActiveXObject("Msxml2.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer.");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using Internet Explorer.
xmlhttp8 = new ActiveXObject("Microsoft.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp8 = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp8 && typeof XMLHttpRequest != 'undefined') {
xmlhttp8 = new XMLHttpRequest();
//alert ("You are not using Microsoft Internet Explorer");
}	
	
function changeMyProfileSubmit(serverPage, objID, divForHide,divForShow,tmpDiv) 
	{
		
		var obj = document.getElementById(objID);
		
		if (document.getElementById(objID).style.display == "none")
			document.getElementById(objID).style.display = "block";

		xmlhttp8.open("GET", serverPage);
		xmlhttp8.onreadystatechange = function() 
			{
				//obj.innerHTML = '<img src="'+homePageUrl+'app/img/icons/ajax-loader.gif" width="16" height="16" />';
				if (xmlhttp8.readyState == 4 && xmlhttp8.status == 200) 
					{
						
						tmp=xmlhttp8.responseText.split("||");
						
						obj.innerHTML = tmp[0];
						
						if (tmp[0] == "S-a salvat !")
							{
								setTimeout('hideDiv(\''+objID+'\')', 200);
								setTimeout('showHidePageType17TabRequest(\''+divForShow+'\',\''+divForHide+'\')', 200);
								
								
								document.getElementById(divForHide).innerHTML=tmp[1];
								
								if (tmpDiv != '')
									document.getElementById(tmpDiv).innerHTML=tmp[1];
									
							}//end if
							else
								{
									//nothing here
								}//end else
						
					}
			}
		xmlhttp8.send(null);
	}//end changeMyProfileSubmit()

//------------------------------------------------------------------------------------------------------------------------
	

function setTheSameAddress(id,deliveryaddress,deliverycountry,deliverycounty,deliverycity,deliverypostalcode,deliverydetails,address,country,county,city,postalcode)
	{
		if (document.forms[0].elements[id].checked == true)
			{
				//am activat butonul
				//scriu in toate ampurile de la delivery, tot ce aveam in campurile de la prima adresa
				document.getElementById(deliveryaddress).value=document.getElementById(address).value;
				document.getElementById(deliverycountry).value=document.getElementById(country).value;
				document.getElementById(deliverycounty).value=document.getElementById(county).value;
				document.getElementById(deliverycity).value=document.getElementById(city).value;
				document.getElementById(deliverypostalcode).value=document.getElementById(postalcode).value;
				//document.getElementById(deliverydetails).value="6";
				//dezactivez posibilitatea de scriere in campuri
				document.getElementById(deliveryaddress).disabled=true;
				document.getElementById(deliverycountry).disabled=true;
				document.getElementById(deliverycounty).disabled=true;
				document.getElementById(deliverycity).disabled=true;
				document.getElementById(deliverypostalcode).disabled=true;
				//document.getElementById(deliverydetails).disabled=true;
			}//end if
			else
				{
					//am dezactivat butonul
					//golesc continutul tututor campurilor de la delivery
					document.getElementById(deliveryaddress).value="";
					document.getElementById(deliverycountry).value="";
					document.getElementById(deliverycounty).value="";
					document.getElementById(deliverycity).value="";
					document.getElementById(deliverypostalcode).value="";
					document.getElementById(deliverydetails).value="";
					//activez din nou posibilitatea de scriere
					document.getElementById(deliveryaddress).disabled=false;
					document.getElementById(deliverycountry).disabled=false;
					document.getElementById(deliverycounty).disabled=false;
					document.getElementById(deliverycity).disabled=false;
					document.getElementById(deliverypostalcode).disabled=false;
					document.getElementById(deliverydetails).disabled=false;
				}//end else
	}//end setTheSameAddress()
	
	
function setTheSameAddressTextField(idCheckbox,idAddressTextField1,idAddressTextField2)
	{
		//verific daca am bifat optiunea de aceeasi adresa ca adresa de facurare
		if (document.forms[0].elements[idCheckbox].checked == true)
			{
				//scriu si in textfield-ul de jos acelasi lucru ce se tasteaza sus
				document.getElementById(idAddressTextField2).value=document.getElementById(idAddressTextField1).value;
			}//end if
			else
				{
					//nimic
				}//end else
	}//end setTheSameAddressTextField()
	
function changeUserBoxStatus(homePageUrl,idCheckbox,userId,boxId)
	{
		if (document.forms[0].elements[idCheckbox].checked == true)
			{
				//casuta era goala, am dat click pe ea pentru a o bifa
				//setez in baza de date casuta activa
				makerequest(homePageUrl+'app/plugins/users/change-user-box-status.php?id='+boxId+'||'+userId+'||1','loaderIcon',homePageUrl,"");
				return false;
			}//end if
			else
				{
					//casuta era bifata, am dat click pentru a o debifa
					//setez in baza de date casuta inactiva
					makerequest(homePageUrl+'app/plugins/users/change-user-box-status.php?id='+boxId+'||'+userId+'||0','loaderIcon',homePageUrl,"");
					return false;
				}//end else
	}//end changeUserBoxStatus()
	
	
	
//------------------------------------------------------------------------------------------------------------------------

//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp99 = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp99 = new ActiveXObject("Msxml2.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer.");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using Internet Explorer.
xmlhttp99 = new ActiveXObject("Microsoft.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp99 = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp99 && typeof XMLHttpRequest != 'undefined') {
xmlhttp99 = new XMLHttpRequest();
//alert ("You are not using Microsoft Internet Explorer");
}	

//function makeUserNotificationRequest(serverPage, objID, homePageUrl)
function makeUserNotificationRequest(homePageUrl,userId)
	{
		var obj = document.getElementById('notification-little-box');
		xmlhttp99.open("GET", homePageUrl+'app/plugins/users/show-user-notification-box.php?id='+userId+'||'+document.getElementById('user-notification-id').value);
		xmlhttp99.onreadystatechange = function() 
			{
				if (xmlhttp99.readyState == 4 && xmlhttp99.status == 200) 
					{
						obj.innerHTML = xmlhttp99.responseText;
						tmp=obj.innerHTML;

						if (tmp.indexOf("&nbsp;") != -1)
							{
								//alert('spatiu gol');
								//document.getElementById('notification-little-box').style.display = "none";
								document.getElementById('notification-little-box').innerHTML = '&nbsp;<input type="hidden" id="user-notification-id" value="">';
								document.getElementById('notification-little-box').style.display = "none";
							}//end if
							else
									{
										//alert('nu este spatiu gol');
										document.getElementById('notification-little-box').style.display = "block";
										//fadeOut('notification-little-box');
								}//end else
						/*Update v1.0 beta - pentru a nu aparea iconita de loading la apelare, in alte div-uri*/
						obj='';
						
					}//end if
			}//end 
		xmlhttp99.send(null);
	}//end makeUserNotificationRequest()
//------------------------------------------------------------------------------------------------------------------------