/*function validateRegister ( ) 
{	
	var loginID 	= 	$('loginID').value;
	var email		=	$('email').value ;
	var confEmail	=	$('confEmail').value;
	var pass1		=	$('password1').value;
	var pass2		=	$('password2').value;
	
	
		
	if( trim(loginID) == '' )
	{
		$('loginIDErr').innerHTML	= '( Please enter loginID )';
		return false;
	}
	else if(trim(email)  == '' )
	{
		$('emailErr').innerHTML = '( Please enter email address )';
		return false;
	}
	else if( !validateEmail(email) )
	{
		$('emailErr').innerHTML = '( Email address is invalid )';
		return false;
	}
	else if(trim(confEmail)  == '' )
	{
		$('confEmailErr').innerHTML = '( Please retype email address )';
		return false;
	}
	else if( !validateEmail(confEmail) )
	{
		$('confEmailErr').innerHTML = '( Confirm Email address is invalid )';
		return false;
	}
	else if ( email != confEmail ) 
	{
		$('confEmailErr').innerHTML = '( Invalid Confirm Email )';
		return false;
	}
	else if( trim (pass1) == '' )
	{
		$('passErr').innerHTML   = '( Please enter your password )';
		return false;
	}
	else if( trim (pass2) == '' )
	{
		$('conPassErr').innerHTML = '( Please enter confirm password )';
		return false;
	}
	else if( trim (pass2) != '' )
	{
		confirmPass( 'conPassErr', pass1, pass2 );
		if( $('conPassErr').innerHTML != '' )
		{
			return false;
		}
	} 
	else
	{
		return true;
	} 
	
	return true;
} */

function validateRegister ( ) 
{	
	var loginID 	= 	$('loginID1').value;
	var email		=	$('email').value ;
	var confEmail	=	$('confEmail').value;
	var pass1		=	$('password1').value;
	var pass2		=	$('password2').value;
	var mpass1		=	$('mpassword1').value;
	var mpass2		=	$('mpassword2').value;
	
		
	if( trim(loginID) == '' )
	{
		alert("Please enter User Name");
		$('loginID1').focus();
		//$('loginIDErr').innerHTML	= '( Please enter loginID )';
		return false;
	}
	else if(trim(email)  == '' )
	{
		alert("Please enter email address");
		$('email').focus();
		//$('emailErr').innerHTML = '( Please enter email address )';
		return false;
	}
	else if( !validateEmail(email) )
	{
		alert("Email address is invalid");
		//$('emailErr').innerHTML = '( Email address is invalid )';
		return false;
	}
	else if(trim(confEmail)  == '' )
	{
		alert(" Please retype email address");
		//$('confEmailErr').innerHTML = '( Please retype email address )';
		return false;
	}
	else if( !validateEmail(confEmail) )
	{
		alert("Confirm Email address is invalid");
		//$('confEmailErr').innerHTML = '( Confirm Email address is invalid )';
		return false;
	}
	else if ( email != confEmail ) 
	{
		alert("Invalid Confirm Email");
		//$('confEmailErr').innerHTML = '( Invalid Confirm Email )';
		return false;
	}
	else if( trim (pass1) == '' )
	{
		alert("Please enter your password");
		//$('passErr').innerHTML   = '( Please enter your password )';
		return false;
	}
	else if( trim (pass2) == '' )
	{
		alert("Please enter confirm password");
		//$('conPassErr').innerHTML = '( Please enter confirm password )';
		return false;
	}
	else if( trim (pass2) != trim (pass1) )
    {
		alert("Password does not match");
		
        //$('conPassErr').innerHTML = 'Password does not match';
        return false;
    }
	else if( trim (mpass1) == '' )
	{
		alert("Please enter member Area password");
	  	//$('mpassErr').innerHTML   = '( Please enter member Area password )';
		return false;
	}
	else if( trim (mpass2) == '' )
	{
		alert("Please enter confirm password");
		//$('mconPassErr').innerHTML = '( Please enter confirm password )';
		return false;
	}
	else if( trim (mpass2) != trim (mpass1) )
    {
		alert("Member area password does not match");
        //$('conPassErr').innerHTML = 'Password does not match';
        return false;
    }
				
	return true;
}

