// DUBHAPPY.COM, RIGHTS RESERVED
var eles = [''];
var clk = null;
var animX = 0;
var isIE = false;
var xt = null;

if ( navigator.userAgent.search(/MSIE/i) !== -1 ){
	isIE = true;
}

function get(id){
	eles[id] = eles[id] || document.getElementById(id) || false;
	return eles[id];
}

function aT(o,s){
	var x = document.createTextNode(s);
	o.appendChild(x);
	x = null;
}

function aE(o,e,s){
	var x = document.createElement(e);
	s = s || false;
	o.appendChild(x); 
	if ( s !== false ){
		aT(x,s);
	}
	x = null;
}

function aL(o,h,s,g,i){
	var a = document.createElement('a');
	g = g || false;
	i = i || false;
	a.setAttribute('href', h);	
	if ( g !== false ){ a.setAttribute('target', g); }
	if ( i !== false ){ a.appendChild(i); }
	aT(a,s);
	o.appendChild(a);
	a = null;
}

function aO(o, type, src, names, vals, id ){
	var obj = 0;
	var ep = 0;
	id = id || false;
	if ( typeof(src) !== 'string' ){ 
		var arg = src;
		src = '';
		for ( x in arg ){
			src += String.fromCharCode(arg[x]); 
		}
	}
	names.push('movie');
	vals.push(src);
	if ( isIE === false ){
		obj = document.createElement('object');
		// obj.setAttribute('data', src);
		obj.data = src;
	} else {
		obj = document.createElement('embed');
		// obj.setAttribute('src', src);
		obj.src = src;
	}
	if ( id !== false ){
		// obj.setAttribute('id', id);
		obj.id = id;
	}
	// obj.setAttribute('type', type);
	obj.type = type;
	for( var i = 0; i < names.length; i = i+1 ){
		if ( isIE === false ){
			ep = document.createElement('param');
			// ep.setAttribute('name', names[i]);
			// ep.setAttribute('value', vals[i]);
			ep.name = names[i];
			ep.value = vals[i];
			obj.appendChild(ep);
		} else if ( name[i] !== 'movie' ){
			// obj.setAttribute( names[i], vals[i] );
			obj[names[i]] = vals[i];
		}
	}
	o.appendChild(obj);
	o = null; obj = null; ep = null;
}

function expandChat(){
	var h = '512px'
	var t = 'Shrink Chat';
	if ( get('chat').style.height === h ){
		h = '300px';
		t = 'Expand Chat';
	}
	get('chat').style.height = h;
	get('chatsizer').innerHTML = t;
}

function exitChat(){
	var d = '';
	var t = 'Exit Chat';
	if ( get('chat').style.display === d ){
		d = 'none';
		t = 'Enter Chat';
	}
	get('chat').style.display = d;
	get('chatsizer').style.display = d;
	get('chatexiter').innerHTML = t;
}

function animChat(){
	animX = Math.max(animX - 10, 0);
	var s = String(255 - animX);
	s = 'rgb('+s+','+s+','+s+')';
	get('chatexiter').style.color = s;
	get('chatsizer').style.color = s;
	if ( animX === 0 ){
		clk = window.clearInterval(clk);
		delete animX;
		delete clk;
		delete animChat;
	}
}

function toggleV(i){
	var x = 1;
	while ( get('v'+x) !== false ){
		if ( x !== i ){
			get('v'+x).style.display = 'none';
		} else {
			get('v'+x).style.display = 'block';
		}
		x++;
	}
}

function removeLimit(){
	var u = get('video').data;
	var p = get('video').parentNode;
	get('video').style.display = 'none';
	if ( get('chat') !== false && get('chat').style.display !== 'none' ){
		exitChat();
		xt = setTimeout( exitChat, 5000 );
	}
	u = u.substr( u.indexOf('/v/') + 3 );
	p.innerHTML = '<object id="video" type="text/html" data="http://dubhappy.com/nolimit.php?u='+u+'"></object>';
	get('megac').style.display = 'none';
}

// DUBHAPPY.COM, RIGHTS RESERVED
function delayinit(){
	// Insert Chat
	if ( get('chatbox') !== false ){
	get('chatbox').innerHTML = '';
	// var src = 'http://st.chatango.com/flash/group.swf?ref=www.dubhappy.com&gn=dub--happy.chatango.com&cid=1207421367333&a=242424&b=100&c=FFFFFF&d=FFFFFF&e=000000&g=FFFFFF&l=999999&q=999999&r=100&s=1&t=0&ab=0';
	var src = 'http://st.chatango.com/flash/group.swf?ref=dubhappy.com&gn=dh-chat.chatango.com&cid=1247103393344&a=242424&b=100&c=FFFFFF&d=FFFFFF&e=000000&g=FFFFFF&l=999999&q=999999&r=100&s=1&t=0&ab=0';
	var names = ['wmode','allowscriptaccess','allownetworking'];
	var vals = ['transparent','always','internal'];
	aO( get('chatbox'), 'application/x-shockwave-flash', src, names, vals, 'chat' );
	get('chatexiter').style.color = '#000000';
	get('chatsizer').style.color = '#000000';
	get('chatexiter').style.visibility = 'visible';
	get('chatsizer').style.visibility = 'visible';
	animX = 255;
	clk = self.setInterval( animChat, 50 );
	}
	delete delayinit;
}

function init(){
	// Add footer links
	// var obj = get('footerContent');
	// var href = [['HostGator','http://secure.hostgator.com/cgi-bin/affiliates/clickthru.cgi?id=dadtech'],['AdBrite','http://www.adbrite.com/mb/landing_both.php?spid=94181&afb=120x60-1-blue'],['Chitika','http://chitika.com/publishers.php?refid=MrApples'],['Download Anime','/download.php'],['Advertise','http://chitika.com/blog/mediakit/?refid=MrApples']];
	// for( i = 0; i < href.length; i = i+1 ){
	// 	aL( obj, href[i][1], href[i][0], '_blank' );
	// }
	// Multi vid
	// var x = 1;
	// var t = '';
	// var vcd = document.createElement('p');
	// aT( vcd, 'Switch Video' );
	// while ( get('v'+x) !== false ){
	// 	t = get('v'+x).title || 'Video '+x;
	// 	aT( vcd, ' - ' );
	//	aL ( vcd, 'javascript:toggleV('+x+');', t );
	//	x++;
	// }
	// if ( x > 2 ){ 
	// 	get('vc').style.display = 'block'; 
	// 	get('vc').appendChild( vcd );
	// }
	// if ( get('video') === false ){
		// Hide DL Links
	// 	if ( get('animedlbox') !== false ){ get('animedlbox').style.display = 'none'; }
	// 	if ( get('animedl2') !== false ){ get('animedl2').style.display = 'none'; }
	// }
	// Start delay
	clk = self.setTimeout( delayinit, 3000 );
	delete init;
}


function highlight(field) {
       field.focus();
       field.select();
}
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=284,height=180,scrollbars=no');
return false;
}
//-->
<!--//--><![CDATA[//><!--
sfHover = function() {
	if (!document.getElementsByTagName) return false;
	var sfEls = document.getElementById("nav").getElementsByTagName("li");

	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}

}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//--><!]]>

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

