//
/*
var status="none";
var open="";
function show(id,link,summ){
	var id_1=id+"_1";
	var t=document.getElementById(id);
	if(open!=""&&open!=id)
	{
		document.getElementById(open).style.display="none";
		document.getElementById(open+"_1").src="http://www.ibs-safeworlds.com/templates/safeworlds/layout_images/arrow.png";
		status="none";
	}
	if(status=="none")
	{
		t.style.display="block";
		status="display";
		t.innerHTML='<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;">'+summ+'</font></p><p align="middle"><object id="player" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" width="190px" height="150px"><param name="filename" value="'+link+'" /><param name="Showcontrols" value="True" /><param name="AnimationatStart" value="true"><param name="TransparentatStart" value="true"><param name="autoStart" value="True" />   <param name="fullScreen" value="False" />  <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer" src="'+link+'" autostart="1" showcontrols="1" showpositioncontrols="1" width="180px" height="150px"></embed></object></p>';
		document.getElementById(id_1).src="http://www.ibs-safeworlds.com/templates/safeworlds/layout_images/arrow_click.png";
		open=id;
	}
	else
	{
		t.style.display="none";
		status="none";
		t.innerHTML='<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;">'+summ+'</font></p>';
		document.getElementById(id_1).src="http://www.ibs-safeworlds.com/templates/safeworlds/layout_images/arrow.png";
  	}

	var main_right = document.getElementById('main_right');

	//var height = main_right.offsetHeight;
       
       var height = document.body.clientHeight;
      // document.body.clientHeight=600;

//document.body.clientHeight;
   window.parent.document.getElementById("sw_embed").style.height=height;           
alert(height);
}
*/
function showCode(){
var option=document.getElementById("option1");
option.style.display="block";
showClose();
//login();
getCode1();
}
function login(){
var content=document.getElementById("content");
content.innerHTML="<div><p align=\"middle\"><font size=2 color=\"#6666FF\"><b>Enter your user name and password to get your channel be the default channel, Or just click \"NEXT\"</b></p></font><form name=\"form2\" id=\"form2\"><p><table><tr><td>Username:</td><td><input name=\"username\"></td></tr><tr><td>Password:</td><td><input type=\"password\" name=\"pass\"></td><tr><td>&nbsp;</td><td><input type=\"button\" value=\"Set Default\"  onClick=\"nextStep()\">&nbsp;<input type=\"button\" value=\"Next\"  onClick=\"getCode1()\"></td></tr></table></div>"; 
}
function getCode(text){
var content=document.getElementById("content");
var channel=text.split("||");
if(channel.length<2||channel[0]==''||channel[1]==''){
content.innerHTML="<p align=\"middle\"><font size=2 color=\"#6666FF\"><b>Your username or password is not correct!</b></font></p>";
}else{
var param="&channel="+channel[0]+"&country="+channel[1];
var content=document.getElementById("content");
content.innerHTML="<p align=\"middle\"><font size=2 color=\"#6666FF\"><b>Please Copy The Code Below And Paste It To The Place Where You Want The NewsBar To Be Embed On Your Site</b></font></p><p align=\"middle\"><textarea id=\"embed_textarea\" style=\"width:350px;height:200px;overflow-y:scroll;\">&lt;script language='Javascript'&gt; document.write(\"<div id='loadDiv' style='padding-top: 50px; padding-left: 50px'><p style='padding-left:10px;'><img src='http://www.ibs-safeworlds.com/templates/safeworlds/layout_images/loader.gif'></p><p>Loading<span id='loading'></span></p></div>\");var setInterval1 = window.setInterval(\"document.getElementById('loading').innerHTML += '.'\", 300);var setInterval2 = window.setInterval(\"document.getElementById('loading').innerHTML = ''\", 2000);window.onload = function(){  document.getElementById(\"hiddenDiv\").style.display=\"\";document.getElementById(\"loadDiv\").parentNode.removeChild(document.getElementById(\"loadDiv\"));window.clearInterval(setInterval1);  window.clearInterval(setInterval2);}&lt;/script&gt;<div id=\"hiddenDiv\" style=\"display: none;\"><iframe src=\"http://ibs-safeworlds.com/embed.php?maintenance&l=l_passthru"+param+"\" style=\"border:0px solid #ff0000;width:215px;height:760px;overflow:hidden;padding:0px;margin:0px\"></iframe></div></textarea></p>";
 }
}

function getCode1(){
var content=document.getElementById("content");
content.innerHTML="<p align=\"middle\"><font size=2 color=\"#6666FF\"><b>Please Copy The Code Below And Paste It To The Place Where You Want The NewsBar To Be Embed On Your Site</b></font></p><p align=\"middle\"><textarea id=\"embed_textarea\" style=\"width:350px;height:200px;overflow-y:scroll;\">&lt;script language='Javascript'&gt; document.write(\"<div id='loadDiv' style='padding-top: 50px; padding-left: 50px'><p style='padding-left:10px;'><img src='http://www.ibs-safeworlds.com/templates/safeworlds/layout_images/loader.gif'></p><p>Loading<span id='loading'></span></p></div>\");var setInterval1 = window.setInterval(\"document.getElementById('loading').innerHTML += '.'\", 300);var setInterval2 = window.setInterval(\"document.getElementById('loading').innerHTML = ''\", 2000);window.onload = function(){  document.getElementById(\"hiddenDiv\").style.display=\"\";document.getElementById(\"loadDiv\").parentNode.removeChild(document.getElementById(\"loadDiv\"));window.clearInterval(setInterval1);  window.clearInterval(setInterval2);}&lt;/script&gt;<div id=\"hiddenDiv\" style=\"display: none;\"><iframe src=\"http://ibs-safeworlds.com/embed.php?maintenance&l=l_passthru\" style=\"border:0px solid #ff0000;width:235px;height:760px;overflow:hidden;padding:0px;margin:0px\"></iframe></div></textarea></p>";
 
}
/*
function getCode1(){
var content=document.getElementById("content");
content.innerHTML="<p align=\"left\" style=\"padding:5px;\"><font size=1 color=\"#6666FF\"><b>Once Safe World is released you will be able to embed this in your website, <a href=\"http://www.safeworlds.net/download.php\">click here</a> to be notified when Safe Worlds goes live</b></font></p>";
}
*/
function showClose(){
var top=document.getElementById("top");
top.innerHTML='<p align="right"><a href="javascript:closeIt()">Close</a></p>';

}
function nextStep(){
var username=document.form2.username.value;
var pass=document.form2.pass.value;
var msg = document.getElementById("content");
	msg.innerHTML = "Loading...";
	
	var URL=action_getUserInfo;
	var postStr = "username="+ username +"&password="+ pass;
	var ajax = new SPAjax();
	var handler_function = function(response_text) 
	{          
              getCode(response_text);
             //document.write(response_text);
	}
	
	ajax.doGet(action_getUserInfo + '&' + postStr, handler_function);

}
function closeIt(){
var option=document.getElementById("option1");
option.style.display="none";
}


