
function hideShowCont(imgObj,indexId){
	var contId=indexId;
	var minusImg="../images/blue_arrow_down2.gif";
	var plusImg="../images/blue_arrow_left.gif";
	var contObj=document.getElementById(contId);
	if(contObj.style.display=='' || contObj.style.display=='block') {
	contObj.style.display='none'; imgObj.src=plusImg;
	} else {
	 contObj.style.display='block'; imgObj.src=minusImg;
	}

}

function homepage_1()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/new_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_hover_06.jpg'
document.getElementById('hometab3').src='../../../eDaman/en/images/new_08.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/new_09.gif'
document.getElementById('ban1').style.display='block'
document.getElementById('ban2').style.display='none'
document.getElementById('ban3').style.display='none'
document.getElementById('ban4').style.display='none'
}
function homepage_2()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/tab_hover_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_normal_06.jpg'
document.getElementById('hometab3').src='../../../eDaman/en/images/new_08.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/new_09.gif'
document.getElementById('ban2').style.display='block'
document.getElementById('ban1').style.display='none'
document.getElementById('ban3').style.display='none'
document.getElementById('ban4').style.display='none'
}
function homepage_3()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/new_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_normal_06.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/new_09.gif'
document.getElementById('hometab3').src='../../../eDaman/en/images/tab_hover_08.jpg'
document.getElementById('ban2').style.display='none'
document.getElementById('ban1').style.display='none'
document.getElementById('ban3').style.display='block'
document.getElementById('ban4').style.display='none'
}

function homepage_4()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/new_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_normal_06.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/tab_hover_09.gif'
document.getElementById('hometab3').src='../../../eDaman/en/images/new_08.jpg'
document.getElementById('ban2').style.display='none'
document.getElementById('ban1').style.display='none'
document.getElementById('ban3').style.display='none'
document.getElementById('ban4').style.display='block'
}

function load_parent()
{
window.location.href="renew_or_upgrade.html";
}

function renew_or_upgrade()
{
window.location.href="renew_or_upgrade.html";
}
function Member_endorsement()
{
window.location.href="Member_endorsement.html";
}
function show_renew(frm)
{
result = window.showModalDialog("sample_popup.html",frm,"dialogWidth:310px; dialogHeight:300px; center:yes");

}
function advsearchresult_reg()
{
window.location.href="Advanced_search_provider_result_Reg.html";
}

function parseCheckMessage(message) {

	var a = document.getElementById("auth");
	var div3 = document.getElementById("signInDivRenewal");
	var div4 = document.getElementById("signOutDivRenewal");
	var endorDivIn =document.getElementById("endorseOutDiv");
	var endorDivOut =document.getElementById("endorseInDiv");
	if(message=='true'){
		document.getElementById('tab7').href = "/eDamanApp/j_acegi_logout"
		a.style.backgroundPosition = "-817px -72px";
		document.getElementById('tab7').style.backgroundPosition = "-817px -72px";
		document.getElementById('tab7').style.cursor = "pointer";
		document.getElementById('tab7').onmouseover = function(){document.getElementById('tab7').style.backgroundPosition = "-817px -108px";};
		document.getElementById('tab7').onmouseout = function(){document.getElementById('tab7').style.backgroundPosition = "-817px -72px";};
		if(div3 != null || div4 != null){
		div3.style.display='block';
		div4.style.display='none';
		}
		if(endorDivIn != null || endorDivOut != null){
			endorDivIn.style.display='block';
			endorDivOut.style.display='none';
		}	
	}
	else{
		document.getElementById('tab7').href = "/eDamanApp/loadMyPortalPage.action?request_locale=en";
		a.style.backgroundPosition = "-817px 0px";
		document.getElementById('tab7').style.backgroundPosition = "-817px 0px";
		document.getElementById('tab7').onmouseover = function(){document.getElementById('tab7').style.backgroundPosition = "-817px -36px";};
		document.getElementById('tab7').onmouseout = function(){document.getElementById('tab7').style.backgroundPosition = "-817px 0px";};
		if(div3 != null || div4 != null){
		div3.style.display='none';
		div4.style.display='block';
		}
		if(endorDivIn != null || endorDivOut != null ){
				endorDivIn.style.display='none';
				endorDivOut.style.display='block';
		} 
	}

   }

