// JavaScript Document
var urlPrefix = "http://static.livestream.com";
	
	
	
	
		function createPlayer()
		{
						var so = new SWFObject(urlPrefix + "/grid/LSPlayer.swf?v=0803", "twitcamPlayer", "500", "375", "9.0.98", "#ffffff");
                        so.addParam('allowfullscreen','true');
                        so.addParam('allowscriptaccess','always');
						so.addVariable("id", "twitcamPlayer");
						so.addVariable("wmode", "opaque");
                        so.addVariable("classid", "D27CDB6E-AE6D-11cf-96B8-444553540000");
                        so.addVariable("hash", "3q12c");
                        so.write('channel-player-box');
                        var flashContent = $('#channel-player-box').html().trim();
                        if(flashContent == ""){
                                $("#channel-player-box").html('<a href="http://www.adobe.com/products/flashplayer/" class="no_flash twitcam-player" title="Click Here To Install Flash"></a>');
                        }
						var player = document.getElementById("twitcamPlayer");
		}
if(Browser == undefined){
	var Browser = {
		isIE: function(){ return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
	}
}

var Flash = function(movie, id, width, height, initParams){

	this.html = "";
	this.attributes = this.params = this.variables = null;
	
	this.variables = new Array();
	this.attributes = {
		"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
		"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0",
		"type": "application/x-shockwave-flash"
	}
	this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer_br" };
	
	if(movie) {
		this.addAttribute("data", movie);
		this.addParameter("movie", movie);
	}
	
	if(id && id != null) this.addAttribute("id", id);
	if(width) this.addAttribute("width", width);
	if(height) this.addAttribute("height", height);
	
	if(initParams != undefined){
		for(var i in initParams){
			this.addParameter(i.toString(), initParams[i]);
		}
	}
	
}
Flash.version = "1.2b";
Flash.getObjectByExceptions = function(obj, excep){
	var tempObj = {};
	for(var i in obj){
		var inclui = true;
		for(var j=0; j<excep.length; j++)
			if(excep[j] == i.toString()) { inclui = false; break; };
		if(inclui) tempObj[i] = obj[i];
	}
	return tempObj;
}
Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; }
Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; }
Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); }
Flash.prototype.getFlashVars = function(){
	var tempString = new Array();
	
	for(var i=0; i<this.variables.length; i++)
		tempString.push(this.variables[i].join("="));
		
	return tempString.join("&");
}
Flash.prototype.toString = function(){
	
	this.params.flashVars = this.getFlashVars();
	if(Browser.isIE()){
		//IE
		this.html = "<ob" + "ject";
		var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect>";
	} else {
		//non-IE
		this.html = "<!--[if !IE]> <--> <obj" + "ect";
		var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect> <!--> <![endif]-->";
	}

	return this.html;
	
}
function criarVideo(){
	var so = new SWFObject("http://www.querosairdecasa.com/aovivo/LivestreamPlayer.swf", "livestreamPlayer" , 500, 375, ((navigator.platform.toLowerCase().indexOf("linux") != -1) ? "9.0.31.0" : "9.0.45.0"), "#fffff");
            
            
                    so.addVariable("allowChat", "false")
                    //so.addVariable("channel", "_yhn");
					so.addVariable("channel", "juniorandrade");
                    so.addVariable("id", "player");
                    so.addVariable("_devKey", "iKaSJ-WL-FKAhfGZkgCXETbC0pzEEXRyiqTnckvClgFMF9aqPhF6bnrSWLT803pYat130TWweZzVHsqcd7RFRAmk3N8glnMkZRa-CJJx8hLVre_KOF6FTMN4g7MhE029ufEoK60lyjko2rYUZjG0yA");
					so.addVariable("volumeOverlayEnabled", "true");
                    so.addVariable("hideInfo", "true");
                    so.addVariable("autoPlay", "true");
                    so.addVariable("showMoreVideos", "false");
                    so.addParam("allowScriptAccess", "always");
                    so.addParam("allowFullScreen", "false");
                    so.addParam("wmode", "opaque");
                    so.write("channel-player-box");
                    var flashContent = document.getElementById("channel-player-box").innerHTML + "";
                    // Show install flash only for non ipad request
                    if(flashContent == "" && mbd.uagent.search("ipad") == -1)
                    {
                            document.getElementById("channel-player-box").innerHTML = '<a href="http://www.adobe.com/products/flashplayer/" class="no_flash player" title="Click Here To Install Flash"></a>';
                    }
}
Flash.prototype.write = Flash.prototype.outIn = Flash.prototype.writeIn = function(w){
	if(typeof w == "string" && document.getElementById) var w = document.getElementById(w);
	if( w != undefined && w ) w.innerHTML = this.toString();
	else { document.write( this.toString() );/* alert(this.toString());*/ }
}

