/*	

	jsb Coder version 4.2

	Written by Cao Phong

	Copyright 2005-2006 by www.javascriptbank.com

	Distributed under the terms of the GNU organization

	Please contact us if you want to use this file or any part of codes

*/



////////////////*Function to roll website to 2 side*//////////

var enabled = false;

var alphaVisible = true;

var betaVisible = true;

var ie = document.all ? true : false;

var ns = document.layers ? true : false;

var ns6 = !ie && document.getElementById ? true : false;



function toggleAlpha()

{

  if (!enabled) return;

  var d, m, e, a, i;

  if (alphaVisible) {

    d = 'none';

    m = '0px';

  }

  else {

    d = 'block';

    m = '143px';

  }

  e = xGetElementById('navAlpha');

  e.style.display = d;

  a = xGetElementsByClassName('content');

  for (i = 0; i < a.length; ++i) {

    a[i].style.marginLeft = m;

  }

  alphaVisible = !alphaVisible;

}



function toggleBeta()

{

  if (!enabled) return;

  var d, m, e, a, i;

  if (betaVisible) {

    d = 'none';

    m = '0px';

  }

  else {

    d = 'block';

    m = '163px';

  }

  e = xGetElementById('navBeta');

  e.style.display = d;

  a = xGetElementsByClassName('content');

  for (i = 0; i < a.length; ++i) {

    a[i].style.marginRight = m;

  }

  betaVisible = !betaVisible;

}



function button_over(className)

{

	var src = window.event.srcElement;

	src.className = className;

}



function disableselect(e){

	return false

}



function reEnable(){

	return true

}



//if IE4+

document.onselectstart=new Function ("return true")



//if NS6

if(window.sidebar){

document.onmousedown=disableselect

document.onclick=reEnable

}



///////////////*Disable right click in IE*/////////////////////



function dblclick(evt){

	toggleAlpha();

	gnuDIV();

}



if(document.layers){

	document.captureEvents(Event.ONDBLCLICK);

}



function mouseclick(){

	toggleBeta();

	gnuDIV();

	return false;

}







function WapImage(img_id,cat_stat){

	var toggleOn = url + 'toggleOn.gif',

		 toggleOff = url + 'toggleOff.gif';

	var obj = document.getElementById(img_id);

	var stat = document.getElementById(cat_stat).style.display;

	obj.src = (stat == 'none')?toggleOn:toggleOff;

}

function showHideDiv(img_id,cat_id,cat_title){

	var obj = document.getElementById(cat_id).style;

	var fStyle = document.getElementById(cat_title).style;

	if (obj.display == 'block'){

		obj.display = 'none';

		fStyle.color = fontDeactive;

		}

	else{

		obj.display = 'block';

		/*fStyle.color = fontActive;*/

	}

	if(img_id != null) WapImage(img_id,cat_id);

	gnuDIV();

}



function gnuDIV(){

	var posRight = document.getElementById('navBeta'),

		 posLeft = document.getElementById('navAlpha'),

		 posHead = document.getElementById('header_main'),

		 posContent = document.getElementById('content'),

		 posGnu = document.getElementById('gnu');

	var leftCol = posLeft.offsetHeight + posHead.offsetHeight,

		 midCol = posContent.offsetHeight + posHead.offsetHeight,

		 rightCol = posRight.offsetHeight + posHead.offsetHeight;

	var maxCol = leftCol>midCol?leftCol:midCol;

	if(maxCol < rightCol) maxCol = rightCol;

	if(ie) posGnu.style.posTop = maxCol;

	else posGnu.style.top = maxCol;

}



function pollWin(address){

	window.open(address, "new", "width=720,height=480,location=0,menubar=0,personalbar=0,status=0");

	}

	

function copyAll(obj){

	obj.focus();

	obj.select()

	var command=obj.createTextRange();

	if(command.execCommand('Copy'))

		alert("Copy complete");

	}

	

function submitPoll(id,opt){

	for(i = 0; i < opt.length; i++)

		if(opt[i].checked)

		{

			 pollWin('../clientscript/funcs/submit_poll.php?id=' + id + '&opt=' + opt[i].value);

			 return;

		}

	alert('Your mark are required');

	}



window.onload = function()

{

  top.window.moveTo(0,0);

  if (document.all)

	 top.window.resizeTo(screen.availWidth,screen.availHeight);

  var e = xGetElementById('navAlpha');

  if (e && xDef(e.style) && document.getElementsByTagName) {

    enabled = true;

  }

}

// -->
