function Checkbox(FormName,VariableName,VariableValue)
{
	if ( eval('document.'+FormName+'.'+VariableName+'.value=="'+VariableValue+'"') )
	{
		eval('document.'+FormName+'.'+VariableName+'.checked="1";')
	}
}
function GetList(Name,Min,Max,Old,WithEmpty,PrivateStyle)
{
	document.write("<select name="+Name+" size=1 "+PrivateStyle+">");
	if (WithEmpty) document.write("<option value='0'> "+WithEmpty+"</option>");
	for (i=Min;i<=Max;i++)
	{
		if (i<10) {Z=0;} else {Z='';}
		if (i==Old) {Selct='selected=selected'} else {Selct='';}
		document.write("<option value="+Z+i+" "+Selct+">"+Z+i+"</option>");
	}
	document.write("</select>");
}
function RadioButton(Index,FormName,VariableName,VariableValue)
{
	for (v=0;v<Index;v++)
	{
		if ( eval('document.'+FormName+'.'+VariableName+'['+v+'].value=="'+VariableValue+'"') )
		{
			eval('document.'+FormName+'.'+VariableName+'['+v+'].checked="1";')
		}
	}
}
function FormRemoveFile(Var1,Name,Value)
{
	document.form2.Action.value = Var1;
	document.form2.FileToDelete.value = Name;
	document.form2.Remove.value = Value;
	if (confirm ("Are you sure you want to delete "+Value+"\" "))
	document.form2.submit();
}
function FormRemoveFile_User(Var1,Name,Value)
{
	document.form2.Action1.value = Var1;
	document.form2.FileToDelete.value = Name;
	document.form2.Remove.value = Value;
	if (confirm ("Are you sure you want to delete "+Value+"\" "))
	document.form2.submit();
}
function CheckAll( theElement, ClassName )
{
	var theForm = theElement.form, z = 0;
	for ( z = 0; z < theForm.length; z++ )
	{
		if ( ( theForm[z].type == "checkbox" ) && ( theForm[z].className == ClassName ) )
		{
			theForm[z].checked = theElement.checked;
		}
	}
}
function NumbersOnly(e)
{
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	//alert(key);
	if ( (key == 8) || (key == 9) || (key == 13) || (key == 46) || ((key >= 35) && (key <= 40)) || ((key >= 46) && (key <= 57)) || ((key >= 94) && (key <= 105)) )
		return true; 
	else
		return false;
}
function NumbersWithDash(e)
{
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	//alert(key);
	if ( (key == 8) || (key == 9) || (key == 13) || (key == 46) || ((key >= 35) && (key <= 40)) || ((key >= 46) && (key <= 57)) || ((key >= 94) && (key <= 105)) || (key == 109) || (key == 189) )
		return true; 
	else
		return false;
}
function NumbersWithDot(e)
{
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	//alert(key);
	if ( (key == 8) || (key == 9) || (key == 13) || (key == 46) || ((key >= 35) && (key <= 40)) || ((key >= 46) && (key <= 57)) || ((key >= 94) && (key <= 105)) || (key == 110) )
		return true; 
	else
		return false;
}
function NoSpaces(e)
{
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	//alert(key);
	if (key == 32)
		return false;
	else
		return true;
}
function Validate_Email(Field,AlertTxt)
{
	with( Field )
	{
		apos		=	value.indexOf("@");
		dotpos		=	value.lastIndexOf(".");
		varlength	=	value.length;
		if ( (apos < 1) || (dotpos - apos < 2) )
		{
			alert(AlertTxt);
			return false;
		}
		if ( varlength <= (dotpos + 1) )
		{
			alert("Please enter a suffix of domain.");
			return false;
		}
		else
		{
			return true;
		}
	}
}
function Validation_Newsletter(thisform)
{
	with( thisform )
	{
		if( Validate_Email(NewsletterEmail,"Please insert a valid email.") == false )
		{
			NewsletterEmail.focus();
			return false;
		}
		var DataString	=	'NewsletterEmail='+NewsletterEmail.value;
		//alert (DataString);
		$.ajax(
		{
			type: "POST",
			url: "newsletter.php",
			data: DataString,
			success: function(html)
			{
				mySplitResult	=	html.split('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
				Mode			=	mySplitResult[1];
				NewHash			=	'newsletter&EmailMode='+NewsletterEmail.value+'&Mode='+Mode;
				document.location.hash=NewHash;
				LoadPage('#'+NewHash);
			}
		});
		return false;
	}
}
function Validation_Contact_Us(thisform)
{
	with( thisform )
	{
		if( (FullName.value.charAt(0) == " ") || (FullName.value.charAt(1) == " ") || ((FullName.value.charAt(0) == " ") && (FullName.value.charAt(1) == " ") && (FullName.value.charAt(2) == " ")) || (FullName.value == "") || (FullName.value.length <= 2) )
		{
			alert("Please insert the contact name correctly.");
			FullName.focus();
			return false;
		}
		if( (PhoneNumber.value.charAt(0) == " ") || (PhoneNumber.value.charAt(1) == " ") || ((PhoneNumber.value.charAt(0) == " ") && (PhoneNumber.value.charAt(1) == " ") && (PhoneNumber.value.charAt(2) == " ")) || (PhoneNumber.value == "") || (PhoneNumber.value.length <= 2) )
		{
			alert("Please insert the phone number correctly.");
			PhoneNumber.focus();
			return false;
		}
		if( (MobileNumber.value.charAt(0) == " ") || (MobileNumber.value.charAt(1) == " ") || ((MobileNumber.value.charAt(0) == " ") && (MobileNumber.value.charAt(1) == " ") && (MobileNumber.value.charAt(2) == " ")) || (MobileNumber.value == "") || (MobileNumber.value.length <= 2) )
		{
			alert("Please insert the mobile number correctly.");
			MobileNumber.focus();
			return false;
		}
		if( (Country.value == "") || (Country.value == "0") )
		{
			alert("Please select the country.");
			Country.focus();
			return false;
		}
		if( Validate_Email(Email,"Please insert a valid email.") == false )
		{
			Email.focus();
			return false;
		}
		if( (Comments.value.charAt(0) == " ") || (Comments.value.charAt(1) == " ") || ((Comments.value.charAt(0) == " ") && (Comments.value.charAt(1) == " ") && (Comments.value.charAt(2) == " ")) || (Comments.value == "") || (Comments.value.length <= 2) )
		{
			alert("Please insert the comments correctly.");
			Comments.focus();
			return false;
		}
		var DataString = 'FullName='+FullName.value+'&PhoneNumber='+PhoneNumber.value+'&MobileNumber='+MobileNumber.value+'&Country='+Country.value+'&Email='+Email.value+'&Comments='+Comments.value;
		//alert (DataString);
		$.ajax(
		{
			type: "POST",
			url: "contact_us.php",
			data: DataString,
			success: function()
			{
				NewHash	=	'contact_us&Mode=1';
				document.location.hash=NewHash;
				LoadPage('#'+NewHash);
			}
		});
		return false;
	}
}
function OpenEventsDetails(id)
{
	window.open("events_details.php?NewsEventsID="+id,"logwindow",'left=100,top=70,width=700,height=600,toolbar=0,resizable=0,scrollbars=1,addressbar=0');
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var DataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (DataString) {
				if (DataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (DataString) {
		var index = DataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(DataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
dataBrowser: [
	{
		prop: window.opera,
		identity: "Opera" // note: no comma
	},
	{
		string: navigator.userAgent,
		subString: "MSIE",
		identity: "Explorer",
		versionSearch: "MSIE" // note: no comma
	} // note: no comma
];
//alert(BrowserDetect.browser);
//alert(BrowserDetect.version);
