/***** Start code to display blog flyovers *************/
var xMoz= (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
var xSaf= navigator.userAgent.toLowerCase().indexOf("safari") != -1;
var fIE = !xMoz && !xSaf;

function debug (str)
{	 var db = document.getElementById("debug");
	 if(db) db.innerHTML +=  str + '<br>';
}


function init_fly()
{	fly_it("cat_hl_93715");
	fly_it("cat_hl_93741");
}

function fly_it(hlId)
{	var hl = document.getElementById(hlId);
	 if(hl)
	 {	 var spans = hl.getElementsByTagName("span");
		 for (var i = 0; i < spans.length; i++)
		 {	var span = spans[i];
			if (span.className == "image")
			{	span.onmouseover = function() {oFlyOn(this.parentNode);}; 
				span.onmouseout = function() {oFlyOff(this.parentNode);};
			}
			else continue;
		 }
	 }
}

function oFlyOn(oSpn)
{	oSpn.className = 'lvl2 lvl2Over';
	var inner = oSpn.getElementsByTagName("span");
	for(var j = 0; j < inner.length; j++)
	{	var ispan = inner[j];
		if (ispan.className == "text") 
		{	ispan.className='showtext';
			ispan.onmouseover = function() {oFlyOff(oSpn);}; 
		}
	}
}

function oFlyOff(oSpn)
{	oSpn.className = 'lvl2';
	var inner = oSpn.getElementsByTagName("span");
	for(var j = 0; j < inner.length; j++)
	{	var ispan = inner[j];
		if (ispan.className == "showtext") ispan.className='text'
	}
}
/***** End code to display blog flyovers *************/

function onEnter(form, e, strParam)
{ var keycode;
  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
  else return true;
  if (keycode == 13) {
    submit_form (form, strParam);
    return false;
  } else return true;
}

function focusOn(obj) 
{   if (obj.value == 'Search Grazia') obj.value = '';
    return true;
}

function focusOut(obj) 
{  if (obj.value == '') obj.value = 'Search Grazia';
    return true;
}

function submit_form()
{ var arrArgs = submit_form.arguments;
 var oForm = arrArgs[0];
 var strParam = arrArgs[1];
 var strInput, strType;

  if (strParam == 'ss')
 { if ("[" + typeof(oForm.query.value) + "]"!="[undefined]")
  { strInput = oForm.query.value
  }else
  { strInput = '';
  }
  window.parent.location.href = "/search.aspx?query="+strInput;
 }
 return false;
}
/******* Horoscopes ********/
var horoCurrent = 0;
var horoName = new Array("Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces");
var horoDate = new Array("Mar 21 - Apr 19","Apr 20 - May 20","May 21 - Jun 21","Jun 22 - Jul 22","Jul 23 - Aug 22","Aug 23 - Sep 22","Sep 23 - Oct 23","Oct 24 - Nov 21","Nov 22 - Dec 21","Dec 22 - Jan 19","Jan 20 - Feb 18","Feb 19 - Mar 20");

function renderHoro(selected)
{
    for(i=0; i < arrJson.length; i++)
    {
        var printLine = '<option value="' + i + '"'
        if(selected == i)
        {
            printLine = printLine + 'selected="selected"';
        }
        printLine = printLine + '>' + horoName[i] + '</option>';
        
        document.writeln(printLine);
    }
}

function focusHoro(index, trim)
{
    horoCurrent = index;
    var hName = horoName[index];
    var hDate = horoDate[index];
    var hImg = "/img/horoscope/horoscope_" + hName + ".jpg"
    var hText = arrJson[index]['abstract'];
       
    if (trim > 0)
    {
        hText = hText.substring(0,trim) + "...";
        document.getElementById("horoname").innerHTML = "<a href='' onclick='return popup(" + index + ");'>" + hName + ":&nbsp;" + "</a>";            
    }    
    else if (trim == 0)
    {
        document.getElementById("horodate").innerHTML = "(" + hDate + ")";
        document.getElementById("mainimg").src = hImg;
        document.getElementById("horoname").innerHTML = hName;
    }
    
    document.getElementById("horotext").innerHTML = hText;
    
}

function queryHoro()
{
    var queryString = window.location.search.substring(1);
    if(queryString && queryString != "")
    {
        var queryPair = queryString.split("&");
        if(queryPair)
        {
            for(i=0; i < queryPair.length; i++)
            {
                var indexString = queryPair[i].split("=");
                if(indexString && indexString.length > 1 && indexString[0] == "starsign")
                {
                     return indexString[1];
                }
            }
        }
    }
    return 0;
}

function popup(index)
{
    window.open('/horoscope.aspx?starsign=' + index,'_blank','height=245,width=745,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=1,toolbar=0');
}
/***** End Horoscopes ******/

/*****Code to display PNG correctly for IE *************/
function fixPng( img ) {
 var xMoz= (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
 var xSaf= navigator.userAgent.toLowerCase().indexOf("safari") != -1;
 var fIE = !xMoz && !xSaf;
 //alert('In Func');
 if (!fIE)
 { 
    return ;
 }
 else 
 {
 //do the whole lot of work to fix the png  
  var src = img.src;
  img.style.visibility = "hidden";
  var div = document.createElement("DIV"); 
  div.className = "transparentImage"
  div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizing='scale')"; 
  div.innerHTML = "&nbsp;"
  img.replaceNode(div);
  //alert('Image Replaced');
 }
}
/***** End code to display PNG correctly for IE *************/



