﻿function feature(url) {
	
    var httpRequest;

    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
        httpRequest = new XMLHttpRequest();
        if (httpRequest.overrideMimeType) {
            httpRequest.overrideMimeType('text/xml');
            // See note below about this line
        }
    } 
    else if (window.ActiveXObject) { // IE
        try {
            httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) {
                       try {
                            httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                           } 
                         catch (e) {}
                      }
                                   }

    if (!httpRequest) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    httpRequest.onreadystatechange = function() { contents(httpRequest); };
    httpRequest.open('GET', url, true);
    httpRequest.send('');

}

function contents(httpRequest) {
	var feature = document.getElementById('feature');
    if (httpRequest.readyState == 4) {
        if (httpRequest.status == 200) {
        	var info = httpRequest.responseText;
        	if (feature.style.marginBottom != ''){
	            feature.innerHTML = info;
				window.scroll(0,800); 
				feature.scrollTop = 0;
        	}else{
		        feature.style.border = '1px solid #aaa';
		        feature.style.marginBottom = '10px';
		        feature.style.padding = '10px';
		        feature.style.backgroundColor = '#eee';
		        feature.style.height = '0px';
                grow();
			    feature.innerHTML = info;
				window.scroll(0,800); 
            }
        } else {
            alert('There was a problem with the request.');
        }
    }
}
function grow(){
	var feature = document.getElementById('feature');
	var height = 300;
    	feature.style.height = parseInt(feature.style.height)+Math.ceil((height-parseInt(feature.style.height))/4)+'px';
	if (parseInt(feature.style.height) <= height){
		setTimeout('grow();', 20);
	}
}
function vcard(){
	var inst = document.createElement('div');
	var feature = document.getElementById('feature');
	inst.setAttribute('id','instructions');
	feature.appendChild(inst);
	inst.innerHTML = 'A vcard is a file that contains contact information that can be added directly to Microsoft Outlook or any similar mail client.';
}
function hideVcard(){
	var inst = document.getElementById('instructions');
	inst.parentNode.removeChild(inst);
}