function parseCheckPolicyMessage(message)
{
	var planTypeId = document.getElementById("planTypeId");
	if (planTypeId) {
	var goButton = document.getElementById("xButton2");
	if(message=='true'){
		planTypeId.style.display='none';
		goButton.style.display='';
		document.getElementById("providerSpaceBox").style.verticalAlign = "middle";	}
	else
	{
		planTypeId.style.display='';
		goButton.style.display='none';
		document.getElementById("providerSpaceBox").style.verticalAlign = "bottom";
	}
	}
}

function parseMessage(message) {
    var listDiv = document.getElementById("networkList");
     try{
	    if(message != null && listDiv != null) {
	      listDiv.style.display='block';
	      listDiv.innerHTML = message; 
	    }
	
	   listDiv = document.getElementById("networkList");
	   var errorCheck = listDiv.innerHTML;
	  
	   if(errorCheck.indexOf("is not available") != -1 || errorCheck.indexOf("Error reading resource from path") != -1 || errorCheck.indexOf("Service Temporarily") != -1)
	     listDiv.style.display='none';
   } catch(err) {}

}

//document.links[pos].href = document.addresses.list[sel].value;
function switchEnglishArabic() {
  var currentURL = window.location.href;
  if(currentURL.indexOf("news_april28_2008.html")!= -1 || currentURL.indexOf("news_april15_2008.html")!= -1 
  	|| currentURL.indexOf("news_april1_2008.html")!= -1 || currentURL.indexOf("news_archieve.html")!= -1 
  	|| currentURL.indexOf("events.html?div=MediaEvent&subdiv=submenu12")!= -1 
  	|| currentURL.indexOf("site_map.html")!= -1 || currentURL.indexOf("FAQ.html")!= -1 
  	|| currentURL.indexOf("glossary.html")!= -1 || currentURL.indexOf("Plans/Global_Exclusion.html")!= -1 
  	|| currentURL.indexOf("Plans/International_Exclusion.html")!= -1 || currentURL.indexOf("Plans/Regional_Exclusion.html")!= -1 
  	|| currentURL.indexOf("Plans/UAE_Exclusion.html")!= -1 || currentURL.indexOf("Plans/Abu_Dhabi_Exclusion.html")!= -1 
  	|| currentURL.indexOf("Plans/Visitor_Exclusion.html")!= -1 || currentURL.indexOf("termsconditions.html")!= -1 
  	|| currentURL.indexOf("ProcurementFacilities.html")!= -1 || currentURL.indexOf("virtual_assistant.html")!= -1
  	|| currentURL.indexOf("memberBenefits.html")!= -1 || currentURL.indexOf("EuropAssistance.html")!= -1 || currentURL.indexOf("VIPmedalmeda.html")!= -1){
  location.href = "#" ;
  }
 else{
	  if(currentURL.indexOf(".action") == -1 && currentURL.indexOf(".jsp") == -1) {
	     var newURL = currentURL.replace("/en/","/ar/");
	     location.href = newURL;
	
	  } else if(currentURL.indexOf(".action") != -1 || currentURL.indexOf(".jsp") != -1) {
	    switchURL(currentURL)
	  } 
   }
}

function switchURL(currentURL) {
    if(currentURL.indexOf("?") == -1) {
                var newURL = currentURL+"?request_locale=ar";    
                location.href = newURL;
     }else if(currentURL.indexOf("?") != -1 && currentURL.indexOf("request_locale=") == -1)      {
                var newURL = currentURL+"&&request_locale=ar";    
                location.href = newURL;
     }else if(currentURL.indexOf("?") != -1 && currentURL.indexOf("request_locale=") != -1)      {
        var newURL = currentURL.replace("request_locale=en","request_locale=ar");
        location.href = newURL;
     }     
}

function search(query,url) {
  document.googleSearch.action = url;
  document.googleSearch.submit();
}

function loadStaticCheck() {
	ahrefs = document.getElementsByTagName("a");  
	for (i = 0; i < ahrefs.length; i++) {
	    if( (ahrefs[i].id) == "bookmark") {
	      ahrefs[i].href = ahrefs[i].href+"?bookmark="+ahrefs [i].name+"#"+ahrefs [i].name;
	      }
	}
}
function loadSearchCheck() {
	 if(document.getElementById('damanQuery')!=null) {
		 document.getElementById('googleSearchCriteria').value = document.getElementById('damanQuery').value;
	}
}


