var ua = navigator.userAgent.toLowerCase();
if(ua.indexOf( "opera" ) != -1 )
	{
		browserName = "op";
	}
else if(ua.indexOf( "msie" ) != -1 )
	{
		browserName = "ie";
	}
else if(ua.indexOf( "safari" ) != -1 )
	{
		browserName = "sa";
	}
else if(ua.indexOf( "mozilla" ) != -1 )
	{
	if( ua.indexOf( "firefox" ) != -1 )
		{
		browserName = "ff";
		}
	else
		{
			browserName = "mo";
		} 
	}
function testRequired(formName)
	{
		allInputs = document.forms[formName].getElementsByTagName("INPUT");
		for(i=0; i <allInputs.length; i++)
			{
				if(allInputs[i].type=="text" && 
					allInputs[i].getAttribute("doo_requiredField") && 
					allInputs[i].getAttribute("doo_requiredField")=="1" &&
					(allInputs[i].value=="" || allInputs[i].value==null))
						{
							allInputs[i].focus();
							alert("Please fill in the required fields.");
							return false;
						}
			}
	}
function checkSizeCommentArea(objTextArea, objCounter, numberOfChars)
	{
		if(typeof objCounter == "string")
			objCounter = document.getElementById(objCounter);
		val = objTextArea.value;
		if(objTextArea.value.length>numberOfChars)
			objTextArea.value = val.substring(0, numberOfChars);
		objCounter.innerHTML = objTextArea.value.length;
	}
function markOption(optionId, optionValue)
	{
		inputObj = document.getElementById(optionId);
		if(inputObj.type=="checkbox")
			inputObj.checked = optionValue;
		if(inputObj.type=="text")
			{
				inputObj.value = optionValue;
			}
	}
var setOfPics = new Array();
setOfPics['darwin'] = new Array();
setOfPics['darwin'][0] = "img/whats_new/darwin_diary/001.png";
setOfPics['darwin'][1] = "img/whats_new/darwin_diary/002.png";
setOfPics['darwin'][2] = "img/whats_new/darwin_diary/003.png";
setOfPics['darwin'][3] = "img/whats_new/darwin_diary/004.png";
function goToPicture(direction)
	{
		var showingImage = document.getElementById("whatsNewShowingPicture");
		var picUrl = window.location.href.split("/");
		picUrl = window.location.href.replace(picUrl[picUrl.length-1], "");
		for(i=0; i<setOfPics['darwin'].length; i++)
			{
				if((picUrl + setOfPics['darwin'][i]) == showingImage.src)
					{
						try
							{
								if(i+(direction)<0)
									{
										nextPosition = setOfPics['darwin'].length-1;
										showingImage.src = setOfPics['darwin'][nextPosition];
									}
								else
									{
										if(i+(direction) >= (setOfPics['darwin'].length))
											{
												showingImage.src = setOfPics['darwin'][0];
											}
										else
											showingImage.src = setOfPics['darwin'][i+(direction)];
									}
							}
						catch(e)
							{
								if(direction < 0)
									{
										nextPosition = setOfPics['darwin'].length-1;
										showingImage.src = setOfPics['darwin'][nextPosition];
									}
								else
									{
										showingImage.src = setOfPics['darwin'][0];
									}
							}
						i+=setOfPics['darwin'].length;
					}
			}
	}