﻿function link_row_over(link_row) {
	link_row.className = 'link_row_highlight';
}

function link_row_out(link_row,row_class) {
	link_row.className = row_class;
}

function detect_link_detail(link_url) {
	// Set the select box to Web first
	document.getElementById('add_link_type').selectedIndex = 0;

	// Set the select box to Tweet if it looks like one
	if (link_url.value.indexOf('.twitter.com/')>-1) {
		document.getElementById('add_link_type').selectedIndex = 1;
	}
	if (link_url.value.indexOf('//twitter.com/')>-1) {
		document.getElementById('add_link_type').selectedIndex = 1;
	}

	// Set the select box to Facebook if it looks like it
	if (link_url.value.indexOf('.facebook.com/')>-1) {
		document.getElementById('add_link_type').selectedIndex = 2;
	}
	if (link_url.value.indexOf('//facebook.com/')>-1) {
		document.getElementById('add_link_type').selectedIndex = 2;
	}

	// Set the select box to YouTube if it looks like it
	if (link_url.value.indexOf('.youtube.com/')>-1) {
		document.getElementById('add_link_type').selectedIndex = 3;
	}
	if (link_url.value.indexOf('//youtube.com/')>-1) {
		document.getElementById('add_link_type').selectedIndex = 3;
	}

	// Set the select box to Music if it looks like an mp3
	if (link_url.value.indexOf('.mp3')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}

	// Set the select box to Music if it is a grooveshark URL
	if (link_url.value.indexOf('.grooveshark.com')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}

	// Set the select box to Music if it is a grooveshark URL
	if (link_url.value.indexOf('//grooveshark.com')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}

	// Set the select box to Music if it is a grooveshark URL
	if (link_url.value.indexOf('.tinysong.com')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}

	// Set the select box to Music if it is a grooveshark URL
	if (link_url.value.indexOf('//tinysong.com')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}

	// Set the select box to Music if it is a Pandora Radio URL
	if (link_url.value.indexOf('.pandroa.com')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}

	// Set the select box to Music if it is a Pandora Radio URL
	if (link_url.value.indexOf('//pandora.com')>-1) {
		document.getElementById('add_link_type').selectedIndex = 4;
	}
}

function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            //updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

// Detect a Facebook login and record it
function fb_logion() {
}

