
/*  popupwindow.js  */
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=400,screenX=150,screenY=150,top=150,left=150')
}


/*  popup.js  */
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=710,height=520,scrollbars=yes');
return false;
}


/*   toggle_visibility.js  */
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';}





/*   ManageTabPanelDisplay.js  */
function ManageTabPanelDisplay() {
var idlist = new Array('tab1focus','tab2focus','tab3focus','tab4focus','tab1ready','tab2ready','tab3ready','tab4ready','content1','content2','content3','content4');
// No other customizations are necessary.
if(arguments.length < 1) { return; }
for(var i = 0; i < idlist.length; i++) {
var block = false;
for(var ii = 0; ii < arguments.length; ii++) {
if(idlist[i] == arguments[ii]) {
block = true;
break;
}
}
if(block) { document.getElementById(idlist[i]).style.display = "block"; }
else { document.getElementById(idlist[i]).style.display = "none"; }
}
}



/*   smutengine.js   */
function smutEngine() {
cmp = "BrazilIntro ~ @ # % ^ & * + = XXX $ www http:// .com .co. .net .org .biz .info .ca mailto: addict anus asshole arse bastard bitch blowjob boner butthole buttwipe clit cock cocksucker cum cumsucker cunt debt dick dildo dot dotco erection fag faggot feces foreskin fuck gmail hotmail iagra igarette jackoff jerkoff jism jizz loan masterbate motherfucker nazi nigger nutsack penis piss porno preteen prick pussy rsehole semen schlong scrotum shag shemale shit slut testicle tits tranny turd uck ucks vagina vulva wager whore yahoo YM essenger ";
// note the trailing space is essential. By specifying e.g. obacco instead of tobacco you help to overcome leading capital letters.
// smut="#@&*%!#@&*%!#@&*%!";
smut=".";
txt = document.myForm.introduction_title.value;
tstx = "";
for (var i=0; i<79; i++){    // 99 is the number of badwords listed.
pos = cmp.indexOf(" ");
wrd = cmp.substring(0,pos);
wrdl = wrd.length
cmp = cmp.substring(pos+1,cmp.length);
while (txt.indexOf(wrd)>-1){
pos=txt.indexOf(wrd);
txt=txt.substring(0,pos)+smut.substring(0,wrdl)+txt.substring((pos+wrdl),txt.length);
}
}
document.myForm.introduction_title.value = txt;
}



/*  lang pulldown  */
var DDSPEED = 10;
var DDTIMER = 15;

// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}





/* ---------------------------- */
/* SHOW-HIDE Layer	  */
/* ---------------------------- */
function showlayer(layer){
	var myLayer=document.getElementById(layer);
	if(myLayer.style.display=="none" || myLayer.style.display==""){
		myLayer.style.display="block";
	} else { 
		myLayer.style.display="none";
		}
}





/*** Scroller **/
function CWScroller(ulId, speed) {
this.container = document.getElementById(ulId);
this.container.Scroller = this;
this.speed = speed;
this.scroll = function() {
var c = this.container.firstChild;
var first = null;
while (c) {
if (c.tagName == 'LI') {
first = c;
break;
}
c = c.nextSibling;
}
var nodeSize = 101;	// Default was 78
var px = 0;
nodeSize = first.clientWidth;
if (first.style.marginLeft != '') {
px = parseInt(first.style.marginLeft);
}
first.style.marginLeft = ( px - 1 ) + 'px';
if ( parseInt(first.style.marginLeft) <= -(nodeSize) ) {
first.style.marginLeft = '0px';
this.container.removeChild(first);
this.container.appendChild(first);
}
setTimeout('document.getElementById(\'' + this.container.id + '\').Scroller.scroll()', this.speed);	
}
setTimeout('document.getElementById(\'' + ulId + '\').Scroller.scroll()', this.speed);
}