function validateFacility ( ) 
{	
    var facName = 	$('facilityName').value;
	var fac		=	$('facility').selectedIndex;
	var city	=   $('city').value;
	var state	=   $('state').value;
	var zip		=   $('zip').value;
	var location=   $('location').value;
	var county	=   $('county').value;
	var ser		=	$('services2');
    var ser1    =   $('services');
	//alert( ser.options.length );
	if( trim(facName) == '' )
	{
		alert("Please enter facility name");
		//$('facErr').innerHTML	= '( Please enter facility name )';
		return false;
	}
	else if( fac  == '0' )
	{
		alert("Please choose facility type");
		//$('facilityErr').innerHTML   = '( Please choose facility type )';
		return false;
	}
	else if(trim(city) == '')
	{
	 alert("Please enter city");
	 return false;
	}
	else if(trim(state) == '0')
	{
	 alert("Please select state");
	 return false;
	}
	else if(trim(zip) == '')
	{
	 alert("Please enter zip");
	 return false;
	}
	else if(trim(location) == '0')
	{
	 alert("Please select location");
	 return false;
	}
	else if(trim(county) == '')
	{
	 alert("Please enter county");
	 return false;
	}
    else if ( ser1.options.length > 0  || ser.options.length > 0)
    {
	    if( ser.options.length <= 0 )
	    {
			alert("Please choose services");
		    //$('serErr').innerHTML = '( Please choose services )';
		    return false;
	    }
	    else
	    {
		    for( i=0; i<ser.options.length; i++ )
            {
                ser.options[i].selected = true;
            } 
            return true;
	    }
    }
	return true;
}

function validateDoctor( ) 
{	
	var fName 	= 	$('firstName').value;
	var lName	=	$('lastName').value;
	var spec	=	$('speciality1').selectedIndex;
	
	if( trim(fName) == '' )
	{
		alert("Please enter first name");
		//$('fNmErr').innerHTML	= '( Please enter first name )';
		return false;
	}
	else if( trim( lName)  == '' )
	{
		alert("Please enter last name");
		//$('lNmErr').innerHTML   = '( Please enter last name )';
		return false;
	}
	else if( spec  == '0' )
	{
		alert("Please choose speciality");
		//$('specErr').innerHTML = '( Please choose speciality )';
		return false;
	}
	else
	{
		return true;
	}
	return true;
}


function showTab ( url ) 
{	
    //alert(url);
    //url =   url+'date='+Math.random()*11;
    var myAjax = new Ajax.Request( url, {method: 'post', onLoading: tabLoad, onComplete: tabResponse} );
}

function tabLoad () 
{
	//$('tabLoad').style.display = 'block';
	//menuSlider.init('menu','slide');
}
function tabResponse (originalRequest) {
	var	resp	=	originalRequest.responseText;
	var data 	=	resp.split('**');
	var newData =  data[0];
   	$('fNm').value='';
    
	//$('tabLoad').style.display = 'none';
	$('tabDetail').innerHTML = newData;
	$('FID').value	 	=	data[1];	
	$('F_TYPE').value	=	data[2];
    $('ftype').value    =   data[1];
	//alert( data[1] );
	//$('Title').value	=	data[2];
	//alert( $('searchTabs') );
	//alert( $('searchLabel') );
	//alert ( $('tabLabel') );
    //$('searchTabs').innerHTML=  0;
    $('searchTabs').innerHTML=  data[3]; 
    //alert(data[3]);
    $('searchLabel').innerHTML=  data[4];
	$('tabLabel').innerHTML=  data[5];
	//$('notmember').innerHTML=  'FAV';
	//menuSlider.init('menu','slide');
    //alert(document.getElementById('slide').innerHTML);
	
}

/*function mainSearch ( url, frm , member) 
{	
  //alert(url);  return false;
	var pars 	= 	Form.serialize( frm );
	var url		=	url+'?rand='+Math.random()+'&record_type='+member;
	if( frm == 'srForm')
	{
		var str 	= 	$('fNm').value;
		//alert(str);
		if( trim( str ) == '' )
		{
			return false;
		}
	}
	var myAjax 	= 	new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: textSearchLoad, onComplete: textSearchResponse} );
} */
function mainSearch ( url, frm , member, memberid,ftype) 
{	
  //alert(url);  return false;
	var pars 	= 	Form.serialize( frm );
	var	org1		=   '&mid='+memberid+'&type='+ftype;
	var url		=	url+'?rand='+Math.random()+'&record_type='+member+org1;
	//alert(url); return false;
	if( frm == 'srForm')
	{
		var str 	= 	$('fNm').value;
		//alert(str);
		if( trim( str ) == '' )
		{
			return false;
		}
	}
	var myAjax 	= 	new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: textSearchLoad, onComplete: textSearchResponse} );
}

function pagination( url )
{
	var myAjax 	= 	new Ajax.Request( url, {method: 'get', onLoading: textSearchLoad, onComplete: textSearchResponse} );
}

function textSearchLoad () 
{
	$('searchLoad').style.display = 'block';
}

