function __xavio_TipFriend(_subject,_body) {		
		_body = _body.replace(/%25link%25/gi, location.href)
        location.href='mailto:?subject='+_subject+'&body='+_body;
	}

	function __xavio_AddFav() {

		if (document.all) {
			window.external.addFavorite( location.href, document.title );
		}
	}

	function __xavio_toTop() {
		
		if (document.all) {
			location.href='#top';
		}
	}

	function __xavio_setHome(element) {
		if (document.all) {
			element.style.behavior='url(#default#homepage)';element.setHomePage(location.href);
		}
	}

	function __xavio_goSearch(p_id,init_var) {

		if(document.all) {
			s_var = s_query.value;
		}
		else
		{
			s_var = document.getElementById('s_query').value;
		}

		if (s_var!=init_var) {
			location.href=p_id+'.asp?search='+s_var;
		}

	}


	function __xavio_OpenWindow(p_title,p_content,p_heading,p_design) {
		var mywin = window.open('', 'win', 'scrollbars=yes,status=yes,toolbar=yes,menubar=yes,width=500,height=500');

		with (mywin.document) {
			open('text/html', 'replace');
			write('<html><head><title>'+p_title+' '+p_heading+'</title><link href="includes/designs/design_'+p_design+'/css/design.css" rel="stylesheet" media="screen" type="text/css"/></head><body class="legal_privacy_body"><div class="legal_privacy_heading">'+p_heading+'</div><div class="legal_privacy_div">'+p_content+'</div></body></html>');
			close();
		}
	}

	function __xavio_showGalleryImage(p_title,p_id,p_src,winWidth,winHeight) {

		theUrl = 'includes/pictureViewer.asp?p_title='+p_title+'&galId='+p_id+'&current='+p_src

		window.open(theUrl,'xavioPicViewer','width='+winWidth+',height='+winHeight+',menubar=yes,toolbar=no,status=yes,scrolling=no,resizable=yes')

	}

	function __xavio_siteMap(p_id) {

		location.href='?id='+p_id+'&amp;sitemap=true';

	}


	function __xavioCryptMail(str) {
		text = "";
		i    = 0;
		while (i <= (str.length - 1)) {
			temp = str.substring(i, i+1);
			text = temp + text;
			i++;
		}
		location.href = 'mailto:'+text;
	}
	

	gal_old_id = null;
	function __xavioActivateGalleryItem(item_id) {

		if(gal_old_id==item_id) {
			item_id = null;
		}

		if (gal_old_id!=null) {
			old_frame = document.getElementById('gal_frame_id'+gal_old_id)	
			old_image = document.getElementById('gal_image_id'+gal_old_id)	
			old_text  = document.getElementById('gal_text_id'+gal_old_id)	

			old_image.className = 'gallery_item_image_frame_off';
			if(old_text!=null) {
				old_text.className  = 'gallery_item_text_off';
			}

			gal_old_id = null;
		}

		if(item_id!=null) {
			the_frame = document.getElementById('gal_frame_id'+item_id);	
			the_image = document.getElementById('gal_image_id'+item_id);
			the_text  = document.getElementById('gal_text_id'+item_id);

			the_image.className = 'gallery_item_image_frame_on';
			if(the_text!=null) {
				the_text.className  = 'gallery_item_text_on';
			}
	
			gal_old_id = item_id
		}
	}
	

	function __xavioShowForgotPassword() {	
	    FPDoc = window.open("includes/forgotpass.asp", "xavioForgotPasswordDialog", "height=125, width=226, resizable=no, scroll=no, status=yes, toolbar=no, menubar=no, scroll=no");
	    if (FPDoc.opener == null) FPDoc.opener = self;
	    FPDoc.moveTo((screen.availWidth-226)/2,(screen.availHeight-125)/2);
	    FPDoc.focus();
	}
	
	function __xavioShowUserProfile() {	
	    UPDoc = window.open("includes/edit_userprofile.asp", "xavioEditUserProfileDialog", "height=350, width=226, resizable=no, scroll=no, status=yes, toolbar=no, menubar=no, scroll=yes");
	    if (UPDoc.opener == null) UPDoc.opener = self;
	    UPDoc.moveTo((screen.availWidth-226)/2,(screen.availHeight-425)/2);
	    UPDoc.focus();
	    
        //toggleEffect('userbar_editprofile_div');
	}	
	
	function __xavioLogOut() {	
	    theUrl = location.href.substr(location.href.lastIndexOf('/')+1,location.href.length);
	    theUrl = theUrl.substr(0,theUrl.indexOf('?'));
	    
	    location.href = theUrl+'?mode=logout';
	}
	
	
	
    function toggleEffect(objName) {    
    
        togDiv = document.getElementById(objName);
        
        togDiv.style.filter = 'filter: progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1,wipestyle=1,motion=forward);';
            
        togDiv.filters[0].apply();    
            if(togDiv.style.display=='') {
                togDiv.filters[0].motion = 'reverse';
                togDiv.style.visibility = 'hidden';                
                togDivTimer = window.setTimeout("document.getElementById(\'"+objName+"\').style.display=\'none\'",500);
            } else {
                togDiv.style.display = '';
                togDiv.style.visibility = 'visible';
                togDiv.filters[0].motion = 'forward';
            }            
            
        togDiv.filters[0].play();
    }	
	
	
	function __xavioCheckAdvUserForm() {
	    if(document.adv_pwd_form.pwd_xavio_pinput.value.length>0 && document.adv_pwd_form.pwd_xavio_uinput.value.length>0) {
	        document.adv_pwd_form.pwd_xavio_pinput.value = hex_md5(document.adv_pwd_form.pwd_xavio_pinput.value)
	    } else { 
	        alert(advPwd_errorMess1);
	        document.adv_pwd_form.pwd_xavio_uinput.focus();
	        return false;
        }
    }
	
