﻿function TC_pageLoaded(sender, args)
{
	var dataItems = args.get_dataItems();
	
	switch(dataItems['tc_cmd'])
	{
		case "confirm":
			if(confirm(dataItems['tc_msg'])) document.location.href = dataItems['tc_url'];
			break;
			
		case "share":
			TC_newPopup(dataItems['tc_url'], 500, 550, 'TCShare');
			break;
			
		case "rate":
			TC_newPopup(dataItems['tc_url'], 250, 250, 'TCRate');
			break;
			
		case "report":
			TC_newPopup(dataItems['tc_url'], 500, 500, 'TCReport');
			break;
		
		case "help":
			TC_newPopup(dataItems['tc_url'], 400, 500, 'TCHelp');
			break;
	}
}
function TC_flashCheck()
{    
  var version;
  
	try { version = deconcept.SWFObjectUtil.getPlayerVersion(); }
	catch (e) {};
	
  if (version && version['major'] <= 0) 
  { 
		if(confirm('This page requires Adobe Flash Player 9 or greater\r\n\r\nWould you like to install flash player now?\r\n'))
			document.location.href = "http://www.adobe.com/go/getflashplayer";   
  }
}

function TC_newPopup(url, w, h, windowName, features, center)
{
	if(features == null || features == "")
		features = "resizable,scrollbars=0,status=0,toolbar=0";
		
	if(windowName == null || windowName == "")
		windowName = "TCChild";	
		
	TC_newWindow(url, windowName, w, h, features, center);
} 

function TC_newWindow(windowUrl, windowName, w, h, features, center) 
{
	var newWindow = null;

	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	
	if(center)
	{
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;
	
		settings += 'top=' + wint + ',';
		settings += 'left=' + winl + ',';
	}
	
	settings += features;
	newWindow = window.open(windowUrl, windowName, settings);
	try{ newWindow.focus(); } catch(e) {}
}

function TC_scrollTop(delay)
{
	var defaultDelay = 250;
	
	if(!delay)
		delay = defaultDelay;
	
	try { setTimeout('window.scrollTo(0,0);', delay); } catch(e) {} 
}

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
