// Browser Detection
var V = navigator.appVersion.substring(0,1);
var brsr = 0;
if (V < 4) {
	top.alert("This site uses java to support its major navigation.\n You may have trouble viewing the site");
} else if (navigator.appName.indexOf("Netscape") > -1) {

} else if (navigator.appName.indexOf("Explorer") > -1) {
		var T = navigator.appVersion.indexOf("MSIE");
		T += 5;
		V = navigator.appVersion.substring(T,eval(T+1));
}
if (navigator.appName.indexOf("Netscape") > -1) {
	brsr = 1;
} else if (navigator.appName.indexOf("Explorer") > -1) {
	if (V < 5) {

	} else {
		brsr = 2;
	}
}

function openReserveOnline()
{
	if (StudioID != 0)
	{
		//openMOB('http://clients.mindbodyonline.com/ws.asp?studioid=' + StudioID + ' &stype=-2');
		popupSchedule('reserve');
	}
	else
	{
		document.body.scrollTop = 0;
		document.documentElement.scrollTop = 0;
		document.getElementById('fadeDiv').style.visibility = 'visible';
		document.getElementById('fadeFrame').src = '/interstitial/';
	}
}

function closeReserveOnline()
{
	document.getElementById('fadeDiv').style.visibility = 'hidden';
}

function openMOB(which,type)
{
	StudioID = which;
	document.getElementById('fadeDiv').style.visibility = 'hidden';
	popupSchedule(type);
}


function openMOB2(which)
{
	document.getElementById('fadeDiv').style.visibility = 'hidden';
	mobWin = window.open(which,'_blank');
}

function openMOBshop(which)
{
	mobWin = window.open(which,'mobWin');
	document.getElementById('fadeDiv').style.visibility = 'hidden';
	mobWin.focus();
}

function popupSchedule(type)
{
	if (StudioID == 0)
	{
		document.body.scrollTop = 0;
		document.documentElement.scrollTop = 0;
		document.getElementById('fadeDiv').style.visibility = 'visible';

		//if (type == 'shop') {document.getElementById('fadeFrame').src = '/interstitialshop/';}
		//else if (type == 'zencertificates') {document.getElementById('fadeFrame').src = '/interstitialshop/?stype=42';}
		//else {document.getElementById('fadeFrame').src = '/interstitial/index.asp?' + type;}

		if (type == 'shop') {stype = -3;}
		else if (type == 'zencertificates') {stype = 42;}
		else {stype = -16;}

		document.getElementById('fadeFrame').src = '/interstitial/index.asp?stype=' + stype;
	}
	else if (StudioID == 4690)
	{
		launchWS('https://clients.mindbodyonline.com/ws.asp?studio=YogaKulaWien&sType=1');
	}
	else if (StudioID == 3360)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3360&stype=-16&sTG=52');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3360&stype=-16&sTG=28');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3360&stype=-16&sTG=29');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3360&stype=-2&sTG=29');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3360&stype=-16');}
	}
	else if (StudioID == 3366)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3366&stype=-16&sTG=54');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3366&stype=-16&sTG=34');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3366&stype=-16&sTG=35');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3366&stype=-2&sTG=35');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3366&stype=-16');}
	}
	else if (StudioID == -301)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=50&sLoc=1');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=22&sLoc=1');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=23&sLoc=1');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-2&sTG=23&sLoc=1');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sLoc=1');}
	}
	else if (StudioID == -302)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=50&sLoc=2');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=22&sLoc=2');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=23&sLoc=2');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-2&sTG=23&sLoc=2');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sLoc=2');}
	}
	else if (StudioID == -303)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=50&sLoc=3');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=22&sLoc=3');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=23&sLoc=3');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-2&sTG=23&sLoc=3');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sLoc=3');}
	}
	else if (StudioID == -304)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=50&sLoc=4');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=22&sLoc=4');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sTG=23&sLoc=4');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-2&sTG=23&sLoc=4');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=-30&stype=-16&sLoc=4');}
	}
	else if (StudioID == 3361)
	{
		if (type == 'core-energy-flow') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-16&sTG=51&sLoc=1');}
		else if (type == 'core-fusion') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-16&sTG=32&sLoc=1');}
		else if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-16&sTG=33&sLoc=1');}
		else if (type == 'workshops-events') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-8&sLoc=1');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-2&sLoc=1');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-16&sLoc=1');}
	}
	else if (StudioID == 3362)
	{
		if (type == 'yoga') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-17&sTG=27&sLoc=3');}
		else if (type == 'workshops-events') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-8&sLoc=3');}
		else if (type == 'teacher-trainings') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-14&sLoc=3');}
		else if (type == 'reserve') {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-2&sLoc=3');}
		else {launchWS('http://clients.mindbodyonline.com/ws.asp?studioid=3361&stype=-17&sTG=27&sLoc=3');}
	}
}

function gotoSchedule(type,loc)
{
	StudioID = loc;
	popupSchedule(type);
}

function launchWS(winName) {

	//window height and width
	myHeight = screen.height*.80;
	myWidth = screen.width*.80;
	
	//widow height bounds
	if ( myHeight < 556 ) {
		myHeight = 556;
	} else if (myHeight>700) {
		myHeight = 700;
	}
	
	//get screen size, and cacl center screen positioning
	var height = screen.height;
	var width = screen.width;
	var leftpos = width / 2 - myWidth / 2;
	var toppos = (height / 2 - myHeight / 2) - 40; 

   //open window	
   msgWindow=window.open(winName,"ws_window","toolbar=no,location=no,directories=no,resizable=yes,menubar=no,scrollbars=no,status=yes,width=" + myWidth + ",height="+ myHeight + ", left=" + leftpos + ",top=" + toppos);  

   //focus window
   setTimeout('msgWindow.focus()',1);
}
