/*navbar related functions*/
var menuActive;

function highlightel(el,selectedlinkclass,selectedtabclass) 
{
	if(el.tagName=="TD")
	{
		if(el.childNodes[0].href!=document.location.href)
		{
			el.className=selectedtabclass;
			el.childNodes[0].className=selectedlinkclass;
			menuActive=el;
		}
	}
	if(el.tagName=="A")
	{
		if(el.href!=document.location.href)
		{
			el.className=selectedlinkclass;
			el.parentNode.className=selectedtabclass;
			menuActive=el;
		}
	}
}

//reset the active cell or link
function unhighlightel(el,linkclass,tabclass)
{
	if(menuActive!=null)
	{
		if(menuActive.tagName=="TD")
		{		
			el.className=tabclass;
			el.childNodes[0].className=linkclass;
		}
		if(menuActive.tagName=="A")
		{
			el.className=linkclass;
			el.parentNode.className=tabclass;
		}
	}
}

//go to the url of the embedded link
function gotolink(el)
{
	if(el.tagName=="TD")
	{
		document.location.href=el.childNodes[0].href;
	}
	if(el.tagName=="A")
	{
		document.location.href=el.href;
	}		
}

/*other functions*/

//used for scroll tracking
function trackscroll(vscroll, controlname)
{
    document.getElementById(controlname).value=vscroll;
}

var NewWindow;
function openwindow(location)
{
	NewWindow = window.open(location, 'view');

	if (NewWindow.focus != null)
	{
		NewWindow.focus();
	}
}

function openwindow2(location, windowname, height, width, top, left)
{
	var dialogposition='width='+width+',height='+height+',top='+top+',left='+left;
	var dialoglocation=location;		
	NewWindow = window.open(dialoglocation,windowname,dialogposition);
	
	if (NewWindow.focus!=null)
	{
		NewWindow.focus();
	}
}

function setPageHeight()
{

	//script for setting page size
	tbl = document.getElementById('tblmain');

	if (window.innerHeight)
	{
		tbl.style.height = window.innerHeight - 30;
	}
	else
	{
		//ie
		//tbl.style.height = document.body.clientHeight - 30;
	}

	if (document.location.href.indexOf("portfolio.aspx") > 0)
	{
		var frm = document.getElementById('frame1');
		if (window.innerHeight)
		{
			frm.style.height = window.innerHeight - 60;
			frm.style.width = window.innerWidth - 330;
			var doc = frm.contentDocument;
			//var div = doc.getElementById('div1')
			//div.style.height = window.innerHeight - 60;
			var el = doc.getElementById('issuu');
			var emb = el.getElementsByTagName('embed')[0];
			emb.style.height = window.innerHeight - 60;
			emb.style.width = window.innerWidth - 210;
		}
		else
		{
			//ie
			frm.style.height = document.body.clientHeight - 40;
			frm.style.width = document.body.clientWidth - 335;

			var div = frm.contentWindow.document.getElementById('div1');
			var emb = div.childNodes[0];
			emb.style.height = document.body.clientHeight - 60;
			emb.style.width = document.body.clientWidth - 220;
		}
	
	}
	else if (document.location.href.indexOf("resume.aspx") > 0)
	{
		var div = document.getElementById('divr');
		if (window.innerHeight)
		{
			div.style.height = window.innerHeight - 60;
		}
		else
		{
			div.style.height = document.body.clientHeight - 60;
		}
	}
}
