function showurl(info){
  	info = info + 1;
  	for (i=1;i<=8;i++){
		if (i!=info){
  		document.getElementById('example_'+i).style.display = 'none';
		}
		else {document.getElementById('example_'+i).style.display = 'inline';}
  	}
}

function get_http()
{
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new 
                ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
    @else
        xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}

function proc_url(url)
{
    if (!this.http)
    {
        this.http = get_http();
        this.working = false;
    }
    document.getElementById('info').innerHTML = '<img src="/img/loader.gif" />&nbsp;Getting Info...';
    par = 'url='+ encodeURIComponent('http://www.youddl.com/ddl.php') + '&q='+encodeURIComponent(url);
    
    this.http.open("GET", '/php/getURL.php?'+par, true);
    this.http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    this.http.setRequestHeader("Content-length", par.length);
    this.http.setRequestHeader("Connection", "close");
    this.http.onreadystatechange = function() {
        if (http.readyState == 4) {
            r = eval("("+http.responseText+")");
            if (r.err==0) {
		if (typeof(r.url) == 'object') {
		    content = r.title + '<br />Direct Download Links:<br />';
		    for(i = 0; i < r.url.length; i++) {
			content += r.url[i].desc + ': <a target="_blank" href="' + r.url[i].url + '">&gt;&gt; DOWNLOAD! &lt;&lt;</a><br />';
		    }
		} else {
		    content = r.title + '<br />Direct Download Link: <a target="_blank" href="' + r.url + '">&gt;&gt; DOWNLOAD! &lt;&lt;</a>';
		}
		document.getElementById('info').innerHTML = content;
	    } else if (r.err==1) {
		document.getElementById('info').innerHTML = 'Search string entered. Perform search below...';
		/*document.location = 'http://videos.desishock.net/index.php?module=search&action=search_keywords&keyword='+par;*/
	    } else {
		document.getElementById('info').innerHTML = 'Video not found. Check your input!';
	    }
            this.working = false;
        }
    }
    this.working = true;
    this.http.send(null);
}
