function includeSwf(path, width, height){
    document.write("<object type='application/x-shockwave-flash' data='"+path+"' width='"+width+"' height='"+height+"'><param name='movie' value='"+path+"' /><param name='bgcolor' value='#ffffff'><param name='wmode' value='transparent'></object>");
}
function returnIncludeSwf(path, width, height){
    return "<object type='application/x-shockwave-flash' data='"+path+"' width='"+width+"' height='"+height+"'><param name='movie' value='"+path+"' /><param name='bgcolor' value='#ffffff'><param name='wmode' value='transparent'></object>";
}
function toggleArticleSearchMenuNav() {
	if ( document.getElementById("searchshort").style.display == "block" ) {
		document.getElementById("searchshort").style.display = "none";
		document.getElementById("searchlong").style.display = "block";
	} else {
		document.getElementById("searchshort").style.display = "block";
		document.getElementById("searchlong").style.display = "none";
	}
}
function doVideoSearch() {
	document.getElementById("video_div").innerHTML = ajax("ajax/videosearch.php", "a=1&youtubelink="+escape(document.getElementById("txtVideo").value));
}
function dopos() {	document.getElementById("_body").style.	filter = "alpha(opacity:100)";    document.getElementById("_body").style.KHTMLOpacity = "1";    document.getElementById("_body").style.MozOpacity = "1";    document.getElementById("_body").style.opacity ="1";}function doneg() {	document.getElementById("_body").style.	filter = "alpha(opacity:30)";    document.getElementById("_body").style.KHTMLOpacity = ".3";    document.getElementById("_body").style.MozOpacity = ".3";    document.getElementById("_body").style.opacity =".3";}

function cs() {
	if (navigator.userAgent.indexOf("MSIE")!=-1) document.getElementById("_container").innerHTML = "<br/><h3>THIS SITE IS BEING DEVELOPED AND IS NOT SIITABLE FOR IE AS OF YET</h3><br/><br/>" + document.getElementById("_container").innerHTML;
}


function youtubepreview() {
	var url = document.getElementById("txtVideo").value;
	
	//http://www.youtube.com/watch?v=iXcAOa2JNAU
	document.getElementById("youtubepreview").innerHTML = returnIncludeSwf(url,"425", "344");
	/*
	document.getElementById("youtubepreview").innerHTML ='<object width="425" height="344"><param name="movie" value="'+url+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+url+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';*/
}





/* DRAG --> */


function getID(id)
{
	return document.getElementById(id);
}

// Determine browser and version.

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    return;
  }

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    return;
  }
}
var browser = new Browser();

/////////////////////////////////////////////////////////////////////////////////////

// Coded by Waseem Khan
// Developer at PakCoders
// Downloaded from http://blog.pakcoders.com

/////////////////////////////////////////////////////////////////////////////////////
// Dragging Function Starts Here
/////////////////////////////////////////////////////////////////////////////////////

// Global object to hold drag information.

var dragObj = new Object();
function dragStart(event, id) {
  var x, y;
  dragObj.elNode = getID(id);
  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

///////////////////////////////////////////////////////////////////////////////////////////////////////




/* loading */
function showLoading(reference){
    clearTimeout(reference);
    var loading = document.getElementById("loading");
    loading.style.display = "block";
	if (document.getElementsByName("pagebody")[0]) document.getElementsByName("pagebody")[0].style.overflow = "hidden";
}
function hideLoading(){
    fadeOut("loading", true);
	
	/*
	var header = document.getElementById("header");
	while (header.height<312) {
		document.getElementById(header).style.height = header.height + 0.1;
	}
	*/
}
function fadeOut(element_id, remove){
    if (document.getElementById(element_id)) document.getElementById(element_id).style.opacity = 1;
    disappear(element_id, remove);
	var d = document.getElementsByName("loadingmain")[0];
	d.innerHTML = "";
	d.style.height = "0px";
	d.style.width = "0px";
	if (document.getElementsByName("pagebody")[0]) document.getElementsByName("pagebody")[0].style.overflow = "auto";
}
function disappear(element_id, remove){
	if (document.getElementById(element_id)) {
		var alpha = document.getElementById(element_id).style.opacity;
		if( alpha > 0.1 ){
			document.getElementById(element_id).style.opacity = alpha - 0.1;
			setTimeout("disappear('"+element_id+"', "+remove+")", 10);
		} else {
			if( !remove ){
				document.getElementById(element_id).style.display = "none";
				document.getElementById(element_id).style.opacity = 1;
			} else {
				var parent = document.getElementById(element_id).parentNode;
				var element = document.getElementById(element_id);
				parent.removeChild(element);
			}
		}
	}
}
function loadingModule(){
    document.write("<object type='application/x-shockwave-flash' data='flash/loading.swf' width='15' height='15'><param name='movie' value='flash/loading.swf' /><param name='wmode' value='transparent' /></object>");
}

function members_showLogin() {
	var divTag = document.createElement("div");
	divTag.id = "div1";
	divTag.setAttribute("align","center");
	divTag.className ="loginDiv";
	divTag.innerHTML = "Login.";
	document.body.appendChild(divTag);
}
function members_showSignup() {
	
}