function textSearchResponse (originalRequest) 
{
	var data		=	originalRequest.responseText;
	var data		=	data.split('**');
	var newData 	=	data[0]; 
	if( $('facilityDetail') )
	$('facilityDetail').style.display 	= '';
	$('searchResult').innerHTML         = '';
	$('searchLoad').style.display 		= 'none';
	$('searchResult').innerHTML 		= newData;
	if( data[1] )
	//$('facilityDetail').innerHTML		=	data[1];
	$('searchText').innerHTML	=	data[1];
		
	//alert(data[1] );
}


function dashBoard ( url, frm ) 
{	
  //alert(url);  return false;
	var pars 	= 	Form.serialize( frm );
	var url		=	url+'?rand='+Math.random();
	var myAjax 	= 	new Ajax.Request( url, {method: 'post', parameters: pars, onLoading: dashboardLoad, onComplete: dashboardResponse} );
} 

function dashboardLoad () 
{
	$('searchLoad').style.display = 'block';
}

function dashboardResponse (originalRequest) 
{
	var data		=	originalRequest.responseText;
	var data		=	data.split('**');
	var newData 	=	data[0]; 
	var fType		=   data[1];
	if(fType == 2)
	{
		$('dash_doc').innerHTML 		= '';
		$('dash_doc').innerHTML 		= newData;
	} 
	
	if(fType == 1)
	{
		$('dash_fac').innerHTML 		= '';
		$('dash_fac').innerHTML 		= newData;
	}
	$('searchLoad').style.display 	= 'none';
	
}


function facDetail( url,id )
{
//alert(url);
 var myAjax 	= 	new Ajax.Request( url, {method: 'get', onLoading: detailLoad, onComplete: detailResponse} );
}



function delRecord( url )
{
	if( confirm( 'Are you sure to delete?'))
    {
        var myAjax 	= 	new Ajax.Request( url, {method: 'get', onLoading: detailLoad, onComplete: detailResponse} );	
    }
    else
    {
        return false;
    }
}

function detailLoad()
{
	$('detailLoad').style.display = '';
}


function detailResponse (originalRequest) 
{		
	//alert( originalRequest.responseText);
	var data        =   originalRequest.responseText; 
	var data		=	data.split('*****');
	var newData 	=	data[0]; 
	var  id			=   data[1];
	//alert(id);
	//alert(newData);
	$('detailLoad').style.display 		= 'none';
	$('facilityDetail'+id).innerHTML 		= originalRequest.responseText;
}


function delAdminRecord( url ,trID ,name )
{
    //alert( url );
  if( confirm( 'Are you sure to delete '+name+'?'))
    {
        var myAjax     =     new Ajax.Request( url, {method: 'get', onLoading: detailAdminLoad, onComplete: detailAdminResponse} );  
			
    }
    else
    {
        return false;
    }
    
    function detailAdminLoad()
    {
        //$('searchLoad').style.display = '';
    }


    function detailAdminResponse (originalRequest) 
    {        
        //alert( originalRequest.responseText);
        var theTable;
        theTable    =   (document.all) ? document.all.record : document.getElementById("record");
        //alert(trID);
        var rowLen  =   theTable.rows.length;
        
        theTable.deleteRow( trID );
            
        //$('searchLoad').style.display       = 'none';
        //$('searchResult').innerHTML         = originalRequest.responseText;
        $('delMsg').innerHTML     = '<b>One record has been deleted!</b>';
    }
}


function editDetail( url )
{
	//alert( url );
	var myAjax 	= 	new Ajax.Request( url, {method: 'get', onLoading: editLoad, onComplete: editResponse} );
}

function editLoad()
{
	$('perDetailLoad').style.display = '';
}


function editResponse (originalRequest) 
{		
	//alert( originalRequest.responseText);
	$('perDetailLoad').style.display 	= 'none';
	$('perDetailResult').innerHTML 		= originalRequest.responseText;
}

function changePass( url ,frm )
{
    //alert(url);
    //alert(frm);
	var pass		=	$('pass').value ;
	var newPass		=	$('newPass').value ;
	var confPass	=	$('confNewPass').value ;
	
	if(trim(pass)  == '' )
	{
		alert("Please enter current Password !");
		//$('passErr').innerHTML = '( Please enter current Password !)';
		return false;
	}
	else if( trim(newPass)  == '' )
	{
		alert("Please enter new Password !");
		//$('newPassErr').innerHTML = '( Please enter new Password !)';
		return false;
	}
	else if( trim(confPass)  == '' )
	{
		alert("Please enter new confirm Password !");
		//$('confNewPassErr').innerHTML = '( Please enter new confirm Password !)';
		return false;
	}
	else if( newPass != confPass )
	{
		alert("Confirm Password not match to password !");
		//$('confNewPassErr').innerHTML = '( Confirm Password not match to password ! )';
		return false;
	}
	
		var pars 	= Form.serialize( frm );
		var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onLoading: showPassLoad, onComplete: showPassResponse} );
}