function highlightMenuItem(){
	var menuItem=document.getElementById('MenuItem');
	var tab6 = document.getElementById('tab6');
	var tab3 = document.getElementById('tab3');
	var tab5 = document.getElementById('tab5');
	var tab2 = document.getElementById('tab2');
	var tab0 = document.getElementById('tab0');
	var tab1 = document.getElementById('tab1');
	var tab4 = document.getElementById('tab4');
	var tab7 = document.getElementById('tab7');
	if (menuItem != null && (menuItem.value=='TITLE_CALLBACK'||menuItem.value=='TITLE_FEEDBACK'||menuItem.value=='TITLE_SPONSORSHIP_REQUEST_CONTACT_US'||menuItem.value=='TITLE_LARGE_GROUP_QUOTE' || menuItem.value== 'TITLE_PROCUREMENT_FACILITIES')){ 
		tab6.style.backgroundPosition = "-632px -72px";
		tab6.style.cursor = "default";
	}else if(menuItem != null && ( menuItem.value=='TITLE_PREMIUM_CALCULATOR' || menuItem.value.indexOf("QUOTE")!=-1)){
		tab3.style.backgroundPosition = "-266px -72px";
		tab3.style.cursor = "default";
	}else if (menuItem != null && (menuItem.value.indexOf("PROFILE")!=-1||menuItem.value=='TITLE_PROVIDER_SEARCH' || menuItem.value=='PROVIDER_RATING_TITLE') ){
		tab5.style.backgroundPosition = "-487px -72px";
		tab5.style.cursor = "default";
	}else if(menuItem != null && menuItem.value=='TITLE_SPONSORSHIP_REQUEST_ABOUT_US'){
		tab2.style.backgroundPosition = "-178px -72px";
		tab2.style.cursor = "default";
	}else if(menuItem != null && menuItem.value=='TITLE_SEARCH'){
	    document.getElementById('nav_search').style.paddingLeft = '4px';
		document.getElementById('start').style.backgroundPosition = "0px 0px";
		tab0.style.backgroundPosition = "-15px 0px";
		tab0.onmouseover = function(){tab0.style.backgroundPosition = "-15px -36px";};
		tab0.onmouseout = function(){tab0.style.backgroundPosition = "-15px 0px";};
		tab1.style.backgroundPosition = "-80px 0px";
		tab1.onmouseover = function(){tab1.style.backgroundPosition = "-80px -36px";};
		tab1.onmouseout = function(){tab1.style.backgroundPosition = "-80px 0px";};
		tab2.style.backgroundPosition = "-178px 0px";
		tab2.onmouseover = function(){tab2.style.backgroundPosition = "-178px -36px";};
		tab2.onmouseout = function(){tab2.style.backgroundPosition = "-178px 0px";};
		tab3.style.backgroundPosition = "-266px 0px";
		tab3.onmouseover = function(){tab3.style.backgroundPosition = "-266px -36px";};
		tab3.onmouseout = function(){tab3.style.backgroundPosition = "-266px 0px";};
		tab4.style.backgroundPosition = "-353px 0px";
		tab4.onmouseover = function(){tab4.style.backgroundPosition = "-353px -36px";};
		tab4.onmouseout = function(){tab4.style.backgroundPosition = "-353px 0px";};
		tab5.style.backgroundPosition = "-487px 0px";
		tab5.onmouseover = function(){tab5.style.backgroundPosition = "-487px -36px";};
		tab5.onmouseout = function(){tab5.style.backgroundPosition = "-487px 0px";};
		tab6.style.backgroundPosition = "-632px 0px";
		tab6.onmouseover = function(){tab6.style.backgroundPosition = "-632px -36px";};
		tab6.onmouseout = function(){tab6.style.backgroundPosition = "-632px 0px";};
		document.getElementById('blank').style.backgroundPosition = "-732px 0px";
		authenticate();
		document.getElementById('arabic').style.backgroundPosition = "-904px 0px";
	}else if (menuItem != null && menuItem.value=='TITLE_RAMDAN_FORM') {
		tab4.style.backgroundPosition = "-353px -72px";
		tab4.style.cursor = "default";
	}else if (null != document.getElementById('tab1')) {
		tab1.style.backgroundPosition = "-80px -72px";
		tab1.style.cursor = "default"; 
	}
	else{
			tab1.style.backgroundPosition = "-835px -72px";
		  	tab1.style.cursor = "default";
	}

}

