function getContextName(){
    return "/communication-durable/"
}
var lastedShowed = null;


function ShowNotification(elem,btnelem,errorelem) {
	  var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	  var hay = true;
	  var telem = document.getElementById(elem);
	  var terrorelem = document.getElementById(errorelem);
    terrorelem.style.display = "none";
    
    var len=document.getElementById("whichRow").value-1;
    var allEmpty=true;	
    for (i = 0; i <= len; i++) {
    	
      if(document.getElementById("emails["+i+"]").value!=''&&document.getElementById("receiverNames["+i+"]").value!=''){
      	
      	if(reg.test(document.getElementById("emails["+i+"]").value) == false){
    		hay=false;
    		allEmpty=false;
    	  break;
    		}else{
    	 hay=true;
    	 allEmpty=false;
       continue;}
    	}
    	else if(document.getElementById("emails["+i+"]").value!=''&&document.getElementById("receiverNames["+i+"]").value=='')
      {
    	hay=false;
    	allEmpty=false;
    	    break;
    	}
    	else if(document.getElementById("emails["+i+"]").value==''&&document.getElementById("receiverNames["+i+"]").value!='')
    		{hay=false;
    			allEmpty=false;
    	    break;
    		}
    	
		}
	  if(allEmpty){
	  	hay=false;
	  	}
    
    if(document.sendToFriendForm.subject.value==''||document.sendToFriendForm.message.value==''){
    	hay=false;
    	}
    if(hay){
    	telem.style.display = "block";}
     
    
    
    var tbtnelem = document.getElementById(btnelem);
    tbtnelem.style.display = "block";
    
    
}
function ShowHideComment(elem,vComment) {
	  
	  var telem = document.getElementById(elem);
    if (telem.style.display == "none" || telem.style.display == "") {
        telem.style.display = "block";
    } else {
        telem.style.display = "none";
    }
    var btComment = document.getElementById(vComment);
    if (btComment.style.display == "none" || btComment.style.display == "") {
        btComment.style.display = "block";
    } else {
        btComment.style.display = "block";
    }
}
function ShowHide(elem) {
	  
	  var telem = document.getElementById(elem);
    if (telem.style.display == "none" || telem.style.display == "") {
        telem.style.display = "block";
    } else {
        telem.style.display = "none";
    }
}

function ShowHide(elem,anotherelem) {
	  
	  var telem = document.getElementById(elem);
    if (telem.style.display == "none" || telem.style.display == "") {
        telem.style.display = "block";
    } else {
        telem.style.display = "none";
    }
    
    if(document.getElementById(anotherelem)){
    var anotelem = document.getElementById(anotherelem);
    if (anotelem.style.display == "none" || anotelem.style.display == "") {
        anotelem.style.display = "none";
    } else {
        anotelem.style.display = "none";
    }
  }
}


function ShowHideForCancel(elem) {
	  var telem = document.getElementById(elem);
    if (telem.style.display == "none" || telem.style.display == "") {
        telem.style.display = "block";
    } else {
        telem.style.display = "none";
    }
}

function active(e)
{
	document.getElementById(e).className='active';
}

function inactive(e)
{
	document.getElementById(e).className='inactive';
}

function MoreLess(elem) {
    var telem = document.getElementById(elem);
    if (telem.style.display == "none" || telem.style.display == "") {
        telem.style.display = "inline";
    } else {
        telem.style.display = "none";
    }
}

function Vis(elem)
{
	document.getElementById(elem).style.visibility = "visible";
}

function UnVis(elem)
{
	document.getElementById(elem).style.visibility = "hidden";
}