function sendData ( url, frm ) 
{	
   //alert(url);
   //return false;
	var email		=	$('email').value ;
	var loginID 	= 	$('loginID').value;
	//var	loginID		=   $('loginID').value;
	//alert(loginID);
	//var confEmail	=	$('confEmail').value;
	if( trim(loginID) == '' )
	{
		alert("Please enter loginID ");
		//$('loginIDErr').innerHTML	= '( Please enter loginID )';
		return false;
	}
	if(trim(email)  == '' )
	{
		alert("Please enter email address ");
		//$('emailErr').innerHTML = '( Please enter email address )';
		return false;
	}
	else if( !validateEmail(email) )
	{
		alert("Email address is invalid");
		//$('emailErr').innerHTML = '( Email address is invalid )';
		return false;
	}
	/*
	else if(trim(confEmail)  == '' )
	{
		$('confEmailErr').innerHTML = '( Please retype email address )';
		return false;
	}
	else if( !validateEmail(confEmail) )
	{
		$('confEmailErr').innerHTML = '( Confirm Email address is invalid )';
		return false;
	}
	else if ( email != confEmail ) 
	{
		$('confEmailErr').innerHTML = '( Confirm Email doesnot match )';
		return false;
	}
	*/
		var pars 	= Form.serialize( frm );
		var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onLoading: showPassLoad, onComplete: showPassResponse} );
	//return true;
}

function showLoad () 
{
	 $('searchLoad').style.display = ''; 
}
function showResponse (originalRequest) {
	var newData = originalRequest.responseText;
	
	$$('searchLoad').style.display = 'none';
    $('searchResult').innerHTML = newData;
	//alert(newData);
}

function showPassLoad () 
{
    $('perDetailLoad').style.display = '';
}
function showPassResponse (originalRequest) {
    var newData = originalRequest.responseText;
    //alert( newData );
    $('perDetailLoad').style.display = 'none';
    $('perDetailResult').innerHTML = newData;
    
    //alert(newData);
}


function DoCustomRegisterValidation()
{
  var frm = document.forms["signupForm"];
  if(false == match_password())
  {
    alert('The Password and confirm password does not match!');
    return false;
  }
  else if(false == checkbox_validation())
  {
    alert('Please accept terms and services!');
    return false;
  }
  else
  {
    return true;
  }
}

function confirmPass( divID, pass1, pass2 )
{
	if( trim ( pass2 )  == '' )
	{
		alert("Please enter confirm password");
		//$(divID).innerHTML = '( Please enter confirm password )'; 
	}
	else if( !match_password ( ) )
	{
		alert("Invalid Confirm password");
		//$(divID).innerHTML = '( Invalid Confirm password )'; 
	}
	else
	{
		$(divID).innerHTML = '';
	}
}

function memberarea_confirmPass( divID, mpass1, mpass2 )
{
	if( trim ( mpass2 )  == '' )
	{
		alert("Please enter confirm password");
		//$(divID).innerHTML = '( Please enter confirm password )'; 
	}
	else if( !memberarea_match_password ( ) )
	{
		alert("Invalid Confirm password");
		//$(divID).innerHTML = '( Invalid Confirm password )'; 
	}
	else
	{
		$(divID).innerHTML = '';
	}
}

function memberarea_match_password ( )
{	
	var frm = document.forms["signupForm"];
	
	if( frm.mpassword1.value != frm.mpassword2.value)
  	{
    	return false;
  	}
	
	return true;
}


function match_password ( )
{	
	var frm = document.forms["signupForm"];
	
	if( frm.password1.value != frm.password2.value)
  	{
    	return false;
  	}
	
	return true;
}

function confirmEmail( divID, email1, email2 )
{
	//alert( pass1 );
	//alert( pass2 );
	if( trim ( email2 )  == '' )
	{
		$(divID).innerHTML = '( Please enter confirm email )'; 
	}
	else if( !match_email ( ) )
	{
		$(divID).innerHTML = '( Invalid Confirm email )'; 
	}
	else
	{
		$(divID).innerHTML = '';
	}
}
function match_email ( )
{	
	var frm = document.forms["signupForm"];
	
	if( frm.email.value != frm.confEmail.value)
  	{
    	return false;
  	}
	return true;
}

function emailErrMsg( divID , email, msg )
{
	if( trim ( email )  == '' )
	{
		alert("Please enter email address");
		//$(divID).innerHTML = '( Please enter email address )'; 
	}
	else
	{
		if( !validateEmail(email) )
		{
			$(divID).innerHTML = msg;
		}
		else
		{
			$(divID).innerHTML = '';
		}
	}
}

function checkbox_validation()
{
	var frm = document.forms["signupForm"];
	if( frm.privacy.checked != true )
	{
		return false;
	}
}