function damanHome()
{
window.location.href="/eDamanApp/loadMyPortalPage.action?request_locale=en";
}

function resizeDivBtns(){
	divObj=document.getElementsByTagName("DIV");
	for(i=0;i<divObj.length;i++) {
		divClass=divObj[i].className;
		if(divClass=="buttonalt"){
			resizeBtnDiv(divObj[i]);			
		}
		
	}
	
}

function resizeBtnDiv(vdivObj){
  var totalWidth = 0;
  for (j=0; j<vdivObj.childNodes.length; j++) {
  divItem = vdivObj.childNodes[j];
  if (divItem.nodeName=="DIV") {
     totalWidth+= divItem.offsetWidth;
			/* Changing Style Dynamically for RTL STARTS */
			if(document.body.dir!=''){
				if(document.body.dir.toUpperCase()=='RTL'){	
					if(j==0){
					vdivObj.childNodes[0].className='btnalt_ArabicLeft';
					vdivObj.childNodes[2].className='btnalt_ArabicRight';
					}
				}
			}

			/* Changing Style Dynamically for RTL ENDS */
   }
  }
  vdivObj.style.width = totalWidth;
}

function bodyOnLoadForEnglish() {
resizeDivBtns();
}

function googleSearchHref() {
	searchHref = document.getElementsByTagName("a");  
	for (i = 0; i < searchHref.length; i++) {
	    searchCheck = searchHref[i].href;
		    if(searchCheck.indexOf("search?") != -1) {
		      searchCheck  = searchCheck.replace("search?","search.jsp?");
		      searchHref[i].href = searchCheck;
		    }
	}
}

function opnzoom(win)
 {
window.open(win, 'gallery', 'height=730,width=518,location=0, toolbar=0,titlebar=0,scrollbars=1,resizable=0,menubar=0,status=1');
}

function loadGlossarycheck() {

var hferLinksredefine = document.getElementsByTagName("a");  
	for (i = 0; i < hferLinksredefine .length; i++) {
		var link = hferLinksredefine [i].href;
		if( (hferLinksredefine[i].id) != "bookmark" && link.indexOf("#") != -1 && link.indexOf("Compare_Plans.html") != -1) {
			link = link.replace("Compare_Plans.html","Compare_PlanTypes.html");
			hferLinksredefine[i].href = link;
		}
	
		if(link.indexOf("glossary.html") != -1) {
			link = link.replace("glossary.html","GlossaryClaims.html");
			hferLinksredefine[i].href = link;
		}
	
		if( (hferLinksredefine[i].id) == "bookmark") {
			hferLinksredefine[i].href = hferLinksredefine[i].href+"?bookmark="+hferLinksredefine[i].name+"#"+hferLinksredefine[i].name;
		}
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function switchLocaleTo(){
	var menuItem=document.getElementById('MenuItem');
	var currUrl=window.location.href;
	if(document.getElementById('blockSwitchLocale') != null || document.getElementById('blockBrokerSwitchLocale') != null) {
		return;
	}
	var switchAction = document.getElementById('switchAction');
	if (switchAction != null && switchAction.value != '') {
		currUrl = currUrl.substr(0,currUrl.lastIndexOf("/"))+"/"+switchAction.value;
	}	
	if (currUrl.indexOf("request_locale")==-1)
	{
		if(currUrl.indexOf("?")==-1)
			currUrl=currUrl+"?request_locale=en";
		else
			currUrl=currUrl+"&request_locale=en";
	}
	if (currUrl.indexOf("providerSearchAndMap.action") != -1) {
		currUrl = currUrl.replace(/providerSearchAndMap.action/,"loadProviderSearchPage.action");
	}
	if (currUrl.indexOf("serviceCode") == -1) {
	var serviceCode = document.getElementsByName("serviceCode");
		if (serviceCode.length != 0 && serviceCode[0].value != '') {
			currUrl=currUrl+"&serviceCode="+serviceCode[0].value;
		}	
	}
	if (currUrl.indexOf("baseMember.memberId") == -1) {
		var memberId = document.getElementsByName("baseMember.memberId");
		if (memberId.length != 0 && memberId[0].value != '') {
			currUrl=currUrl+"&baseMember.memberId="+memberId[0].value;
		}	
	}	
	if (currUrl.indexOf("baseMember.number") == -1) {
		var memberNum = document.getElementById("memberNum");
		if (memberNum != null && memberNum.value != '') {
			currUrl=currUrl+"&baseMember.number="+memberNum.value;
		}	
	}		
	if (currUrl.indexOf("newQuote") == -1) {
		var newQuote = document.getElementById("newQuoteId");
		if (newQuote != null && newQuote.value != '') {
			currUrl = currUrl + "&newQuote=" + newQuote.value;
		}	
	}	
	if ((menuItem != null || document.getElementsByName('MenuItem')!=null) 
			&& currUrl.indexOf("Broker")==-1){
		currUrl=currUrl.replace(/request_locale=en/,"request_locale=ar");
	} else {
	return;
	}
	
	window.location.href=currUrl;
}

UTF8 = {
     	encode: function(s){
     		for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
     			s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
     		);
    		return s.join("");
    	},
    	decode: function(s){
    		for(var a, b, i = -1, l = (s = s.split("")).length, o = String.fromCharCode, c = "charCodeAt"; ++i < l;
    			((a = s[i][c](0)) & 0x80) &&
    			(s[i] = (a & 0xfc) == 0xc0 && ((b = s[i + 1][c](0)) & 0xc0) == 0x80 ?
    			o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), s[++i] = "")
    		);
    		return s.join("");
    	}
    };
    
