var astro = new function()
{	
	this.astro_js = function(p)
	{		
		selectedValue(p);
		document.getElementById("div_sunsign").innerHTML = "Loading...";
		var aostr_id = "aostr_id";			
		var headID = document.getElementsByTagName("head")[0];	
	
		var newScript = document.createElement('script');
		newScript.type = 'text/javascript';
		newScript.src = 'http://www.santabanta.com/astro_js.asp?sign=' + p;
		newScript.id = aostr_id;
   		headID.appendChild(newScript);	
		createCookie('astro', p, 365);		
	}	
}
function selectedValue(p)
{
	var ddlCountry = document.getElementById("sunsign");        
    //ddlCountry.options(ddlCountry.SelectedItem).text = p; 
	for(var i = 0; i < ddlCountry.length; i++)
	{
		if(ddlCountry[i].value == p) 
		{
			ddlCountry.selectedIndex = i;
			break;
		}
	}
}

function bodyLoad()
{
astro.astro_js('Aries');
} 

function loadAstro()
{	
	if (readCookie('astro') == null)
	{
		astro.astro_js('Aries');	
	}
	else	
	{
		astro.astro_js(readCookie('astro'));	
	}
}	
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
