function __xavio_TipFriend(_subject,_body) {		
        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='+screen.width+',height='+screen.height+',menubar=yes,toolbar=no,status=yes,scrolling=no,resizable=yes')

	}

	function __xavio_siteMap(p_id) {

		location.href=p_id+'?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=150, width=250, resizable=no, scroll=no, status=yes, toolbar=no, menubar=no, scroll=no");
	    if (FPDoc.opener == null) FPDoc.opener = self;
	    FPDoc.moveTo((screen.availWidth-250)/2,(screen.availHeight-150)/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();
}

function startStyleFinder(showBorders) {

    theHTML = '<div id="stylefinder_status_div" style="display: none; text-align: center; position: absolute; background-color: lightyellow; padding: 10px; top: 10px; left: 10px; border: 1px solid #808080; font-family: trebuchet ms; font-size: 10px;">';    
      theHTML = theHTML + '<div style="font-size: 14px; font-weight: bold;">StyleFinder Enabled</div>';
      theHTML = theHTML + 'Move your mouse over the elements to get the css-class.<br/>';
      theHTML = theHTML + '<input type="checkbox" name="showBorders" value="true" id="showBorders" onclick="if(this.checked){startStyleFinder(\'true\')}else{location.reload(true);};"> <label for="showBorders">Show borders</label>'; 
    theHTML = theHTML + '</div>';
        
    addHTML(theHTML);

    statusDiv = document.getElementById('stylefinder_status_div');
    statusDiv.style.display = '';

    tagsToDisplay = new Array("div", "a", "span", "td", "img", "h1", "h2", "h3", "h4", "h5", "hr", "input", "textarea", "select", "button");
    countObj = 0;

    for(i=0;i<=tagsToDisplay.length-1;i++) {
        tempObjs = document.getElementsByTagName(tagsToDisplay[i]); 
        
        if(tagsToDisplay=="div" || tagsToDisplay=="span") {
            startNum = 1;
        } else {
            startNum = 0;
        }
        for(a=startNum;a<=tempObjs.length-1;a++) {
            if(showBorders=='true') tempObjs[a].style.border='1px dotted #808080';
            tempObjs[a].title = '\n\r  <'+tagsToDisplay[i]+' />  \n\r\n\r  Id = '+tempObjs[a].id+'  \n\r  Class = '+tempObjs[a].className+'  \n\r';
            
            countObj = countObj++;
        }
    }
}


function addHTML (html) {
  if (document.all)
    document.body.insertAdjacentHTML('beforeEnd', html);
  else if (document.createRange) {
    var range = document.createRange();
    range.setStartAfter(document.body.lastChild);
    var docFrag = range.createContextualFragment(html);
    document.body.appendChild(docFrag);
  }
  else if (document.layers) {
    var l = new Layer(window.innerWidth);
    l.document.open();
    l.document.write(html);
    l.document.close();
    l.top = document.height;
    document.height += l.document.height;
    l.visibility = 'show';
  }
}

