// <!-- Begin

function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}


function openPopUp(src,w,h,name) {
			KopWin = window.open(src,name,"toolbar=0,width=" + w + ",height=" + h + ",location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,copyhistory=1");
			KopWin.focus();
	}


function initProgress() {
//alert("init");
}

function animateRatingPost(){
	var source = document.getElementById("rater1");
	var div = '<div id="ratingcount" class="star-rating-bottom-message"><table border="0" cellspacing="2"><tr><td valign="middle">Sending</td><td><img src="i/indicator.gif" /></td></tr></table></div>';
	Element.update (source,div);
}

function connecting(id,message){
	var source = document.getElementById(id);
	var div = '<table border="0" cellspacing="2"><tr><td valign="middle">'+message+'</td><td><img src="i/indicator.gif" /></td></tr></table>';
	Element.update (source,div);
}

function resetProgress(request) {
//alert("reset");
}

function reportError() {
//alert("error");
}

function printFlash(id,id2,autoplay,duration){
	printFlash(id,id2,autoplay,duration,0);
}

function printFlash(id,id2,autoplay,duration,fs){
	width='360';
	height='310';
	if (fs == 1) {
		width= '100%';
		height= '100%';
	}

	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+width+"\" height=\""+height+"\" >") 
	document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />") 
	document.write("<param name=\"movie\" value=\"i/player.swf\" />") 
	document.write("<param name=\"quality\" value=\"high\" />") 
	document.write("<param name=\"bgcolor\" value=\"#ffffff\" />") 
	document.write("<param name=\"allowFullscreen\" value=\"true\" />")
	document.write("<param name=\"FlashVars\" value=\"id="+id+"&id2="+id2+"&autoplay="+autoplay+"&duration="+duration+"&fs="+fs+"\" />") 
	document.write("<embed src=\"i/player.swf\" FlashVars=\"id="+id+"&autoplay="+autoplay+"&duration="+duration+"&fs="+fs+"\" quality=\"high\" bgcolor=\"#ffffff\" width=\""+width+"\" height=\""+height+"\"  allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />") 
	document.write("</object>") ;
}


function printFullFlash(id,id2){
 var width = 0, height = 0;
if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
    width = window.innerWidth;
    height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    width = document.documentElement.clientWidth;
    height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    width = document.body.clientWidth;
    height = document.body.clientHeight;
}

var fWidth=0, fHeight=0;
var ratioW=width/360;
var ratioH=height/310;
var ratio = ratioW;

if (ratioH<ratio)
	ratio = ratioH;

fWidth=360*ratio;
fHeight=310*ratio;

document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+fWidth+"\" height=\""+fHeight+"\" >") 
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />") 
document.write("<param name=\"movie\" value=\"i/player.swf\" />") 
document.write("<param name=\"quality\" value=\"high\" />") 
document.write("<param name=\"bgcolor\" value=\"#ffffff\" />") 
document.write("<param name=\"FlashVars\" value=\"id="+id+"&id2="+id2+"&width="+width+"&height="+height+"&autoplay=1\" />") 
document.write("<embed src=\"i/player.swf\" FlashVars=\"id="+id+"&width="+width+"&height="+height+"&autoplay=1\" quality=\"high\" bgcolor=\"#ffffff\" width=\""+fWidth+"\" height=\""+fHeight+"\"  allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />") 
document.write("</object>") ;

}


function openFull(id)
	{
	  var fs = window.open( "Player.jsp?id="+id,
			   "FullScreenVideo", "toolbar=no,width=" + screen.availWidth  + ",height=" + screen.availHeight 
				+",status=no,resizable=yes,fullscreen=yes,scrollbars=no");
	  fs.focus();
	}

function openSendMail(id){
	  var fs = window.open( "SendFriend.jsp?id="+id,
			   "sendMailWindow", "toolbar=no,width=400,height=250,status=no,resizable=yes,scrollbars=no");
	  fs.focus();
}

function openJoinGroup(id){
	  var fs = window.open( "JoinGroup.jsp?id="+id,
			   "joinGroupWindow", "toolbar=no,width=200,height=200,status=no,resizable=yes,scrollbars=no");
	  fs.focus();
}

function openDeleteMember(uid,gid){
	if (confirm('Are you sure you want to delete this member?')){
	  var fs = window.open( "DeleteMember.jsp?uid="+uid+"&gid="+gid,
			   "MemberDeleteWindow", "toolbar=no,width=200,height=100,status=no,resizable=yes,scrollbars=no");
	  fs.focus();
	 }
}

function openLeaveGroup(id){
	if (confirm('Are you sure you want to leave this group?')){
	  var fs = window.open( "LeaveGroup.jsp?id="+id,
			   "LeaveGroupWindow", "toolbar=no,width=200,height=100,status=no,resizable=yes,scrollbars=no");
	  fs.focus();
	 }
}

function removeVideo(url){
	if (confirm('Are you sure you want to remove this video?')){
		window.location=url;
	}	
}

function openWindow(url,width,height){
	  var fs = window.open( url,
			   "", "toolbar=no,width="+width+",height="+height+",status=no,resizable=yes,scrollbars=no");
	  fs.focus();
}

function openWindow(url,width,height,needLogin,loginMsg){
	  if (needLogin){
		 alert(loginMsg);	  
	  } else {
		  var fs = window.open( url,
				   "", "toolbar=no,width="+width+",height="+height+",status=no,resizable=yes,scrollbars=no");
		  fs.focus();
	  }
}

function ShowForm(id,link, retUrl, target) {
	document.getElementById(target).style.top = getScrollY() + 180;
	link = link + 'retUrl=' + encodeURIComponent(retUrl);
	link = link + '&Math.random=' + Math.random(); 
	var aj_Form = new AjaxJspTag.HtmlContent(
	link, {
	parameters: "",
	postFunction: resetProgress(target),
	source: id,
	target: target,
	preFunction: initProgress(target),
	errorFunction: reportError(target)
	});
	element = document.getElementById(id);
	aj_Form.execute(element);
	return false;
}

function ShowMessageBox(id,link, target,form) {
	var ml = document.forms[form];
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.value == id) {
	    	if(!e.checked){
	    		document.getElementById(target).style.top = getScrollY() + 180;
				link = link + '&Math.random=' + Math.random(); 
				var aj_Form = new AjaxJspTag.HtmlContent(
				link, {
				parameters: "",
				postFunction: resetProgress(target),
				source: id,
				target: target,
				preFunction: connecting(target,'Please Wait...'),
				errorFunction: reportError(target)
				});
				element = document.getElementById('tr'+id);
				element.className='read';
				aj_Form.execute(element);
				e.checked = true;
				element.style.backgroundColor='#eef';
	    	} else {
	    		e.checked = false;
	    		element = document.getElementById('tr'+id);
	    		element.style.backgroundColor='#fff';
	    	}
	    }
	}
	return false;
}


function checkAll(form,elem) {
	var ml = document.forms[form];
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == elem) 
	    	check(e);
	}
}



function clearAll(form,elem) {
	var ml = document.forms[form];
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == elem) 
			clear(e);
	}
}

function clear(e){
	e.checked = false;
	element = document.getElementById('tr'+e.value);
	element.style.backgroundColor='#fff';
}

function check(e){
	e.checked = true;
	element = document.getElementById('tr'+e.value);
	element.style.backgroundColor='#eef';
}


function toggle(e){
	if (e.checked)
		clear(e);
	else
		check(e);
}

// End -->