function showHideWithOverlay(elem) {
    var telem = document.getElementById(elem);
      if (telem.style.display == "none" || telem.style.display == "") {
         if (lastedShowed != null) {
        	  lastedShowed.style.display = "none";
            lastedShowed = null;
            closeOverlay();
        }
        
        addDivToCloseWithOverlay("");
        showOverlay();
        telem.style.display = "block";
        telem.style.zIndex=999;
        lastedShowed = telem;
    } else {
        telem.style.display = "none";
        closeOverlay();
        lastedShowed = null;
    }
}
//-->
function ShowHideMenu(elem, elem1) {
    var telem = document.getElementById(elem);
    var telem1 = document.getElementById(elem1);
    if (telem.style.display == "none" || telem.style.display == "") {
        telem.style.display = "block";
        telem1.style.display = "none";
    } else {
        telem.style.display = "none";
        telem1.style.display = "block";
    }
}
//-->
function swap_image(daImage, daSrc) {
    var objStr, obj;

  // Check to make sure that images are supported in the DOM.
    if (document.images) {
    // Check to see whether you are using a name, number, or object
        if (typeof (daImage) == "string") {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
            objStr = "document." + daImage;
            obj = eval(objStr);
            obj.src = daSrc;
        } else {
            if ((typeof (daImage) == "object") && daImage && daImage.src) {
                daImage.src = daSrc;
            }
        }
    }
}
//-->
function montre(id) {
    if (document.getElementById) {
        document.getElementById(id).style.display = "block";
    } else {
        if (document.all) {
            document.all[id].style.display = "block";
        } else {
            if (document.layers) {
                document.layers[id].display = "block";
            }
        }
    }
}
function cache(id) {
    if (document.getElementById) {
        document.getElementById(id).style.display = "none";
    } else {
        if (document.all) {
            document.all[id].style.display = "none";
        } else {
            if (document.layers) {
                document.layers[id].display = "none";
            }
        }
    }
}
var submitRolls = new Object();
function submitroll(src, oversrc, name) {
    this.src = src;
    this.oversrc = oversrc;
    this.name = name;
    this.alt = "Submit Query";
    this.write = submitroll_write;
}
function submitroll_write() {
    var thisform = "document.forms[" + (document.forms.length - 1) + "]";
    submitRolls[this.name] = new Object();
    submitRolls[this.name].over = new Image();
    submitRolls[this.name].over.src = this.oversrc;
    submitRolls[this.name].out = new Image();
    submitRolls[this.name].out.src = this.src;
    document.write("<A onMouseOver=\"if (document.images)document.images['" + this.name + "'].src=submitRolls['" + this.name + "'].over.src\"" + " onMouseOut=\"if (document.images)document.images['" + this.name + "'].src=submitRolls['" + this.name + "'].out.src\"" + " HREF=\"javascript:searchListing()\">");
    document.write("<IMG SRC=\"" + this.src + "\" ALT=\"" + this.alt + "\" BORDER=0 ALIGN=MIDDLE NAME=\"" + this.name + "\"");
    if (this.height) {
        document.write(" HEIGHT=" + this.height);
    }
    if (this.width) {
        document.write(" WIDTH=" + this.width);
    }
    if (this.otheratts) {
        document.write(" " + this.otheratts);
    }
    document.write("></A>");
    if (this.sendfield) {
        document.write("<INPUT TYPE=HIDDEN NAME=\"" + this.sendfield + "\">");
        document.forms[document.forms.length - 1].elements[this.sendfield].value = "";
    }
}
function commandRecoverFromError() {
    MM_goToURL("parent", "error.do");
}

function getParameter(param)
{
    str = window.location.toString();
	left = str.indexOf(param+"=") + param.length+1;
	end = str.length;
	substr = str.substring(left, end);
	right = substr.indexOf("&");
	if(right != -1){
	   substr = substr.substring(0, right);
	}
	return(substr);
}
function Age(day, month, year){

	var bday=parseInt(day);
	var bmo=(parseInt(month)-1);
	var byr=parseInt(year);
	var byr;
	var age;
	var now = new Date();
	tday=now.getDate();
	tmo=(now.getMonth());
	tyr=(now.getFullYear());

	if((tmo > bmo)||(tmo==bmo & tday>=bday)){
		age=byr;
	}else{
		age=byr+1;
	}
	return tyr-age;

}

function enableEditBanner(formName){
	eval("var temp = document." + formName + ".bannerLink.disabled");
	alert(temp);
	temp=false;
	
	
	//document.formName.bannerLink.disabled=true;
	//document.formName.bannerAlt.disabled=true;
	//document.formName.bannerImage.disabled=true;
	}
	
	
	function sumbitAndShowLoading(){
	document.contactList.action="/communication-durable/import-abook.do";
	document.contactList.submit();
	}
function ShowLoadingImport(){
			document.getElementById("submitIndicator").style.display = "inline";
			}
			
