checkURL();
window.onload = function(){checkJPG(); checkVideo();}


function checkURL()
{
	if (checkPocketIE() || isIE6 || !screenHReady)	return;
	
	var url = location.href;
	var array = url.split('/');
	array.shift();
	array.shift();
	array.shift();
	array.shift();
	array[array.length-1] = array[array.length-1].replace('.html', '');
	var path = array.join('/');
	
	location.replace('/#/' + path);
}

function checkJPG()
{
	if (!d.getElementById('photos'))	return;
	var photos = d.getElementById('photos').getElementsByTagName('img');
	
	for (var i=0; i<photos.length; i++)
	{
		if (!photos[i].alt)	continue;
		photos[i].src = photos[i].src.replace('.jpg', 'b.jpg');
	}
}

function checkVideo()
{
	if (!d.getElementById('photos'))	return;
	var photos = d.getElementById('photos');
	
	if (checkPocketIE())
	{
		var user_agent = navigator.userAgent.toString();
		if (user_agent.indexOf('iPod') < 0)	return;
		if (photos.getElementsByTagName('source').length == 0)	return;
		var source = photos.getElementsByTagName('source')[0];
		source.src = source.src.toString().replace('.mp4', '_ipod.mp4');
	}
	
	var objects = photos.getElementsByTagName('object');
	for (var i=0; i<objects.length; i++)
	{
		objects[i].height = 433;
	}
}


