function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function move_link(category){
	var cf_server = "http://cf.kidsland.tv/";
	if (category =='baldal'){
		location.href="/baldal/";
	} else if (category =='study'){
		location.href="/study/";
	} else if (category =='cre'){
		location.href="/play/";
	} else if (category =='ani'){
		location.href="/ani/";
	} else if (category =='music'){
		location.href="/music/";
	} else if (category =='rhythm'){
		location.href="/gogo/";
	} else if (category =='pet'){
		location.href=cf_server+"play/pet/";
	} else if (category =='math'){
		location.href="/study/math.php";
	} else if (category =='eng'){
		location.href="/study/english.php";
	} else if (category =='creative'){
		location.href=cf_server+"play/creative/";
	} else if (category =='noridd'){
		location.href=cf_server+"play/noridd/";
	} else if (category == 'sutoku'){
		location.href="/play/sutoku/";
	} else if (category =='card'){
		location.href="/play/card/";
	}
}
//This is the Javascript the is pulled from roll.js from css Folder
function MM_swapImgRestore() {
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_preloadImages() {
	var d=document;
	if(d.images){
	if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
	for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}
	}
}
function full_win(src) {
	var full_win = window.open(src,"","fullscreen,scrollbar=no,toolbar=no");
}
function small_pop_open(url,width,height,etc){
	var pop = window.open(url,"","width="+width+",height="+height+","+etc);
	pop.focus();
}
var rolling_banner = function(ta){
	this.ta = ta;
	this.ta_id = 'roll_'+(this.ta.id||this.ta.name);
	this.gap = 5;
	this.gap_count=0;
	this.gap_time = '1000';
	this.gap_sleep = '2000';
	this.over_stop = true;
	this.timer = null;
	eval(this.ta_id+'=this');
	var temp = eval(this.ta_id);
	this.init_div();
}
rolling_banner.prototype.start = function(){
	this.ta.readonly =false;
	this.stop =false;
	if(!this.timer){ this.rolling();	 }
	}
	rolling_banner.prototype.stop = function(){
	this.stop =true;
}
rolling_banner.prototype.init_div = function(){
	this.ta.style.position="relative";
	this.ta.style.overflow="hidden";
	this.ta.onmouseover=function(){ eval("this.readOnly=true;"); }
	this.ta.onmouseout=function(){ eval("this.readOnly=false;"); }
	var child = this.ta.childNodes;
	var ch = this.ta.firstChild;
	var ch2 = null;
	while(ch){
	ch2 = ch.nextSibling;
	if(ch.nodeName.toLowerCase() !='div'){
	this.ta.removeChild(ch);
	}else{
	ch.style.position = "relative";
	ch.style.borderStyle='none';
	ch.style.top='0px';
	}
	ch=ch2;
	}
}
rolling_banner.prototype.strtonum = function(str){
	var num = parseInt(str);
	if(isNaN(num)) num = '0';
	return num
}
rolling_banner.prototype.strtopx = function(str){
	var num = this.strtonum(str);
	return num+'px';
}
rolling_banner.prototype.rolling = function(){
	if(this.gap_count==0){
	this.sleep();
	this.gap_count+=1;
	return;
	}
	if(!this.ta.readOnly && !this.stop){
	this.rolling_top();
	}
	this.timer = null;
	var re = this.ta_id+'.rolling()';
	this.timer = setTimeout(re,this.gap_time);
}
rolling_banner.prototype.rolling_top = function(){
	this.gap_count+=parseInt(this.gap);
	var ch1 = this.ta.firstChild;
	var child = this.ta.childNodes;
	var ta_ch = null;
	var	top_ori = this.strtonum(child[0].style.top);
	var top = this.strtopx(top_ori-parseInt(this.gap));
	for(var i=0,m=child.length;i<m;i++){
	child[i].style.top=top;
	}
	if(this.gap_count >= this.strtonum(ch1.style.height)){
	var temp =ch1.cloneNode(true);
	this.ta.removeChild(ch1);
	this.ta.appendChild(temp);
	for(var i=0,m=child.length;i<m;i++){
	child[i].style.top='0px';
	}
	this.gap_count = 0
	}
}
rolling_banner.prototype.sleep = function(){
	this.timer = null;
	var re = this.ta_id+'.rolling()';
	this.timer = setTimeout(re,this.gap_sleep);
}
