function showVid (whichvid, url, author) {
	if (document.getElementById) {
  		document.getElementById('thumbnail').src = whichvid.href;
  		document.getElementById('vpage').href = url;
  		document.getElementById('vpage2').href = url;
  		document.getElementById('vpage3').href = url;
        
  		if (whichvid.title) {
   			document.getElementById('desc').childNodes[0].nodeValue = '"' + whichvid.title + '"';
  		} else {
   			document.getElementById('desc').childNodes[0].nodeValue = whichvid.childNodes[0].nodeValue;
  		}
        if (whichvid.author) {
   			document.getElementById('auth').childNodes[0].nodeValue = 'by ' + whichvid.author;
        } else {
   			document.getElementById('auth').childNodes[0].nodeValue = 'by ' + author;
        }

            
  		return false;
 	} else {
  		return true;
 	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function writeCookie(name, data, noDays){
	var cookieStr = name + "="+ data
  	if (writeCookie.arguments.length > 2){
    	cookieStr += "; expires=" + getCookieExpireDate(noDays)
    }
  	document.cookie = cookieStr
}

function readCookie(cookieName){
	var searchName = cookieName + "="
	var cookies = document.cookie
   	var start = cookies.indexOf(cookieName)
   	if (start == -1){ // cookie not found
     	return ""
    }
   	start += searchName.length //start of the cookie data
   	var end = cookies.indexOf(";", start)
   	if (end == -1){
     	end = cookies.length
    }
   	return cookies.substring(start, end)
}

function blocking(nr, cookie, vis_state)
{
	if (document.layers)
    {
        current = (document.layers[nr].display == 'none') ? vis_state : 'none';
        if (cookie != '')
        	writeCookie(nr, current);
        document.layers[nr].display = current;
    }
    else if (document.all)
    {
        current = (document.all[nr].style.display == 'none') ? vis_state : 'none';
        if (cookie != '')
            writeCookie(nr, current);
        document.all[nr].style.display = current;
    }
    else if (document.getElementById)
    {
        display = (document.getElementById(nr).style.display == 'none') ? vis_state : 'none';
        if (cookie != '')
            writeCookie(nr, display);
        document.getElementById(nr).style.display = display;
	}
}


function adjust_popup()
{
	var w, h, fixedW, fixedH, diffW, diffH;

    if (document.all) {
    	fixedW = document.body.clientWidth;
        fixedH = document.body.clientHeight;
        window.resizeTo(fixedW, fixedH);
        diffW = fixedW - document.body.clientWidth;
        diffH = fixedH - document.body.clientHeight;
    } else {
        fixedW = window.innerWidth;
        fixedH = window.innerHeight;
        window.resizeTo(fixedW, fixedH);
        diffW = fixedW - window.innerWidth;
        diffH = fixedH - window.innerHeight;
    }
    w = fixedW + diffW;
    h = fixedH + diffH;
    if (h >= screen.availHeight) w += 16;
    if (w >= screen.availWidth)  h += 16;
    w = Math.min(w,screen.availWidth);
    h = Math.min(h,screen.availHeight);
    window.resizeTo(w,h);
    window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}

var nw;
function UploadPopup() {
    nw=window.open("upload.php","Upload_Video","width=780,height=600,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no,status=yes");
    nw.opener=self;
}

function popUp2(URL,WIDTH,HEIGHT) {
page1 = window.open(URL, '', 'toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=0,width=600,height=350');
}


var statusWin;
function showProgress() {
    statusWin = open('progress_uploading.php','Status','height=150,width=350,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes');  
}
                                                
function hideProgress() {
    if (typeof(statusWin) != "undefined") {
		statusWin.close();
		statusWin = void(0);
    }
}

function hideProgressAndReload() {
    hideProgress();
    history.go(0);
}
