/// <reference path='~/jQuery/jQuery-vsdoc.js' />
var _cip = Object()

_cip.OnLoad = function()
{
	_cip.SelectedMenu = $('.menu.contactInfo.sel')
	_cip.TableRows = 	$('#contactInfo tr')

	// Map the contact info into images
	$('#contactInfo td').each(function()
	{
		var obj = $(this)
		var src = obj.html()
		if (src.indexOf('cache') == 0)
		{
			var img = new Image()
			img.src = src
			obj.html("").append(img)
		}
	})

	// construct the email address and link it.
	$('#email').bind('click', function() { window.location = 'mailto:' + _mp.EMname + '@' + _mp.EMhost })
	$('#email img.top').bind('mouseover', _mp.FadeIn)
										 .bind('mouseout', _mp.FadeOut)
}

_cip.DrawPage = function(func) {
	_cip.ShowRows(0, func)
	return _cip.SelectedMenu;
}

_cip.ShowRows = function(idx, func)
{
	if (idx == _cip.TableRows.length)
	{
		if (func)
			func()
		return
	}
	var x = $(_cip.TableRows[idx]).stop()
												.css({opacity: 1})
												.animate({ opacity: 'show' }, { duration: 350, queue: true })		
	_mp.Timer = setTimeout(function() { _cip.ShowRows(idx + 1, func) }, 60)
}

_cip.HideRows = function(idx, func)
{
	if (--idx < 0)
	{
		if (func)
			func()
		return
	}

	$(_cip.TableRows[idx]).stop()
							.animate({ opacity: 'hide' }, { duration: 200, queue: true })		
	_mp.Timer = setTimeout(function() { _cip.HideRows(idx, func) }, 30)
}

