// JavaScript Document
function pyear(){var curdate = new Date();var year = curdate.getYear();if (year < 2000)year = year + 1900;document.write(year)}

function header()
{
//alert(apppath);
//alert('<%= System.Web.HttpContext.Current.Request.ApplicationPath %>');
h="";
h=h+"<table width='950' border='0' cellspacing='0' cellpadding='0'><tr><td width='550'><img src='App_Themes/HomeMaster/images/common/logo.jpg' runat='server' width='131' height='22' /></td><td width='124'>&nbsp;</td><td width='40' class='bluetext'>Sitemap</td><td width='20' class='bluetext' align='center'>|</td><td width='165'><input type='text' name='search' id='search' class='searchbox' value='Search Genpact'/></td><td width='55' ><input name='' type='submit' class='search' value=''   /></td></tr></table>"
document.write(h)
}
function Subheader()
{
h="";
h=h+"<table width='950' border='0' cellspacing='0' cellpadding='0'><tr><td width='550'><img src='../App_Themes/HomeMaster/images/common/logo.jpg' runat='server' width='131' height='22' /></td><td width='124'>&nbsp;</td><td width='40' class='bluetext'>Sitemap</td><td width='20' class='bluetext' align='center'>|</td><td width='165'><input type='text' name='search' id='search' class='searchbox' value='Search Genpact'/></td><td width='55' ><input name='' type='submit' class='search' value=''  /></td></tr></table>"
document.write(h)
}
function Subheader1()
{
h="";
h=h+"<table width='950' border='0' cellspacing='0' cellpadding='0'><tr><td width='550'><img src='App_Themes/HomeMaster/images/common/logo.jpg' runat='server' width='131' height='22' /></td><td width='124'>&nbsp;</td><td width='40' class='bluetext'>Sitemap</td><td width='20' class='bluetext' align='center'>|</td><td width='165'><input type='text' name='search' id='search' class='searchbox' value='Search Genpact'/></td><td width='55' ><input name='' type='submit' class='search' value=''  /></td></tr></table>"
document.write(h)
}
function footer()
{
f="";
f=f+"<table width='950' border='0' cellspacing='0' cellpadding='0'><tr><td width='177'><input type='text' name='textfield' class='searchbox' value='Email address'/> </td><td width='159'><a href='#'><img src='App_Themes/HomeMaster/images/button/newsletter.jpg' runat='server' width='152' height='19' border='0' /></a></td><td width='273'>&nbsp;</td><td width='38' class='bluetext'>Privacy</td><td width='20'  class='footertext' align='center'>|</td><td width='90' class='bluetext'>Term & Conditions</td><td width='19'  class='footertext' align='center'>|</td><td width='174' class='footertext' align='right'>&copy; <script language='javascript'>pyear()</script>, Genpact. All rights reserved.</td></tr></table>"
document.write(f)
}
function Subfooter()
{
f="";
f=f+"<table width='950' border='0' cellspacing='0' cellpadding='0'><tr><td width='177'><input type='text' name='textfield' class='searchbox' value='Email address'/> </td><td width='159'><a href='#'><img src='../App_Themes/HomeMaster/images/button/newsletter.jpg' runat='server' width='152' height='19' border='0' /></a></td><td width='273'>&nbsp;</td><td width='38' class='bluetext'>Privacy</td><td width='20'  class='footertext' align='center'>|</td><td width='90' class='bluetext'>Term & Conditions</td><td width='19'  class='footertext' align='center'>|</td><td width='174' class='footertext' align='right'>&copy; <script language='javascript'>pyear()</script>, Genpact. All rights reserved.</td></tr></table>"
document.write(f)
}
//Search
function validate()
           {
                var search_len=document.getElementById("ctl00_q").value.length;
                if(search_len<1)
                {
                    alert("Please enter atleast one characters to complete your search.")
		            document.getElementById("ctl00_q").focus()
		            return false
                }
                else
                {
                    var newloc="http://genpact.com/search.aspx?cx=012464754164421564711%3Aevootvtwmy8&cof=FORID%3A10%3BNB%3A1&ie=UTF-8&q='" + document.getElementById('ctl00_q').value + "'&sa=Search";
                    window.location.href=newloc;
                    return false;
                } 
                return true;
           }
           function searchValid(e)
           {
                var k;  
                var searchTxt;
                if(document.all)
                    k=e.keyCode;
                else
                    k=e.which;
                if(window.event)
                    k=e.keyCode
                    
                if(k==13)
                {
                    return(validate());
                }
                return true;
           }