function errMsg( divID , value , msg )
{
	if( trim ( value )  == '' || trim( value ) == 0)
	{
		$(divID).innerHTML = msg; 
	}
	else
	{
		$(divID).innerHTML = '';
	}
}

function validateCombo( divID, comboID , msg )
{
	var combo	=	 $(comboID);
	if( combo.selectedIndex == 0 || combo.selectedIndex == -1 )
	{
		$(divID).innerHTML = msg;
	}
	else
	{
		$(divID).innerHTML = '';
	}
}
//Function to trim the space in the left side of the string
function ltrim ( s )
{
	return s.replace( /^\s*/, "" );
}
//Function to trim the space in the right side of the string
function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}
//Function to trim the space in the  string
function trim(s)
{
	var temp = s;
   	return temp.replace(/^\s+/,'').replace(/\s+$/,'');
}


function changefocus( original, destination )
{

//alert(original);
	/*
	switch (key) {
		case 8: // Backspace (Delete Mac)
			$(target2ID).value = val.substring(0,2);
			return true;
			break;
		case 12: // clear (keypad)
			return true;
			break;
		case 46:
			$(target2ID).value = val.substring(1,2);
			return true;
			break;
	}
	//var str = val;
	if( val.length == len )
		$(targetID).focus();
	*/
    if (original.getAttribute && original.value.length==original.getAttribute("maxlength"))
        destination.focus();
}
//Function to test string passed as argument is integer or not
function isInteger(s)
{
    var i;
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
    // All characters are numbers.
    return true;
}