function disableGlossaryLink() {

var hferLinksredefine = document.getElementsByTagName("a");  
	for (i = 0; i < hferLinksredefine .length; i++) {
		var link = hferLinksredefine [i].href;	
		if( (hferLinksredefine[i].id) == "bookmark") {
			hferLinksredefine[i].href = "#";
		}
	}
}
function xonload()
{
document.getElementById('frameWrapper').id = 'frameWrapper2';
document.getElementById('branLocator').style.visibility = 'visible';
}
function hideSpinner() { 
 document.getElementById('spinner').style.display = "none";
}

function loadStaticLink() {
	ahrefs = document.getElementsByTagName("a");  
	for (i = 0; i < ahrefs.length; i++) {
	    if( (ahrefs[i].id) == "HealthGuides" || (ahrefs[i].id) == "MemberBenefits" || (ahrefs[i].id) == "providerDirectory") {
	          ahrefs[i].href = ahrefs[i].href+"?div="+ahrefs [i].id+"&subdiv="+ahrefs [i].name;
	    }
	}
}

function authenticate(){
if (document.getElementById("signinDiv")){
		var tab8 = document.getElementById('tab7');
		tab8.style.backgroundPosition = "-817px 0px";
		tab8.style.cursor = "pointer";
		tab8.onmouseover = function(){tab8.style.backgroundPosition = "-817px -36px";};
		tab8.onmouseout = function(){tab8.style.backgroundPosition = "-817px 0px";};
}else if (document.getElementById("signoutDiv")){
		var tab8 = document.getElementById('tab7');
		tab8.style.backgroundPosition = "-817px -72px";
		tab8.style.cursor = "pointer";
		tab8.onmouseover = function(){tab8.style.backgroundPosition = "-817px -108px";};
		tab8.onmouseout = function(){tab8.style.backgroundPosition = "-817px -72px";};
}
}
function bodyOnLoadForArabic(){
	highlightMenuItem();resizeDivBtns();
}

function downloadJava(){
	window.open("http://www.java.com/en/download/index.jsp","","");
}

/*Provider search and map CR*/
function showResult(){
	document.getElementById('shwResult').value = "displayresult";
	}

