function changePageBackground(fileName){
	newImage = "url(../wp-content/themes/manwithavan/_/img/"+fileName+")";
	document.getElementById('contentBox').style.backgroundImage = newImage;
}
function openTermsPopup(){
	openLightbox('./termsandconditions/','310','60','no');
}
function openContactPopup(){
	openLightbox('./contacttheman/','773','355','no');
}
function openNewsPage()
{
	if(self.location.hash == "#/termsandconditions") {
		openTermsPopup();
	}
	if(self.location.hash == "#/termsandconditions/") {
		openTermsPopup();
	}
	if(location.search) {
		var objURL = new Object();
		window.location.search.replace(
			new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
			function( $0, $1, $2, $3 ){
				objURL[ $1 ] = $3;
			}
		);
		for (var strKey in objURL){
			if (strKey == "newsItem") {
				top.news_iframe.location = "./news/"+objURL[ strKey ];
			} else if (strKey == "termsandconditions") {
				openTermsPopup();
				top.news_iframe.location = "./category/news/";
			} else if (strKey == "contacttheman") {
				openContactPopup();
				top.news_iframe.location = "./category/news/";
			}
		}
	} else {
		top.news_iframe.location = "./category/news/";
	}
}



function updateOrientation()
{
	if (navigator.userAgent.match(/iPad/i)) {
		var orientation=window.orientation;
		//alert("orientation is "+orientation);
		if (orientation == 0)	{
			document.getElementById('ipad_portrait').setAttribute("class","iPadPortrait");
			document.getElementById('ipad_landscape').style.display = "none";
			//alert("ipad portrait");
		} else if (orientation == 180) {
			document.getElementById('ipad_portrait').setAttribute("class","iPadPortrait");
			document.getElementById('ipad_landscape').style.display = "none";
			//alert("ipad portrait");
		} else if (orientation == 90) {
			document.getElementById('ipad_landscape').setAttribute("class","iPadLandscape");
			document.getElementById('ipad_landscape').style.display = "block";
			//alert("ipad landscape");
		} else {
			document.getElementById('ipad_landscape').setAttribute("class","iPadLandscape");
			document.getElementById('ipad_landscape').style.display = "block";
			//alert("ipad landscape");
		}
	}
}
window.onorientationchange=updateOrientation;