function validateEmail(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

function showpopup(url)
{
	window.open(url,"Window1","menubar=no,width=530,height=360,toolbar=no,screenX=50,screenY=50,top=50,left=50");
}

function showpopup1(url)
{
	window.open(url,"Window1","menubar=no,width=530,height=490,toolbar=no,screenX=50,screenY=50,top=50,left=50");
}

function showpopup2(url)
{
	window.open(url,"Window1","menubar=no,width=530,height=490,toolbar=no,screenX=50,screenY=50,top=50,left=50");
}

function popup_icon_user(url)
{
	window.open(url,"Window5","menubar=no,width=400,height=400,toolbar=no,screenX=160,screenY=170,top=290,left=360");
}




/*function chkOffTime(si,ei,err)
{
	var startTime	=	si;
	var endTime		=	ei;
		
	if((startTime==0) && (endTime!=0))
		$(err).innerHTML="( Please Select Start Operating hours! )";
	
	else if((startTime!=0) && (endTime==0))
		$(err).innerHTML="( Please Select End Operating hours! )";
	
	else if(startTime >= endTime)
	{
		$(err).innerHTML="( Invalid Operating hours! )";
	} 
	else
		$(err).innerHTML="";
} */

function chkOffTime(si,ei,err,start,end)
{
	var startTime	=	si;
	var endTime		=	ei;
	
//alert(startTime);
//alert(endTime);
//alert(err);
//alert(start.selectedIndex);
//alert(end.selectedIndex);
    //0,1,2,3
    if( startTime == 0 )
    {
        start.selectedIndex = 0;
        end.selectedIndex = 0;
    }
    if( startTime == 1 )
    {
        start.selectedIndex = 1;
        end.selectedIndex = 1;
    }
    if( startTime == 2 )
    {                    
        start.selectedIndex = 2;
        end.selectedIndex = 2;
    }
    if( startTime == 3 )
    {
        start.selectedIndex = 3;
        end.selectedIndex = 3;
    }
	 if( startTime == 4 )
    {
        start.selectedIndex = 4;
        end.selectedIndex = 4;
    }
	 if( startTime == 5 )
    {
        start.selectedIndex = 5;
        end.selectedIndex = 5;
    }
	
 /* if((startTime > 3) && (endTime < 3))
		$(err).innerHTML="( Please Select End Operating hours! )";
	
	else if((startTime!=0) && (endTime==0))
		$(err).innerHTML="( Please Select End Operating hours! )"; 
	
	else if(startTime > endTime)
	{
		$(err).innerHTML="( Invalid Operating hours! )";
	} 
	else
		$(err).innerHTML=""; */
	       
} 



function populate_services( ID, url ,recordID )
{
	url			=	url+'?ID='+ID+'&rID='+recordID;
	var myAjax 	= 	new Ajax.Request( url, {method: 'post', onLoading: servicesLoad , onComplete: servicesResponse} );
}

function servicesLoad () 
{
	$('servicesLoad').style.display = '';
}

function servicesResponse (originalRequest) 
{
	$('servicesLoad').style.display = 	'none';
	$('servicesCombo').innerHTML	=	originalRequest.responseText;
    $('servicesCombo2').innerHTML   =   '<select name="services2[]" id="services2"  onblur="javascript:validateCombo( \'serErr\' , this.value , \'( Please choose services )\');" style="width:230px;background-image:none;" multiple size="10"></select>';	
}

function go_url(type,id,addid)
{
	var url='http://www.referralclick.com/print_out.php?type='+type+'&id='+id+'&addid='+addid;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=738px,height=1040px,screenX=100,screenY=100,top=50,left=50');
}

function go_banner(type,fid)
{
	var url='banman_front/header.php?type='+type+'&fid='+fid;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=700,screenX=100,screenY=100,top=50,left=50');
}

function go_url_file(url)
{
	window.open(url,'fileWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=720,height=700,screenX=100,screenY=100,top=100,left=100');
}

function go_url_email(type,id)
{
	var url='sentMail.php?type='+type+'&id='+id;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=528,height=380,screenX=100,screenY=100,top=50,left=50');
}

function go_url_sms(type,id,addid)
{
	var url='sendToMobile.php?type='+type+'&id='+id+'&addid='+addid;
	window.open(url,'smsWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=650,height=420,screenX=100,screenY=100,top=100,left=100');
}

function go_provider(type,id,addid)
{
	var url='providerUpdate.php?type='+type+'&id='+id+'&addid='+addid;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=550,height=620,screenX=100,screenY=100,top=50,left=50');
}

function go_file_mail(fileID,refId,type,add)
{
	var url='sentFile.php?fileid='+fileID+'&id='+refId+'&type='+type+'&add='+add;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=520,height=370,screenX=100,screenY=100,top=50,left=50');
}

function go_recommend(url)
{
	window.open(url,'fileWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height=420,screenX=100,screenY=100,top=100,left=100');
}

function sms_marketing(fid,type)
{
	var url='smsMarketing.php?id='+fid+'&type='+type;	
	window.open(url,'fileWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height=570,screenX=100,screenY=100,top=100,left=100');
}

function fax_office(fid,type,addid)
{
	var url='faxOffice.php?id='+fid+'&type='+type+'&addid='+addid;	
	window.open(url,'fileWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height=580,screenX=100,screenY=100,top=100,left=100');
}

function go_url_orgName(orgname)
{
var url='orgSearch.php?oname='+orgname;
window.open(url,'fileWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=900,height=800,screenX=100,screenY=100,top=100,left=100');
}

function mail_message(id,flag,eid) /* 0 => Read message , 1=> Reply, 2=>Forward */
{
	var url='emailMessage.php?id='+id+'&flag='+flag+'&eid='+eid;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=580,height=660,screenX=100,screenY=100,top=50,left=50');
}

function create_mailFolder()
{
	var url='createFolder.php';	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=350,height=350,screenX=100,screenY=100,top=50,left=50');
}

function srchPage_compose(type,id)
{
	var url='searchCompose.php?type='+type+'&id='+id;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=680,screenX=100,screenY=100,top=50,left=50');
}
/*function replyMail(id,flag)
{
	var url='actionEmail.php?did='+id+'&flag='+flag;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=550,height=620,screenX=100,screenY=100,top=50,left=50');
} */

/*function orderForm_fax(fid,type,fType,addid_s)
{
	var url='orderForm.php?id='+fid+'&type='+type+'&fType='+fType+'&addid_s='+addid_s;	
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=800,height=800,screenX=100,screenY=100,top=100,left=100');
}*/

function orderForm_fax(fid,type,fType,addid_s,orderform_url)
{
	//var url='orderForm.php?id='+fid+'&type='+type+'&fType='+fType+'&addid_s='+addid_s;
	if(orderform_url == 'cust-orderForm4.php')
	{
		orderform_url	= 'http://www.referralclick.com/cust-orderForm4.php';
	}
	var url_val='?id='+fid+'&type='+type+'&fType='+fType+'&addid_s='+addid_s;	
	var url = orderform_url+url_val;
	//alert(url);
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=800,height=800,screenX=100,screenY=100,top=100,left=100');
}

function go_url_file_fax(fileID)
{
	var url='sentFile_fax.php?fileid='+fileID;	
	window.open(url,'fileFax','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height=550,screenX=100,screenY=100,top=50,left=50');
}

function go_url_file_fax_Provider(fileID,refId,type,add)
{
	var url='sentFile_fax_provider.php?fileid='+fileID+'&id='+refId+'&type='+type+'&add='+add;	
	window.open(url,'fileFax','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height=550,screenX=100,screenY=100,top=50,left=50');
}

function showfaxcover(url)
{
    var faxWindow = window.open(url,"faxcover","menubar=no,width=720,height=750,toolbar=no,scrollbars=yes,screenX=50,screenY=50,top=50,left=50");
    faxWindow.focus();
}

function go_share_smile(id,fType,addid_s)
{
	var url_val='?id='+id+'&fType='+fType+'&addid_s='+addid_s;	
	var url = 'share.php'+url_val;
	window.open(url,'share','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=510,screenX=100,screenY=100,top=100,left=100');
}


function sentMailValidation(){
	var hh = document.sentmail;
	/*if(hh.senderName.value==""){
		alert("Please enter your Name.");
		hh.senderName.focus();
		return false;
	}
	
	if(hh.emailFrom.value==""){
		alert("Please enter Email address.");
		hh.emailFrom.focus();
		return false;
	}
	
	if (validateEmail(hh.emailFrom.value)==false){
		alert("Invalid email Address.");
		hh.emailFrom.focus();
		return false;
	}

	if(hh.receiverName.value==""){
		alert("Please enter Receiver Name.");
		hh.receiverName.focus();
		return false;
	}*/
	
	if(hh.emailTo.value==""){
		alert("Please enter email Address.");
		hh.emailTo.focus();
		return false;
	}
	
	/*if (validateEmail(hh.emailTo.value)==false){
		alert("Invalid email Address.");
		hh.emailTo.focus();
		return false;
	} 
	
	
	if(hh.message.value==""){
		alert("Please enter your message.");
		hh.message.focus();
		return false;
	}*/
	
	
return true;
}

function uploadFile(){
	var hh = document.uploadFrm;
		
	if(hh.desc.value==""){
		alert("Please Enter File Title.");
		hh.desc.focus();
		return false;
	}
	
 return true;
}

function muploadFile(){
	var hh = document.muploadFrm;
		
	if(hh.desc.value==""){
		alert("Please Enter File Title.");
		hh.desc.focus();
		return false;
	}
	
 return true;
}

function addService(){
	var hh = document.addServices;
		
	if(hh.service.value==""){
		alert("Please Enter Service name.");
		hh.desc.focus();
		return false;
	}
	
 return true;
}


function recommendProvider(){
	var hh = document.recUpdate;
		
	if(hh.name.value==""){
		alert("Please Enter Your Name.");
		hh.name.focus();
		return false;
	}
	if(hh.providerName.value==""){
		alert("Please Enter Provider Name.");
		hh.providerName.focus();
		return false;
	}
	
	if(hh.factype.value==""){
		alert("Please Enter Facility Type.");
		hh.factype.focus();
		return false;
	}
	
 return true;
}


function validateDoctorStep2 ( ) 
{    
    var refEmail     =     $('referralContEmail').value;
    var centEmail    =     $('centContEmail').value;
    
    if( trim( refEmail ) != '' )
    {
        if( !validateEmail(refEmail) )
        {
            $('refEmailErr').innerHTML = '( Referral email address is invalid )';
            return false;
        }
    }
    if(trim( centEmail )  != '' )
    {
        if( !validateEmail(centEmail) )
        {
            $('centEmailErr').innerHTML = '( Center email address is invalid )';
            return false;
        }
    }
    
    var monSt    =     $('monStHrs').selectedIndex;
    var monEd    =     $('monEdHrs').selectedIndex;
    var tueSt    =     $('tueStHrs').selectedIndex;
    var tueEd    =     $('tueEdHrs').selectedIndex;
    var wedSt    =     $('wedStHrs').selectedIndex;
    var wedEd    =     $('wedEdHrs').selectedIndex;
    var thuSt    =     $('thuStHrs').selectedIndex;
    var thuEd    =     $('thuEdHrs').selectedIndex;
    var friSt    =     $('friStHrs').selectedIndex;
    var friEd    =     $('friEdHrs').selectedIndex;
    var satSt    =     $('satStHrs').selectedIndex;
    var satEd    =     $('satEdHrs').selectedIndex;
    var sunSt    =     $('sunStHrs').selectedIndex;
    var sunEd    =     $('sunEdHrs').selectedIndex;
    
	
	//alert( monSt);
	//alert(monEd);
	
	
    if( monEd < monSt  )
    {
         $('error1').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( tueEd < tueSt  )
    {
         $('error2').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( wedEd < wedSt  )
    {
         $('error3').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( thuEd < thuSt  )
    {
         $('error4').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( friEd < friSt  )
    {
         $('error5').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( satEd < satSt  )
    {
         $('error6').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( sunEd < sunSt  )
    {
         $('error7').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    else
    {
        return true;
    }
    return true;
}


function validateFacilityStep2 ( ) 
{    
    var refEmail     =     $('referralContEmail').value;
    var centEmail    =     $('centContEmail').value;
    var markEmail    =     $('markContEmail').value;
    
    if( trim( refEmail ) != '' )
    {
        if( !validateEmail(refEmail) )
        {
			alert("Referral email address is invalid ");
            //$('refEmailErr').innerHTML = '( Referral email address is invalid )';
            return false;
        }
    }
    if( trim( markEmail ) != '' )
    {
        if( !validateEmail(markEmail) )
        {
			alert(" Marketing email address is invalid");
            //$('markEmailErr').innerHTML = '( Marketing email address is invalid )';
            return false;
        }
    }
    if(trim( centEmail )  != '' )
    {
        if( !validateEmail(centEmail) )
        {
			alert(" Center email address is invalid");
            //$('centEmailErr').innerHTML = '( Center email address is invalid )';
            return false;
        }
    }
    else
    {
        return true;
    }
    return true;
}


function validateFacilityStep4 ( ) 
{    
    var monSt    =     $('monStHrs').selectedIndex;
    var monEd    =     $('monEdHrs').selectedIndex;
    var tueSt    =     $('tueStHrs').selectedIndex;
    var tueEd    =     $('tueEdHrs').selectedIndex;
    var wedSt    =     $('wedStHrs').selectedIndex;
    var wedEd    =     $('wedEdHrs').selectedIndex;
    var thuSt    =     $('thuStHrs').selectedIndex;
    var thuEd    =     $('thuEdHrs').selectedIndex;
    var friSt    =     $('friStHrs').selectedIndex;
    var friEd    =     $('friEdHrs').selectedIndex;
    var satSt    =     $('satStHrs').selectedIndex;
    var satEd    =     $('satEdHrs').selectedIndex;
    var sunSt    =     $('sunStHrs').selectedIndex;
    var sunEd    =     $('sunEdHrs').selectedIndex;
	var oc1 	 =  	$('orderCenter');
    var oc  	 =  	$('orderCenter2'); 
    
    if( monEd < monSt  )
    {
         $('error1').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( tueEd < tueSt  )
    {
         $('error2').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( wedEd < wedSt  )
    {
         $('error3').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( thuEd < thuSt  )
    {
         $('error4').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( friEd < friSt  )
    {
         $('error5').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( satEd < satSt  )
    {
         $('error6').innerHTML = '( Invalid Operating hours! )';
         return false;
    }
    if( sunEd < sunSt  )
    {
         $('error7').innerHTML = '( Invalid Operating hours! )';
         return false;
    }

	 if( oc.options.length > 0 )
		{
            for( i=0; i< oc.options.length; i++ )
            {
                oc.options[i].selected = true;
            }
            return true;
        } 

    return true;
}

function validateDoctorStep4()
{
    var aff1  =  $('affiliation');
    var aff   =  $('affiliation2'); 
	var oc1   =  $('orderCenter');
    var oc    =  $('orderCenter2'); 
	//alert( oc.options.length );
	 //if( aff1.options.length > 0 )
	 if( aff1.options.length > 0 )
		{
        /* if( aff.options.length <= 0 )
			{
				$('affErr').innerHTML = '( Please Choose Hospital )';
				return false;
			}
			else
		{ */
            for( i=0; i<aff.options.length; i++ )
            {
                aff.options[i].selected = true;
            }
            //return true;
        } 
		
		if( oc.options.length > 0 )
		{
			for( i=0; i < oc.options.length; i++ )
            {
                oc.options[i].selected = true;
            }
			//return true;
        } 
		
		return true;
}

function validateSuperAdmin()
{
    var memberID  =  $('memberID');
    var superID   =  $('superMemID'); 
    //alert(ser1.options.length);
    if( memberID.options.length > 0 )
    {
        for( i=0; i<superID.options.length; i++ )
        {
            superID.options[i].selected = true;
        }
        
        for( i=0; i<memberID.options.length; i++ )
        {
            memberID.options[i].selected = true;
        }
        return true;
    } 
           
}

function validation_ins()
{
	var hh = document.insurance;
	if(hh.pay.value=="")
	{
		alert("Please Select Insurance");
		hh.pay.focus();
		return false;
	}
	
	return true;
}


function checkCheckbox(formname, checkname, displaytext) {
  var localerror = '';
  var rad_val    = '';
  for (var i=0; i < eval('document.'+formname+'.'+checkname+'.length'); i++) { //check every radio button by that name
    if (eval('document.'+formname+'.'+checkname+'[i].checked'))  { //if it is checked
      rad_val += '-';
      }	else rad_val += '';
      }
    if (rad_val=='') {
      localerror =  ' '+displaytext+' .\n';
    }
  return localerror;
}

function validation_printCheck()
{
var hh = document.print;
		var errors = '';	
		errors += checkCheckbox("print","printProvider", "Please Select checkbox");
		if(errors != '') 
		{
		alert(errors);
		return false;
		}


return true;
}

function go()
{
	if( confirm ( "Are you sure to delete this record?" ) )
	{
		return true;
	}
	else
	{
		return false;
	}
}