//Added for Online virtual assistant CR
//Submit a values to action to send mail.
function shareVideoToFriend(){

var senderName = $('#shareBox input:text')[0].value;
var recipientName = $('#shareBox input:text')[1].value;
var recipientEmail = $('#shareBox input:text')[2].value;

$('#msgDiv')[0].innerHTML = "";
$('#msgDiv').css({
color:	'#ff0000'
});
if(senderName=="" || recipientName=="" || recipientEmail=="") {
$('#msgDiv')[0].innerHTML ="Please enter all fields marked (*)";
return false;
} 

if(validateEmail(recipientEmail)){
	var videoName,videoPath;
	if(navigator.appVersion.indexOf('MSIE')!=-1){
	//alert(document.getElementById('video').contentWindow.document.getElementById('myMovieName').getElementsByTagName('param')[4].value);
	//videoPath = document.getElementById('myMovieName').getElementsByTagName('param')[0].value;
	videoPath = escape(document.getElementById('video').contentWindow.document.getElementById('myMovieName').getElementsByTagName('param')[4].value);
	}
	else{
	//videoPath = document.getElementsByTagName('embed')[0].src;
	videoPath = escape(document.getElementById('video').contentDocument.getElementsByTagName('embed')[0].src); 
	}
	//videoName = escape($('a.fontBold')[0].innerHTML);
	videoName = escape(document.getElementById('video').contentWindow.document.title);

	//videoPath = escape(videoPath.split("/eDamanApp/")[1]);
	
	$('#msgDiv')[0].innerHTML = "<div style='text-align:center;'><img src='/eDamanApp/en/images/lightbox-ico-loading.gif'/></div>";
	
	$.ajax({
		 type: "POST",
		 url: "shareVideoToFriendVA.action",
		 data: "senderName=" + senderName + "&recipientName=" + recipientName + "&recipientEmail=" + recipientEmail + "&videoName=" + videoName + "&videoPath=" + videoPath,
		 success: function(msg){
					 if(msg) {
						$('#msgDiv').css({
							color:	'#009900'
							});
						$('#msgDiv')[0].innerHTML = "Your mail has been sent successfully";
						$('#shareBox input:text').each(
						function(){
							$(this).val('');
						});
					 }
				  },
		 error: function(){ 
					  $('#msgDiv').css({
							color:	'#ff0000'
							});
						$('#msgDiv')[0].innerHTML = "Your mail has not been sent successfully,Please try after sometime";
				  }
	});


} 
else{
	$('#msgDiv')[0].innerHTML ="Please enter a valid E-mail address";
}
}
//Validate a comma separated email
function validateEmail(recipientEmail) {

var pattern=/^[A-Z0-9\._%-]+@[A-Z0-9\.-]+\.[A-Z]{2,4}(?:(?:[,][A-Z0-9\._%-]+@[A-Z0-9\.-]+))?$/i;

var splitStr = recipientEmail.split(",");
var isValidEmail = true;

for(i = 0; i < splitStr.length; i++){
isValidEmail = pattern.test(splitStr[i]);
if(!isValidEmail) {
break;
}
}
if(isValidEmail){         
return true; 
}else{   
return false;
}
}
function askVideo(){

	var askedQuestion = $('#comments').val();
	var topic= $('#topic').val();
	var telNo= $('#telNo').val();
	var email = $('#email').val();
		

		$('#msgDiv')[0].innerHTML = "";
		$('#msgDiv').css({
		color:	'#ff0000'
		});
		if(askedQuestion =="" || topic=="" || telNo=="" || email =="") {
			$('#msgDiv')[0].innerHTML ="Please enter all fields marked (*)";
			return false;
		} 

	if(validateEmail(email)) {
				$.ajax({
					 type: "POST",
					 url: "askForQuestion.action",
					 data: "askedQuestion=" + askedQuestion + "&topic=" + topic + "&telNo=" + telNo + "&email=" + email,
					 success: function(msg){
								 if(msg) {
									$('#msgDiv').css({
										color:	'#009900'
										});
									$('#msgDiv')[0].innerHTML = "Your Request has been sent successfully";
									$('#askBox textarea').each(
									function(){
										$(this).val('');
									});
									$('#askBox input:text').each(
									function(){
										$(this).val('');
									});

								 }
							  },
					 error: function(){ 
								  $('#msgDiv').css({
										color:	'#ff0000'
										});
									$('#msgDiv')[0].innerHTML = "Your mail has not been sent successfully,Please try after sometime";
							  }
				});
			}
			else{
				$('#msgDiv')[0].innerHTML ="Please enter a valid E-mail address";
		 	    }
}

//Added for Online virtual assistant CR End