//End of Search

//Download

function showdeadcenterdiv(Xwidth,Yheight,divid) {
        // First, determine how much the visitor has scrolled

        var scrolledX, scrolledY;
        if( self.pageYOffset ) {
        scrolledX = self.pageXOffset;
        scrolledY = self.pageYOffset;
        } else if( document.documentElement && document.documentElement.scrollTop ) {
        scrolledX = document.documentElement.scrollLeft;
        scrolledY = document.documentElement.scrollTop;
        } else if( document.body ) {
        scrolledX = document.body.scrollLeft;
        scrolledY = document.body.scrollTop;
        }
        
        // Next, determine the coordinates of the center of browser's window
        
        var centerX, centerY;
        if( self.innerHeight ) {
        centerX = self.innerWidth;
        centerY = self.innerHeight;
        } else if( document.documentElement && document.documentElement.clientHeight ) {
        centerX = document.documentElement.clientWidth;
        centerY = document.documentElement.clientHeight;
        } else if( document.body ) {
        centerX = document.body.clientWidth;
        centerY = document.body.clientHeight;
        }
        // Xwidth is the width of the div, Yheight is the height of the
        // div passed as arguments to the function:
        var leftOffset = scrolledX + (centerX - Xwidth) / 2;
        var topOffset = scrolledY + (centerY - Yheight) / 2;
        // The initial width and height of the div can be set in the
        // style sheet with display:none; divid is passed as an argument to // the function
        var o=document.getElementById(divid);
        var r=o.style;
        r.position='absolute';
        r.top = topOffset + 'px';
        r.left = leftOffset + 'px';
        r.display = "block";
        } 
function show2(name)
{
    //alert(document.getElementById('<%=hdnval1.ClientID %>').value);
    objval=document.getElementById('<%=hdnval1.ClientID %>');
    document.getElementById('<%=hdnfileName.ClientID %>').value=name;
    if(objval.value=='1')
    {
        showdeadcenterdiv('250','220','<%=divUserDetails.ClientID %>');    
        return false;
    }
    else
    {
        window.open(name,'download','');
        return true;
    }
}

function ShowDivDownLoad()
{
    var subCtrl=document.getElementById('<%=divUserDetails.ClientID %>');
    subCtrl.style.display="block";
    document.getElementById(divUserDetails).style.left=window.screen.width/2- 200; 
    return true;
}

function CatchEnterEvent(e)
{
    if (!e) e = window.event;
    var k;
    if (e.keyCode) k = e.keyCode;
    else if (e.which) k = e.which;
    if (k ==13) 
    {
        divValidation();
        return false;
    }
}

function HideDivDownload()
{
    var subCtrl=document.getElementById('<%=divUserDetails.ClientID %>');
    if(subCtrl.style.display=="block")
        {
            subCtrl.style.display="none";
        }   
}

function divValidation()
{
    objname=document.getElementById('<%=txtName.ClientID %>');
    objlname=document.getElementById('<%=txtlname.ClientID %>');
    objemail=document.getElementById('<%=txtEmail.ClientID %>');
    objtitle=document.getElementById('<%=txttitle.ClientID %>');
    objcomp=document.getElementById('<%=txtcompany.ClientID %>');
    if(objname.value=="")
    {
        alert('Please enter first name.');
        objname.focus();
        return false;
    }
    if(objlname.value=="")
    {
        alert('Please enter last name.');
        objlname.focus();
        return false;
    }
    if(objtitle.value=="")
    {
        alert('Please enter a title.');
        objtitle.focus();
        return false;
    }
    if(objemail.value=="")
    {
        alert('Please enter a valid E-mail format.');
        objemail.focus();
        return false;
    }
    if(objemail.value!="")
    {
        if(objemail.value.indexOf("..")==-1)
	    {
            regExp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/; 
          	if (!regExp.test(objemail.value)) 
          	{
                alert("Please enter a valid E-mail format.");
           	    objemail.focus();
            	return false;
          	}
	    }
	    else
	    {
	        alert("Please enter a valid E-mail format.");
           	objemail.focus();
            return false;
	    }
    }
	
	if(objcomp.value=="")
    {
        alert('Please enter a company name.');
        objcomp.focus();
        return false;
    }
    document.getElementById('<%=divUserDetails.ClientID %>').style.display='none';
    document.getElementById('<%=hdnval1.ClientID %>').value='0';
    show2(document.getElementById('<%=hdnfileName.ClientID %>').value);
    return true;
}


//End of download
