﻿// JScript File

function PrintArticle()
{
	//window.open('printerfriendly.aspx?m=' + _currentMenuId + '&amid=' + _currentMainId,"");
	window.open('/PrinterFriendly.aspx','PrintArticle','scrollbars=yes, toolbar=no,resizable=no,width=600, height=500');
}

function ShowChild(e)
		{
			var container = document.getElementById(e); 
		
			if (container.style.display == 'none')
			{
				container.style.display = 'block';	
			}
			else
			{
				container.style.display = 'none';			
			}
		}

// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function ValidateFaqSearchBox(id) {

    var m = document.getElementById(id).value;
    //var button = id.substr(0,id.length)

    if (trim(m).length < 3) {
        alert("Please Type atleast 3 letters to search");
        return false;
    }

    return true;
}
function ValidateSearchBox(id)
            {
            
		        var m = document.getElementById(id).value;
		        //var button = id.substr(0,id.length)
		      
		        if(trim(m).length< 3)
		        {
			        alert("Please type at least 3 characters to search"); 
			        return false;
		        }
		        else if (m.search(/^[\w+áàäçéèêñóòôöüæøåÅØÆ ]+( \w[áàäçéèêñóòôöüæøåÅØÆ ]+)?$/) == -1)
		        {
			        alert("Special characters not allowed"); 
			        return false;
		        }
    	
	              return true;
          }
	        function dmTrySubmit(e,buttonid)	
        {			
	        var bt = document.getElementById(buttonid); 
	        if (typeof bt == 'object')
	        { 
		        if(navigator.appName.indexOf("Netscape")>(-1))
		        { 
			        if (e.keyCode == 13)
			        { 
									        //e.keyCode = 0;
				        e.returnValue = false;
				        e.cancelBubble = true;
				        if (e.stopPropagation) 
					        e.stopPropagation(); // moz					
				        bt.click();
				        return false; 
			        } 
		        } 
		        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
		        { 
			        if (event.keyCode == 13)
			        { 
        				
				        e.keyCode = 0;
				        e.returnValue = false;
				        e.cancelBubble = true;
				        bt.click();
				        return false;
			        } 
		        } 
	        }
        }     
