function openPopup(url,name,height,width,opt_show_scrollbars){
var scrollbar_param=opt_show_scrollbars?",scrollbars=1":"";
var newwindow=window.open(url,name,'height='+height+',width='+width+scrollbar_param);
if(newwindow&&!newwindow.opener){newwindow.opener=window;}
if(window.focus){newwindow.focus()}
return false;
}
function openpopup(popurl){
var winpops=window.open(popurl,"","width=800,height=600,resizable,menubar,scrollbars=1")
}
function openflv(url) {
popupWin = window.open(url,'new_page','width=1024,height=768,resizable=yes')
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
function wmp_fullscreen() {
if (document.getElementById('Player').playState == 3) 
{alert('You are entering full-screen mode. To exit, press the "ESC" key.');
document.getElementById('Player').fullScreen = 'true';}}
//Handle Check Username Availability Using Ajax
var http = createRequestObject();
function createRequestObject() {
var xmlhttp;
try { 
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
}
catch(e) {
try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(f) { xmlhttp=null; }
}
if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
xmlhttp=new XMLHttpRequest();
}
return  xmlhttp;
}
function sndRating(idnum,rateval) {
var dvelement = document.getElementById('dv'+idnum);
dvelement.innerHTML = "<img src='/img3/progressimgred.gif'>";
var voted = document.getElementById('vt'+idnum);
voted.style.display = 'block';
voted.innerHTML = '<div class="voted">Thanks for rating !</div>';
try {
http.open('GET', '/realmovies/ratingprocess.asp?id='+idnum+'&rateval='+rateval);
http.onreadystatechange = handleResponseText;
http.send(null);
}
catch(e){}
finally{}
}
function handleResponseText() {
try
{
if((http.readyState == 4)&& (http.status == 200)){
var response = http.responseText;
var update = new Array();
if(response.indexOf('|') != -1) {
update = response.split('|');
var drelement = document.getElementById('dv'+update[0]);
var voteres = document.getElementById('vot'+update[0]);
var totalvote = document.getElementById('tv'+update[0]);
var starimg = document.getElementById('star'+update[0]);
var vtelement = document.getElementById('vt'+update[0]);
drelement.style.display ='none';
voteres.innerHTML = update[2];
totalvote.innerHTML = update[3];
starimg.innerHTML = update[4].toString();
}
}
}
catch(e){alert("an error occured");}
finally{}
}
function sndRatingImg(idnum,rateval) {
var dvelement = document.getElementById('dv'+idnum);
dvelement.innerHTML = "<img src='/img3/progressimgred.gif'>";
var voted = document.getElementById('vt'+idnum);
voted.style.display = 'block';
voted.innerHTML = '<div class="voted">Thanks for rating !</div>';
try {
http.open('GET', '/myimages/ratingprocess.asp?id='+idnum+'&rateval='+rateval);
http.onreadystatechange = handleResponseText;
http.send(null);
}
catch(e){}
finally{}
}
function handleResponseText() {
try
{
if((http.readyState == 4)&& (http.status == 200)){
var response = http.responseText;
var update = new Array();
if(response.indexOf('|') != -1) {
update = response.split('|');
var drelement = document.getElementById('dv'+update[0]);
var voteres = document.getElementById('vot'+update[0]);
var totalvote = document.getElementById('tv'+update[0]);
var starimg = document.getElementById('star'+update[0]);
var vtelement = document.getElementById('vt'+update[0]);
drelement.style.display ='none';
voteres.innerHTML = update[2];
totalvote.innerHTML = update[3];
starimg.innerHTML = update[4].toString();
}
}
}
catch(e){alert("an error occured");}
finally{}
}
function Show_Stuff(id){
var Click_Menu = document.getElementById(id);
if (Click_Menu.style.display == "none"){
Click_Menu.style.display = "";
}
else{
Click_Menu.style.display = "none";
}
return false;
}
function ShowLayer(id,MaxId) {
for(i=1;i<=MaxId;i++){
if (i!=id) eval("document.getElementById('" + i + "').style.display='none'");
else 
eval("document.getElementById('" + i + "').style.display='block'");
}
}
function VideoReplay(id){
var replaycomment = document.getElementById('replaycomment_'+id+'').value;
var email = document.getElementById("email").value;
var btnSubmit = document.getElementById('submit_replay_'+id+'');
if (replaycomment==""){
alert("Please check the comment!")
document.getElementById('replaycomment_'+id+'').focus();
return false
}
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function VideoComment(){
var email = document.getElementById("email").value;
var header = document.getElementById("header").value;
var commentvideo = document.getElementById("commentvideo").value;
var btnSubmit = document.getElementById("submit_video_comment");
if (header==""){
alert("Enter The Tittle of Your Comment !!")
return false
}
if (commentvideo==""){
alert("Please check the comment!")
document.getElementById("commentvideo").focus();
return false
}
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function sendVideo(){
var youremail = document.getElementById("youremail").value;
var Email = document.getElementById("Email").value;
var message = document.getElementById("message").value;
var btnSubmit = document.getElementById("submit_send_video");
if (Email==""){
alert("Enter one e-mail address at least !!")
document.getElementById("Email").focus();
return false
}
if (message==""){
alert("Enter a message !!")
document.getElementById("message").focus();
return false
}
if (youremail.indexOf('@', 0) == -1 || youremail.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
if (Email.indexOf('@', 0) == -1 || Email.indexOf('.', 0) == -1){ 
alert("No valid e-mail address!");
document.getElementById("Email").focus();
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function submitReport(){
var email = document.getElementById("email").value;
var message = document.getElementById("message").value;
var btnSubmit = document.getElementById("submit_report");
if (email==""){
alert("Enter your e-mail address !!")
return false
}
if (message==""){
alert("Explain the problem...Entering your reasons !!")
return false
}
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function sendBug(){
var yourname = document.getElementById("yourname").value;
var youremail = document.getElementById("youremail").value;
var Url = document.getElementById("Url").value;
var message = document.getElementById("message").value;
var btnSubmit = document.getElementById("submit_bug");
if (yourname==""){
alert("Enter your name !!")
document.getElementById("yourname").focus();
return false
}
if (youremail==""){
alert("Enter your e-mail address!!")
document.getElementById("youremail").focus();
return false
}
if (Url==""){
alert("Enter the URL where you have found a bug !!")
document.getElementById("Url").focus();
return false
}
if (message==""){
alert("Enter a description of bug !!")
document.getElementById("message").focus();
return false
}
if (youremail.indexOf('@', 0) == -1 || youremail.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please enter a valid e-mail address");
document.getElementById("youremail").focus();
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function DeleteAccount(){
var password = document.getElementById("password").value;
var reason = document.getElementById("reason").value;
var strCAPTCHA = document.getElementById("strCAPTCHA").value;
if (password==""){
alert("Please enter your current password.")
document.getElementById("password").focus();
return false
}
if (reason==""){
alert("Please tell us why you are closing your account.")
document.getElementById("reason").focus();
return false
}
if (strCAPTCHA==""){
alert("Please enter verification code")
document.getElementById("strCAPTCHA").focus();
return false
}
}
function select_deselect ( form_name, field ) {
var flag = "select";
var f = eval( 'document.' + form_name + '.' + field );
if ( flag == "select" ) {
for( i = 0; i < f.length; i++ ) {
f[i].checked = true;
}
f.checked = true;
flag = "unselect";
}
else {
for( i = 0; i < f.length; i++ ) {
f[i].checked = false;
}
f.checked = false;
flag = "select"; 
} 
}
function OnChangedUsername(){
if(document.register.USERNAME.value == ""){
document.register.btnCheckAvailability.disabled = true;
}
else {
document.register.btnCheckAvailability.disabled = false;
}
}
function OnCheckAvailability(){
if(window.XMLHttpRequest){
oRequest = new XMLHttpRequest();
}
else if(window.ActiveXObject){
oRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
oRequest.open("POST", "/login/Availability.asp", true);
oRequest.onreadystatechange = UpdateCheckAvailability;
oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
oRequest.send("strCmd=availability&strUsername=" + document.register.USERNAME.value);
}
function UpdateCheckAvailability(){
if(oRequest.readyState == 4){	
if(oRequest.status == 200)
{
document.getElementById("Available").innerHTML = oRequest.responseText;
}
else {
document.getElementById("Available").innerHTML = "Asychronous Error";
}
}
}
function ConfirmChoice() {
answer = confirm("Please log in to post a comment. Do you want to log in ?")
if (answer !=0) {
location = "/login/login.asp"}
}
function DefaultCh() {
answer = confirm("Your channel layout will be saved as default layout.")
if (answer !=0) {
location = "/login/editprofilelayout.asp?act=reset"}
}
function moredetails(id){
var details = document.getElementById(id);
if (details.style.display == "none"){
details.style.display = "";
details = document.getElementById('more' + id);
details.innerHTML = 'less...';
}
else {
details.style.display = "none";
details = document.getElementById('more' + id);
details.innerHTML = 'more...';
}
return false;
}
function ShowDiv(id1,id2){
if(document.getElementById){
el1=document.getElementById(id1);
el2=document.getElementById(id2);
if(el1.style.display=="none"){
el1.style.display="block";
el2.style.display="none";
}
else{
el1.style.display="none";
el2.style.display="block";
}
}
}
function doSearch()
{
var searchtype = document.getElementById('Search_Users');
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var channel = document.getElementById("channel").value;
if (lname == "" && fname == "" && email == "" && channel == "")
{
alert("Please enter your search term");
return false;
}
}

function checkAll(formObj, is_checked) 
{
for (var i=0;i < formObj.length;i++) {
fldObj = formObj.elements[i];
if (fldObj.type == 'checkbox') {
fldObj.checked = is_checked;
}
}
}
is_checked_all = false;
function toggleCheckAll(formObj) {
is_checked_all = !is_checked_all;
checkAll(formObj, is_checked_all);
}
function resetCheckAllValue(formObj, is_checked) {
if(!is_checked) {
main_checkbox = document.getElementById("checkall_checkbox");
if(main_checkbox) {
main_checkbox.checked = false;
}
is_checked_all = false;
}
}
function uploadVideo(){
var email = document.getElementById("email").value;
var btnSubmit = document.getElementById("submit_button");
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false}
btnSubmit.value = 'Uploading...';
btnSubmit.disabled = true;
}
function uploadPhoto(){
var btnSubmit = document.getElementById("submit_button");
btnSubmit.value = 'Uploading...';
btnSubmit.disabled = true;
}
function sendPM(){
var btnSubmit = document.getElementById("submit_button");
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function VideoInfo(){
var video_title = document.getElementById("video_title").value;
var video_desc = document.getElementById("video_desc").value;
var video_tags = document.getElementById("video_tags").value;
var btnSubmit = document.getElementById("update_video_info");
if (video_title == ""){
alert("Please check the video title.");
document.getElementById("video_title").focus();
return false;
}
if (video_desc == ""){
alert("Please enter description for this video");
document.getElementById("video_desc").focus();
return false;
}
if (video_tags == ""){
alert("Please enter at least one tag/ keyword for this video");
document.getElementById("video_tags").focus();
return false;
}
btnSubmit.value = 'Updating...';
btnSubmit.disabled = true;
}
function showMsg(msg){alert(msg);}
function confirmMsg(msg,divToShow){if(confirm(msg)){if(divToShow!='')ShowDivById(divToShow);return true;}else{return false;}}
function CommentCh(){
var comment = document.getElementById("comment").value;
var btnSubmit = document.getElementById("submit_button");
if (comment == ""){
alert("Please check the comment.");
document.getElementById("comment").focus();
return false;
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function Announcements(){
var announcement = document.getElementById("announcement").value;
var btnSubmit = document.getElementById("submit_button");
if (announcement == "<br>"){
alert("Please enter your announcement.");
document.getElementById("announcement").focus();
return false;
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function createAlbum(){
var album_name = document.getElementById("album_name").value;
var album_desc = document.getElementById("album_desc").value;
var btnSubmit = document.getElementById("submit_button");
if (album_name == ""){
alert("Please enter the name of your new album !");
document.getElementById("album_name").focus();
return false;
}
if (album_desc == ""){
alert("Please enter the description of your new album !");
document.getElementById("album_desc").focus();
return false;
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function PhotoInfo(){
var photo_title = document.getElementById("photo_title").value;
var photo_desc = document.getElementById("photo_desc").value;
var photo_tags = document.getElementById("photo_tags").value;
var btnSubmit = document.getElementById("update_photo_info");
if (photo_title == ""){
alert("Please check the photo title.");
document.getElementById("photo_title").focus();
return false;
}
if (photo_desc == ""){
alert("Please enter description for this photo");
document.getElementById("photo_desc").focus();
return false;
}
if (photo_tags == ""){
alert("Please enter at least one tag/ keyword for this photo");
document.getElementById("photo_tags").focus();
return false;
}
btnSubmit.value = 'Updating...';
btnSubmit.disabled = true;
}
function sendPhoto(){
var youremail = document.getElementById("youremail").value;
var Email = document.getElementById("Email").value;
var message = document.getElementById("message").value;
var btnSubmit = document.getElementById("submit_button");
if (Email==""){
alert("Enter one e-mail address at least !!")
document.getElementById("Email").focus();
return false
}
if (message==""){
alert("Enter a message !!")
document.getElementById("message").focus();
return false
}
if (youremail.indexOf('@', 0) == -1 || youremail.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
if (Email.indexOf('@', 0) == -1 || Email.indexOf('.', 0) == -1){ 
alert("No valid e-mail address!");
document.getElementById("Email").focus();
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function PhotoComment(){
var header = document.getElementById("header").value;
var commentphoto = document.getElementById("commentphoto").value;
var btnSubmit = document.getElementById("submit_button");
if (header==""){
alert("Enter The Tittle of Your Comment !!")
return false
}
if (commentphoto==""){
alert("Please check the comment!")
document.getElementById("commentphoto").focus();
return false
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function PhotoReplay(id){
var replaycomment = document.getElementById('replaycomment_'+id+'').value;
var email = document.getElementById("email").value;
var btnSubmit = document.getElementById('submit_replay_'+id+'');
if (replaycomment==""){
alert("Please check the comment!")
document.getElementById('replaycomment_'+id+'').focus();
return false
}
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
btnSubmit.value = 'Saving...';
btnSubmit.disabled = true;
}
function sendEcard(){
var youremail = document.getElementById("your-email").value;
var Email = document.getElementById("friends-emails").value;
var message = document.getElementById("friends-message").value;
var btnSubmit = document.getElementById("submit_ecard");
if (Email==""){
alert("Enter one e-mail address at least !!")
document.getElementById("friends-emails").focus();
return false
}
if (message==""){
alert("Enter a message !!")
document.getElementById("friends-message").focus();
return false
}
if (youremail.indexOf('@', 0) == -1 || youremail.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
document.getElementById("your-email").focus();
return false
}
if (Email.indexOf('@', 0) == -1 || Email.indexOf('.', 0) == -1){ 
alert("No valid e-mail address!");
document.getElementById("friends-emails").focus();
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function reportPhoto(){
var email = document.getElementById("email-report").value;
var message = document.getElementById("message-report").value;
var btnSubmit = document.getElementById("submit-photo-report");
if (email==""){
alert("Enter your e-mail address !!")
return false
}
if (message==""){
alert("Explain the problem...Entering your reasons !!")
return false
}
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please update your profile entering your real e-mail");
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function uploadPhoto(){
var btnSubmit = document.getElementById("submit_button");
btnSubmit.value = 'Uploading...';
btnSubmit.disabled = true;
}
function shareChannel(){
var Email = document.getElementById("Email").value;
var message = document.getElementById("message").value;
var btnSubmit = document.getElementById("submit_button");
if (Email==""){
alert("Enter one e-mail address at least !!")
return false
}
if (Email.indexOf('@', 0) == -1 || Email.indexOf('.', 0) == -1){ 
alert("No Valid E-Mail Address! Please enter a valid e-mail address");
document.getElementById("Email").focus();
return false
}
if (message==""){
alert("Please check the message.")
document.getElementById("message").focus();
return false
}
btnSubmit.value = 'Sending...';
btnSubmit.disabled = true;
}
function AddToFavorites(iLink,iType) {
var favelement = document.getElementById('favouriteLink');
favelement.innerHTML = "<img src='/img3/loading.gif'>";
favelement.style.display = 'block';
var fav = document.getElementById('favouriteLink');
fav.style.display = 'block';
fav.innerHTML = '<br /><div class="podreport">This video has been added to your favourites.</div>';
try {
http.open('GET', '/realmovies/add_to_fav.asp?iLink='+iLink+'&iType='+iType);
window.setInterval("document.getElementById('favouriteLink').style.display='none'",3000);
http.onreadystatechange = updateFavorites;
http.send(null);
}
catch(e){}
finally{}
}
function updateFavorites() {
try{
if((http.readyState == 4)&& (http.status == 200)){
var response = http.responseText;}
}
catch(e){alert("Error adding to favorites.<br>Please try again later.");}
finally{}
}
function Subscribe(username,un) {
var subelement = document.getElementById('subscribeMessage');
subelement.innerHTML = "<img src='/img3/loadingemail.gif'> Loading...";
subelement.style.display = 'block';
var sub = document.getElementById('subscribeMessage');
var subdiv = document.getElementById('subscribeDiv');
var unsubdiv = document.getElementById('unsubscribeDiv');
sub.style.display = 'block';
sub.innerHTML = '<div class="podreport">Your subscription to '+un+' has been added.</div>';
subdiv.style.display = 'none';
unsubdiv.style.display = 'inline';
try {
http.open('GET', '/login/subscribe.asp?username='+username+'&un='+un);
window.setInterval("document.getElementById('subscribeMessage').style.display='none'",3000);
http.onreadystatechange = updateSubscribe;
http.send(null);
}
catch(e){}
finally{}
}
function updateSubscribe() {
try{
if((http.readyState == 4)&& (http.status == 200)){
var response = http.responseText;}
}
catch(e){alert("Error while processing your request.<br>Please try again later.");}
finally{}
}
function UnSubscribe(username,un) {
var unsubelement = document.getElementById('unsubscribeMessage');
unsubelement.innerHTML = "<img src='/img3/loadingemail.gif'> Loading...";
unsubelement.style.display = 'block';
var unsub = document.getElementById('unsubscribeMessage');
var subdiv = document.getElementById('subscribeDiv');
var unsubdiv = document.getElementById('unsubscribeDiv');
unsub.style.display = 'block';
unsub.innerHTML = '<div class="podreport">You have successfully unsubscribed to '+un+' channel.</div>';
subdiv.style.display = 'inline';
unsubdiv.style.display = 'none';
try {
http.open('GET', '/login/unsubscribe.asp?username='+username+'&un='+un);
window.setInterval("document.getElementById('unsubscribeMessage').style.display='none'",3000);
http.onreadystatechange = updateUnSubscribe;
http.send(null);
}
catch(e){}
finally{}
}
function updateUnSubscribe() {
try{
if((http.readyState == 4)&& (http.status == 200)){
var response = http.responseText;}
}
catch(e){alert("Error while processing your request.<br>Please try again later.");}
finally{}
}
 
if (typeof Scl == "undefined")
{
    var Scl = {};
}

(function()
{
    Scl.MenuItem = function(text, link, cssClass)
    {
        this.text = text;
        this.link = link;
        this.cssClass = cssClass;
    };

	Scl.Menu = function(menuWidth)
	{
	    var instance = this;
	    var menuDiv;
	    var menuItems = new Array();
	    var dockElement;
	    var left = 0;
	    var top = 0;
	    var width = menuWidth ? menuWidth : 200;
	    var height = 0;
	    var hideThread;
	    var fullVisible = false;
	    var animationThread;
	    var animationStart = 0;
	    var animationEnd = 0;
	    var ANIMATION_NONE = 0;
	    var ANIMATION_VERTICAL = 1;
	    this.animationType = ANIMATION_VERTICAL;
	    this.animationSpeed = 20;
	    this.animationStep = 15;
	    this.margin = 5;
	    this.menuCssClass = 'hpmenu';
	    this.menuItemCssClass = 'hpmenuItem';
	    this.rightToLeft = false;
	    this.bottomToTop = false;
	    this.hideTimeOut = 120;

		this.addItem = function(text, link, cssClass)
		{
		    menuItems.push(new Scl.MenuItem(text, link, cssClass));
		};

		this.dockTo = function(element)
		{
	        addEvent(window, 'load', function(){ dockToElement(element); }, false);
		};

		this.showAt = function(element)
		{
		    initialize();

	        var position = getPosition(element);
	        position.y += (instance.bottomToTop) ? (height + instance.margin) * -1 : instance.margin + element.offsetHeight;

	        show(position.x, position.y);
		};

		this.showAtPosition = function(x, y)
		{
		    initialize();
		    show(x, y);
		};

		this.hide = function()
		{
		    hideThread = setTimeout(hideMenu, instance.hideTimeOut);
		};

		function dockToElement(element)
		{
		    if(typeof(element) == 'string')
            {
                element = document.getElementById(element);
            }

            dockElement = element;
	        addEvent(element, 'mouseover', showAtDockElement, false);
	        addEvent(element, 'mouseout', instance.hide, false);
		};

		function showAtDockElement()
		{
	        instance.showAt(dockElement);
		};

		function initialize()
		{
		    if(menuDiv == null)
		    {
		        createMenu();
		    }
		};

		function show(x, y)
		{
		    cancelHide();

	        menuDiv.style.left = x + 'px';
	        menuDiv.style.top = y + 'px';

	        // Asignar para la animacion
	        left = x;
	        top = y;

	        switch(instance.animationType)
	        {
	            case ANIMATION_NONE:
		            menuDiv.style.display = 'block';
		            break;

	            default:
		            startAnimation(0, height);
		            break;
	        }
		};

		function createMenu()
	    {
            menuDiv = document.createElement('div');
            menuDiv.style.position = 'absolute';

	        var innerDiv = document.createElement('div');
            menuDiv.appendChild(innerDiv);

            innerDiv.className = instance.menuCssClass;
            innerDiv.style.width = width + 'px';

	        addEvent(menuDiv, 'mouseover', cancelHide, false);
	        addEvent(menuDiv, 'mouseout', instance.hide, false);

	        // Add items
	        for(var i=0; i< menuItems.length; i++)
	        {
	            var menuItemDiv = createMenuItem(menuItems[i]);
                innerDiv.appendChild(menuItemDiv);
	        }

	        // Add to the document
            document.body.appendChild(menuDiv);

	        height = menuDiv.offsetHeight;
		};

		function createMenuItem(menuItem)
	    {
            var menuItemDiv = document.createElement('div');
            menuItemDiv.className = menuItem.cssClass != null ? menuItem.cssClass : instance.menuItemCssClass;

            if(menuItem.link != null)
            {
                menuItemDiv.link = menuItem.link; // Crear la propiedad con el link para cada elemento
                menuItemDiv.onclick = function(){ window.location = menuItem.link; };
                var link = document.createElement('a');
                link.setAttribute('href', menuItem.link);
                link.appendChild(document.createTextNode(menuItem.text));
                menuItemDiv.appendChild(link);
            }

            return menuItemDiv;
		};

		function cancelHide()
		{
		    clearTimeout(hideThread);
		    hideThread = null;
		};

		function hideMenu()
		{
		    switch(instance.animationType)
	        {
	            case ANIMATION_NONE:
		            menuDiv.style.display = 'none';
		            break;

	            default:
		            startAnimation(parseStyle(menuDiv.style.height), 0);
		            break;
	        }
		};

		function parseStyle(value)
		{
		    return parseInt(value.substring(0, value.length-2));
		};

		function getPosition(element)
        {
            var posx = 0;
            var posy = 0;

            if (element.offsetParent)
            {
                do
                {
                    posx += element.offsetLeft;
                    posy += element.offsetTop;

                    if (!element.offsetParent)
                    {
                         break;
                    }
                }
                while (element = element.offsetParent)
            }
            else if (element.x)
            {
                posx += element.x;
                posy += element.y;
            }

            return {x:posx, y:posy};
        };

        function addEvent(element, evType, functionName, useCapture)
        {
            if(element.addEventListener)
            {
                element.addEventListener(evType, functionName, useCapture);
            }
            else if(element.attachEvent)
            {
                element.attachEvent('on' + evType , functionName);
            }
            else
            {
                element['on' + evType] = functionName;
            }
        };

		function startAnimation(start, end)
		{
            var showing = end > start;

		    if(showing & fullVisible)
		    {
		        return;
		    }

		    menuDiv.style.zIndex = showing ? 20 : 1;

		    animationStart = start;
		    animationEnd = end;
	        menuDiv.style.overflow = 'hidden';
		    menuDiv.style.display = 'block';
	        menuDiv.style.height = animationStart + 'px';

	        fullVisible = false;

	        clearInterval(animationThread);

            switch(instance.animationType)
	        {
	            case ANIMATION_VERTICAL:
	                if(instance.bottomToTop)
                    {
	                    menuDiv.style.top = (top + height - menuDiv.offsetHeight) + 'px';
	                }
	                animationThread = setInterval(animateVertical, instance.animationSpeed);
		            break;
	        }
		};

        function animateVertical()
        {
            var showing = animationEnd > animationStart;

            var strHeight = menuDiv.style.height;
            var animationHeight = parseInt(strHeight.substring(0, strHeight.length-2));

            if((showing & animationHeight >= animationEnd) || (!showing & animationHeight <= animationEnd))
            {
                clearInterval(animationThread);

		        if(showing)
		        {
		            fullVisible = true;
		        }
		        else
		        {
		            menuDiv.style.display = 'none';
		        }
            }
            else
            {
                animationHeight += showing ? instance.animationStep : -instance.animationStep;

                if((showing & animationHeight > animationEnd) || (!showing & animationHeight < animationEnd))
                {
                    animationHeight = animationEnd;
                }

                menuDiv.style.height = animationHeight + 'px';

                if(instance.bottomToTop)
                {
                    menuDiv.style.top = (top + height - animationHeight) + 'px';
                }
            }
        };
	};
})();

var ns6=document.getElementById&&!document.all
function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}
function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}
function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='Remaining character count: <b><span id="'+theform.toString()+'">'+thelimit+'</span></b>'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}
function CheckBox(BoxName){
if(BoxName.checked == false)  {
confirm("Are you sure that you want to remove this section from your channel ?");
return true;}
}

function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}