function emailCheck (emailStr,errorMess) {

    if(errorMess=='') { errorMess = 'Invalid e-mail!'; }

    var checkTLD=1;
    var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
    var emailPat=/^(.+)@(.+)$/;
    var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
    var validChars="\[^\\s" + specialChars + "\]";
    var quotedUser="(\"[^\"]*\")";
    var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
    var atom=validChars + '+';
    var word="(" + atom + "|" + quotedUser + ")";
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
    var matchArray=emailStr.match(emailPat);

    if (matchArray==null) {
        alert(errorMess);
        return false;
    }
    
    var user=matchArray[1];
    var domain=matchArray[2];

    for (i=0; i<user.length; i++) {
        if (user.charCodeAt(i)>127) {
            alert(errorMess);
            return false;
       }
    }
    
    for (i=0; i<domain.length; i++) {
        if (domain.charCodeAt(i)>127) {
        alert(errorMess);
        return false;
       }
    }

    if (user.match(userPat)==null) {
        alert(errorMess);
        return false;
    }

    var IPArray=domain.match(ipDomainPat);
    
    if (IPArray!=null) {
        for (var i=1;i<=4;i++) {
            if (IPArray[i]>255) {
                alert(errorMess);
                return false;
            }
        }
        return true;
    }


    var atomPat=new RegExp("^" + atom + "$");
    var domArr=domain.split(".");
    var len=domArr.length;
    
    for (i=0;i<len;i++) {
        if (domArr[i].search(atomPat)==-1) {
            alert(errorMess);
            return false;
        }
    }

    if (checkTLD && domArr[domArr.length-1].length!=2 && 
        domArr[domArr.length-1].search(knownDomsPat)==-1) {
        alert(errorMess);
        return false;
    }

    if (len<2) {
        alert(errorMess);
        return false;
    }
        
    return true;
}


function viewEvent(eventId) {
	    UPDoc = window.open("includes/event_view.asp?id="+eventId, "xavioEventViewDialog", "height=500, width=500, resizable=yes, scrollbars=yes, status=yes, toolbar=yes, menubar=no");
	    if (UPDoc.opener == null) UPDoc.opener = self;
	    UPDoc.moveTo((screen.availWidth-500)/2,(screen.availHeight-500)/2);
	    UPDoc.focus();
}