function submitContacts(){
	document.contactList.action="/communication-durable/import-abook.do";
	document.contactList.submit();
	}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
function submitVideoUpload(locale){
	
	        if(viewTextMode == 1){
	              if(locale=="en"){
	        		  alert ("The description area is in HTML Mode, please switch it to TEXT Mode, otherwise the video cannot be uploaded.");	
	        		  return;}
	        		  if(locale=="fr"){
	        		  alert ("La zone description est en mode HTML, veuillez svp passer en mode TEXT, sinon la vid\351o ne pourra pas \352tre envoy\351e.");	
	        		  return;}
	        		  if(locale=="es"){
	        		  alert ("La zona de descripci\363n est\341 en modo HTML, por favor c\341mbialo al modo TEXT aunque el v\355deo no podr\341 ser enviado.");	
	        		  return;}
	        	} 
	
	        var i=0;
					updateCurrentI18nSelectionContribute();
					var enprogress=false;
					var frprogress=false;
					var esprogress=false;
					
					if(trim($("synopsis[en]").value)=="<br>"){
    	      $("synopsis[en]").value="";
          }
          if(trim($("synopsis[en]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[en]").value="";
    	    }
    	    
    	    if(trim($("synopsis[fr]").value)=="<br>"){
    	      $("synopsis[fr]").value="";
          }
          if(trim($("synopsis[fr]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[fr]").value="";
    	    }
    	    
    	    if(trim($("synopsis[es]").value)=="<br>"){
    	      $("synopsis[es]").value="";
          }
          if(trim($("synopsis[es]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[es]").value="";
    	    }
					
					
					if(trim($("title[en]").value)!=""&&trim($("synopsis[en]").value)!=""&&trim($("words[en]").value)!=""){
						
						enprogress=true;
						}
					 if(trim($("title[en]").value)==""&&trim($("synopsis[en]").value)==""&&trim($("words[en]").value)=="")
					{   
						i=i+1;
						enprogress=true;
												}
												
												
					if(trim($("title[fr]").value)!=""&&trim($("synopsis[fr]").value)!=""&&trim($("words[fr]").value)!=""){
						
						frprogress=true;
						}
					 if(trim($("title[fr]").value)==""&&trim($("synopsis[fr]").value)==""&&trim($("words[fr]").value)=="")
					{  i=i+1;
					   frprogress=true;
												}
												
					if(trim($("title[es]").value)!=""&&trim($("synopsis[es]").value)!=""&&trim($("words[es]").value)!=""){
						
						esprogress=true;
						}
					if(trim($("title[es]").value)==""&&trim($("synopsis[es]").value)==""&&trim($("words[es]").value)=="")
					{ i=i+1;
						esprogress=true;
												}
												//alert(enprogress+"   "+frprogress+"  "+esprogress);
												//alert(i);
					if(i!=3
					&&enprogress&&frprogress&&esprogress
					//&&trim($("title[" + locale + "]").value)!=""
					//&&trim($("synopsis[" + locale + "]").value)!=""
					//&&trim($("words[" + locale + "]").value)!=""
					&&document.insertListingForm.originalVersionId.value!="-1"
					&&document.insertListingForm.videoTopicId.value!="-1"
					&&document.insertListingForm.regionId.value!="-1"
					&&document.insertListingForm.understandText.checked
					&&document.insertListingForm.informationTruthful.checked
					){
						document.insertListingForm.submit();
						startProgress();
						document.location.href='#aTop';
					}else{
						document.insertListingForm.clip.disabled=true;
						document.insertListingForm.submit();
						//startProgress();
						document.location.href='#aTop';
						}
}


function submitVideoUploadForAdmin(locale){
	        var i=0;
					updateCurrentI18nSelectionContribute();
					var enprogress=false;
					var frprogress=false;
					var esprogress=false;
					if(trim($("synopsis[en]").value)=="<br>"){
    	      $("synopsis[en]").value="";
          }
          if(trim($("synopsis[en]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[en]").value="";
    	    }
    	    
    	    if(trim($("synopsis[fr]").value)=="<br>"){
    	      $("synopsis[fr]").value="";
          }
          if(trim($("synopsis[fr]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[fr]").value="";
    	    }
    	    
    	    if(trim($("synopsis[es]").value)=="<br>"){
    	      $("synopsis[es]").value="";
          }
          if(trim($("synopsis[es]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[es]").value="";
    	    }
					
					
					if(trim($("title[en]").value)!=""&&trim($("synopsis[en]").value)!=""&&trim($("words[en]").value)!=""){
						
						enprogress=true;
						}
					 if(trim($("title[en]").value)==""&&trim($("synopsis[en]").value)==""&&trim($("words[en]").value)=="")
					{   
						i=i+1;
						enprogress=true;
												}
												
												
					if(trim($("title[fr]").value)!=""&&trim($("synopsis[fr]").value)!=""&&trim($("words[fr]").value)!=""){
						
						frprogress=true;
						}
					 if(trim($("title[fr]").value)==""&&trim($("synopsis[fr]").value)==""&&trim($("words[fr]").value)=="")
					{  i=i+1;
					   frprogress=true;
												}
												
					if(trim($("title[es]").value)!=""&&trim($("synopsis[es]").value)!=""&&trim($("words[es]").value)!=""){
						
						esprogress=true;
						}
					if(trim($("title[es]").value)==""&&trim($("synopsis[es]").value)==""&&trim($("words[es]").value)=="")
					{ i=i+1;
						esprogress=true;
												}
												//alert(enprogress+"   "+frprogress+"  "+esprogress);
					if(i!=3
					&&enprogress&&frprogress&&esprogress
					//&&trim($("title[" + locale + "]").value)!=""
					//&&trim($("synopsis[" + locale + "]").value)!=""
					//&&trim($("words[" + locale + "]").value)!=""
					&&document.insertListingForm.originalVersionId.value!="-1"
					&&document.insertListingForm.videoTopicId.value!="-1"
					&&document.insertListingForm.regionId.value!="-1"
					
					){
						document.insertListingForm.submit();
						//startProgress();
						document.location.href='#aTop';
					}else{
						document.insertListingForm.clip.disabled=true;
						document.insertListingForm.submit();
						//startProgress();
						document.location.href='#aTop';
						}
}


function submitVideoUploadForContributor(locale){
	        var i=0;
					updateCurrentI18nSelectionContribute();
					var enprogress=false;
					var frprogress=false;
					var esprogress=false;
					if(trim($("synopsis[en]").value)=="<br>"){
    	      $("synopsis[en]").value="";
          }
          if(trim($("synopsis[en]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[en]").value="";
    	    }
    	    
    	    if(trim($("synopsis[fr]").value)=="<br>"){
    	      $("synopsis[fr]").value="";
          }
          if(trim($("synopsis[fr]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[fr]").value="";
    	    }
    	    
    	    if(trim($("synopsis[es]").value)=="<br>"){
    	      $("synopsis[es]").value="";
          }
          if(trim($("synopsis[es]").value)=="<P>&nbsp;</P>"){
    	      $("synopsis[es]").value="";
    	    }
					
					
					if(trim($("title[en]").value)!=""&&trim($("synopsis[en]").value)!=""&&trim($("words[en]").value)!=""){
						
						enprogress=true;
						}
					 if(trim($("title[en]").value)==""&&trim($("synopsis[en]").value)==""&&trim($("words[en]").value)=="")
					{   
						i=i+1;
						enprogress=true;
												}
												
												
					if(trim($("title[fr]").value)!=""&&trim($("synopsis[fr]").value)!=""&&trim($("words[fr]").value)!=""){
						
						frprogress=true;
						}
					 if(trim($("title[fr]").value)==""&&trim($("synopsis[fr]").value)==""&&trim($("words[fr]").value)=="")
					{  i=i+1;
					   frprogress=true;
												}
												
					if(trim($("title[es]").value)!=""&&trim($("synopsis[es]").value)!=""&&trim($("words[es]").value)!=""){
						
						esprogress=true;
						}
					if(trim($("title[es]").value)==""&&trim($("synopsis[es]").value)==""&&trim($("words[es]").value)=="")
					{ i=i+1;
						esprogress=true;
												}
												//alert(enprogress+"   "+frprogress+"  "+esprogress);
					if(i!=3
					&&enprogress&&frprogress&&esprogress
					//&&trim($("title[" + locale + "]").value)!=""
					//&&trim($("synopsis[" + locale + "]").value)!=""
					//&&trim($("words[" + locale + "]").value)!=""
					&&document.insertListingForm.originalVersionId.value!="-1"
					&&document.insertListingForm.videoTopicId.value!="-1"
					&&document.insertListingForm.regionId.value!="-1"
					
					){
						document.insertListingForm.submit();
						//startProgress();
						document.location.href='#aTop';
					}else{
						//document.insertListingForm.clip.disabled=true;
						document.insertListingForm.submit();
						//startProgress();
						document.location.href='#aTop';
						}
}



function ShowLoading(){
			ShowNotification('confirmBox', 'buttonList','errorBox');
			}
/*			
function ShowLoading(){
			document.getElementById("submitIndicator").style.display = "block";
			}
*/
function submitContacts(){
	document.contactList.action="/communication-durable/import-abook.do";
	document.contactList.submit();
	}
function sumbitAndShowLoading(){
			document.getElementById("submitIndicator").style.display = "block";
			document.contactList.submit();
			}
			
			
function loadModifyContact(){
    var slectList = document.getElementById('abooks');
    var len = slectList.length - 1;
	  var hay = false;
    for (i = len; i >= 0; i--) {
        if (slectList.item(i).selected) {
            hay = true;
			document.forms[0].abookId.value = ids[i];
			document.forms[0].email.value = emails[i];
			document.forms[0].fname.value = names[i];
	    }
    }
	if(!hay){
	   alert('You have to select a contact to modify');
	}
}
function loadSelContacts(){

    var slectList = document.getElementById('abooks');
    var len = slectList.length - 1;

    for (i = len; i >= 0; i--) {
        if (slectList.item(i).selected) {
			addRow("child", emails[i], names[i],'${currentLocale}');
		}
	}
}

function confirmDelete(){
		var slectList = document.getElementById('abooks');
  var len = slectList.length - 1;
	var hay = false;
    for (i = len; i >= 0; i--) {
        if (slectList.item(i).selected) {
            hay = true;
			
	    }
    }
	if(!hay){
	   alert('You have to select a contact to delete');
	   vbmenu_close();
	   return;
	}else{
	doPostBack('manageABookForm', 'deleteABookAction');
}
}			
function christmas_popup(){
	window.open("/alternat-docs/html/christmas_popup.html","footerInfo","location=0,menubar=0,status=0,toolbar=0,height=530, width=750, top=150, left=200, scrollbars=1,scrollbars=no",true);	
	}
	
	
function show_chinaeuropa_flash(){
	var bodyElement = "";
	if(navigator.appName.indexOf("Explorer") != -1){
bodyElement = "<a href=\"http://www.china-europa.tv\" target=\'_blank\'><button disabled style=\"width:485px;height:79px;border:none\">"; 
bodyElement += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"485\" height=\"79\"> ";
bodyElement += "<param name=\"movie\" value=\"/alternat-docs/swf/concours-ce.swf\"> ";
bodyElement += "<param name=\"wmode\" value=\"opaque\"> ";
bodyElement += "<param name=\"quality\" value=\"high\"> ";
bodyElement += "<embed src=\"/alternat-docs/swf/concours-ce.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"485\" height=\"79\" wmode=\"Opaque\"></embed> ";
bodyElement += "</object> ";
bodyElement += "</button> ";
bodyElement += "</a>";
             	
  }		

if(navigator.appName.indexOf("Netscape") != -1){
	
	bodyElement ="<a href=\"http://www.china-europa.tv\" target=\'_blank\'><embed id=\"banner\" height=\"79px\" width=\"485px\" wmode=\"opaque\" src=\"/alternat-docs/swf/concours-ce.swf\" /></a>";
	}
document.write(bodyElement);

}


function changeCheckBoxStatus(checkboxObject){
	var varCheckboxObject=document.getElementById(checkboxObject);
	if(varCheckboxObject.checked==true)
	varCheckboxObject.value=true;
	else
	varCheckboxObject.value=false;
	}
	
function getLogoFileName(){
	document.getElementById('logoFileName').value=document.registerMemberForm.logo.value;
	}
function getDefaultLogosValue(radioValue){
	document.getElementById('default_logos').value=radioValue;
	}
function hiddenVerification(){
	UnVis("VerificationUtils");
	UnVis("captchaImage");
	document.getElementById("verification").disabled=true;
	}	

