function iehacks()
{
	var galleryHolder=document.getElementById('galleryHolder');
		
	if(navigator.appVersion.search("MSIE 6.0") > 1)
	{
		galleryHolder.style.width='90%';
		galleryHolder.style.height='90%';
		galleryHolder.style.position='absolute';
		galleryHolder.style.left='200px';
		galleryHolder.style.top='60px';
	}
	else
	{
		galleryHolder.style.width='100%';
		galleryHolder.style.height='100%';
	}
	
	var url=readCookie('url');
	
	if(url)
	{
		var checkStr=String(window.location);
		if(checkStr.search("login") > 1)
		{
			var tableHolder=document.getElementById('headerHolder');
			var table=document.getElementById('table');
			table.style.width=screen.width - 50 + "px";
			var tableContent=tableHolder.innerHTML;
			
			if(navigator.appVersion.search("MSIE") > 1)
				tableContentArray=tableContent.split("</TR>");
			else
				tableContentArray=tableContent.split("</tr>");
			tableHolder.innerHTML=tableContentArray[0]+"<td align='right'><a href='javascript:endSession();'>Logout</a></td></tr>"+tableContentArray[1];
		}
	}
}

function loadTour(type)
{
	var tourHolder=document.getElementById('tourHolder');
	if(type.id=='live')
	{
		tourHolder.innerHTML="<iframe id='tour' src='tours/live_theatre/index.html' width='900px' height='463px' frameborder=0></iframe>";
	}
	else if(type.id=='dockleaf')
	{
		tourHolder.innerHTML="<iframe id='tour' src='tours/dockleaf/index.html' width='900px' height='463px' frameborder=0></iframe>";
	}
	else
	{
		tourHolder.innerHTML="<div class='shell'>"+
			"<div id='vr_canvas'>"+
			"</div>"+
			"<div id='map_canvas'></div>"+
			"<div class='leftArrow'><a onClick='scrollBack(this)'><img src='tours/maps/left.jpg' border='0'></a></div>"+
			"<div id='film_strip'>"+
				"<table cellspacing='3' align='top'>"+
					"<tr>"+
						"<td onClick=selectCell(document.getElementById('1'))><img class='firstBlock' id='1' src='tours/maps//thumbs/1.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('2'))><img class='subsequentBlocks' id='2' src='tours/maps//thumbs/2.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('3'))><img class='subsequentBlocks' id='3' src='tours/maps//thumbs/3.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('4'))><img class='subsequentBlocks' id='4' src='tours/maps//thumbs/4.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('5'))><img class='subsequentBlocks' id='5' src='tours/maps//thumbs/5.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('6'))><img class='subsequentBlocks' id='6' src='tours/maps//thumbs/6.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('7'))><img class='subsequentBlocks' id='7' src='tours/maps//thumbs/7.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('8'))><img class='subsequentBlocks' id='8' src='tours/maps//thumbs/8.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('9'))><img class='subsequentBlocks' id='9' src='tours/maps//thumbs/9.jpg' ></td>"+
						"<td onClick=selectCell(document.getElementById('10')><img class='subsequentBlocks' id='10'src='tours/maps//thumbs/10.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('11'))><img class='subsequentBlocks' id='11' src='tours/maps//thumbs/11.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('12'))><img class='subsequentBlocks' id='12' src='tours/maps//thumbs/12.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('13'))><img class='subsequentBlocks' id='13' src='tours/maps//thumbs/13.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('14'))><img class='subsequentBlocks' id='14' src='tours/maps//thumbs/14.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('15'))><img class='subsequentBlocks' id='15' src='tours/maps//thumbs/15.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('16'))><img class='subsequentBlocks' id='16' src='tours/maps//thumbs/16.jpg'></td>"+
						"<td onClick=selectCell(document.getElementById('17'))><img class='subsequentBlocks' id='17' src='tours/maps//thumbs/17.jpg'></td>"+
					"</tr>"+
				"</table>"+
			"</div>"+
			"<div id='rightArrow' class='rightArrow'><a onClick='scrollForward(this)'><img src='tours/maps/right.jpg' border='0'></a></div>"+
		"</div>";
		startScript();
	}
}

function validate()
{
	var loginForm=document.login;
	
	if(loginForm.user.value=='')
	{
		alert('Please enter Username.');
		return false;
	}
	else if(loginForm.passwd.value=='')
	{
		alert('Please enter Password.');
		return false;
	}
	else if(!loginForm.terms.checked)
	{
		alert('Please agree the terms and conditions before proceeding.');
		return false;
	}
	
	var tableHolder=parent.document.getElementById('headerHolder');
	var table=parent.document.getElementById('table');
	table.style.width=screen.width - 50 + "px";
	var tableContent=tableHolder.innerHTML;
	
	if(navigator.appVersion.search("MSIE") > 1)
		tableContentArray=tableContent.split("</TR>");
	else
		tableContentArray=tableContent.split("</tr>");
	tableHolder.innerHTML=tableContentArray[0]+"<td align='right'><a href='javascript:endSession();'>Logout</a></td></tr>"+tableContentArray[1];
	loginForm.action='login_action.php'
	return true;
}

function test()
{
	var tableHolder=parent.document.getElementById('headerHolder');
	var table=parent.document.getElementById('table');
	table.style.width=screen.width - 50 + "px";
	var tableContent=tableHolder.innerHTML;
	
	if(navigator.appVersion.search("MSIE") > 1)
		tableContentArray=tableContent.split("<TD align=right>");
	else
		tableContentArray=tableContent.split("<td align=\"right\">");
	tableHolder.innerHTML=tableContentArray[0]+"</tr>";
}

function endSession()
{
	eraseCookie('url');
	eraseCookie('company');
	window.location='login.html'
	var loginPage=document.getElementById('loginPage');
	loginPage.src='login_form.html'
}

function createCookie(name,value,days) 
{
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) 
{
	createCookie(name,"",-1);
}



