// JavaScript Document

function setup()
{
	$.dynaCloud.auto = false;
	
	if(navigator.userAgent.indexOf("WebKit") == -1)
	{
		getElementByClass("face back", "main").style.visibility = "hidden";
		getElementByClass("face front","main").style.visibility = "visible";
	}
}

function toggleProfile()
{
	if(navigator.userAgent.indexOf("WebKit") != -1)
	{
		if(getElementByClassAndRoot("content", "profile").style.webkitTransform == "")
		{
			getElementByClassAndRoot("content", "profile").style.webkitTransform = "rotateY(180deg)";
		}
		else
		{
			getElementByClassAndRoot("content", "profile").style.webkitTransform = "";
		}
	}
}

function toggleLanguage()
{
	
	if(navigator.userAgent.indexOf("WebKit") != -1)
	{
		if(getElementByClassAndRoot("content", "main").style.webkitTransform == "")
		{
			getElementByClassAndRoot("content", "main").style.webkitTransform = "rotateY(180deg)";
			
		}else
		{
			getElementByClassAndRoot("content", "main").style.webkitTransform = "";
		}
	}else
	{
		if(getElementByClass("face back").style.visibility == "visible")
		{
			getElementByClass("face back").style.visibility = "hidden";
			getElementByClass("face front").style.visibility = "visible";
		}
		else
		{
			getElementByClass("face back").style.visibility = "visible";
			getElementByClass("face front").style.visibility = "hidden";
		}
	}
}



/* getElementByClass
/**********************/
var allHTMLTags = new Array();

function getElementByClassAndRoot(theClass, theDivId) {
	//Create Array of All HTML Tags
	var div	= document.getElementById(theDivId);
	var allHTMLTags=div.getElementsByTagName("*");
	//Loop through all tags using a for loop
	for (i=0; i<allHTMLTags.length; i++) {
	//Get all tags with the specified class name.
		if (allHTMLTags[i].className==theClass) {
			return allHTMLTags[i];
		}
	}
}
