
var classname_container="";

//********************************************************************//
//********************************************************************//
//16:25 PM 2/21/2009: Sarup:  For Ajax object initialization          //
//********************************************************************//
//********************************************************************//

function createObject()
{
  if(window.XMLHttpRequest)
	{
    var obj	= new XMLHttpRequest();
	}	
  else
  	{
    var obj	= new ActiveXObject('Microsoft.XMLHTTP');
	}
 return obj;
}
var httpobj	= createObject();
// End:  For Ajax object initialization  // 

//********************************************************************//
//********************************************************************//
//12:25 PM 2/27/2009: Sarup:  Ajax responce for news Title and details//
//********************************************************************//
//********************************************************************//
function GetPager(idobj)
{
	var curid = document.getElementById('tt').value
	var url='ajax_pager_response.php?curid='+curid;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandlePager;
	httpobj.send(null);
}
function HandlePager()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showpager').innerHTML = text;
	 }
}
 
function GetPager1(idobj)
{
	var curid = document.getElementById('tt').value
	var url='ajax_pager1_response.php?curid='+curid;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandlePager1;
	httpobj.send(null);
}

function HandlePager1()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showpager').innerHTML = text;
	 }
}

function GetPager2(idobj)
{
	var curid = document.getElementById('tt').value
	var url='ajax_pager2_response.php?curid='+curid;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandlePager2;
	httpobj.send(null);
}

function HandlePager2()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showpager').innerHTML = text;
	 }
}


//********************************************************************//
//********************************************************************//
//12:25 PM 2/27/2009: Sarup:  Ajax responce for news Title and details in archive//
//********************************************************************//
//********************************************************************//

function archivedetails(objid)
{
	Getarchive(objid);
}

function Getarchive(idobj)
{
	//var id = idobj.id;
	var id = idobj;
	var url='ajax_archive_response.php?details=1&id='+id+'&clsname='+classname_container;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = handlearchive;
	httpobj.send(null);
}

function handlearchive()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showarchivedetail').innerHTML = text;
	 }
}

function GetarchiveTitle(idobj)
{
	var id = idobj.id;
	var url='ajax_archive_response.php?title=1&id='+id;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandlearchiveTitle;
	httpobj.send(null);
}

function HandlearchiveTitle()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showarchivetitle').innerHTML = text;
		 //document.getElementById('shownewsdetail').innerHTML = "<div class='content2' ><a class='servicetext' href='#'>Click image to view details.</a></div>";

	 }
}
//End : Ajax responce for news Title and details//



//********************************************************************//
//********************************************************************//
//12:25 PM 2/27/2009: Sarup:  Ajax responce for news Title and details//
//********************************************************************//
//********************************************************************//

function newsdetails(objid)
{
	GetNews(objid);
}

function GetNews(idobj)
{
	//var id = idobj.id;
	var id = idobj;
	var url='ajax_news_response.php?details=1&id='+id+'&clsname='+classname_container;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = handleNews;
	httpobj.send(null);
}

function handleNews()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('shownewsdetail').innerHTML = text;
	 }
}

function GetnewsTitle(idobj)
{
	//var id = idobj.id;
	var id = idobj;
	var url='ajax_news_response.php?title=1&id='+id;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandleNewsTitle;
	httpobj.send(null);
}

function HandleNewsTitle()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('shownewstitle').innerHTML = text;
		 //document.getElementById('shownewsdetail').innerHTML = "<div class='content2' ><a class='servicetext' href='#'>Click image to view details.</a></div>";

	 }
}
//End : Ajax responce for news Title and details//

//********************************************************************//
//********************************************************************//
//10:25 PM 2/27/2009: Sarup:  Detail window scroller buttons handling.//
//********************************************************************//
//********************************************************************//

scrollStep=1;
timerLeft="";
timerRight="";
function toLeft(id)
{
  document.getElementById(id).scrollLeft=0;
}

function scrollDivLeft(id)
{
  clearTimeout(timerRight);
  document.getElementById(id).scrollLeft+=scrollStep;
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10);
}

function scrollDivRight(id)
{
  clearTimeout(timerLeft);
  document.getElementById(id).scrollLeft-=scrollStep;
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10);
}

function toRight(id)
{
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth;
}

function stopMe()
{
  clearTimeout(timerRight);
  clearTimeout(timerLeft);
}

//End : Detail window scroller buttons handling//

//************************************************************************//
//************************************************************************//
//12:25 PM 2/27/2009: Sarup:  Ajax responce for services Title and details//
//************************************************************************//
//************************************************************************//

function servicesdetails(objid)
{
	Getservices(objid);
}

function Getservices(idobj)
{
	//var id = idobj.id;
	var id = idobj;
	//alert('helo '+id);
	var url='ajax_services_response.php?details=1&id='+id+'&clsname='+classname_container;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = handleservices;
	httpobj.send(null);
}

function handleservices()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showservicedetails').innerHTML = text;
	 }
}

function GetservicesTitle(idobj)
{
	var id = idobj.id;
	var url='ajax_services_response.php?title=1&id='+id;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandleservicesTitle;
	httpobj.send(null);
}

function HandleservicesTitle()
{
	 if(httpobj.readyState==4)
	 {
		 text = httpobj.responseText;
		 document.getElementById('showservicestitle').innerHTML = text;
		 //document.getElementById('showservicedetails').innerHTML = "<div class='content2' ><a class='servicetext' href='#'>Click image to view details.</a></div>";

	 }
}
//End : Ajax responce for services Title and details//

//************************************************************************//
//************************************************************************//
//12:25 PM 2/27/2009: Sarup:  Ajax responce for people Title and details//
//************************************************************************//
//************************************************************************//

function peopledetails(objid)
{
	Getpeople(objid);
}

function Getpeople(idobj)
{
	//var id = idobj.id;
	var id = idobj;
	var url='ajax_people_response.php?details=1&id='+id+'&clsname='+classname_container;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = handlepeople;
	httpobj.send(null);
}

function handlepeople()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showpeopledetail').innerHTML = text;
	 }
}

function GetpeopleTitle(idobj)
{
	var id = idobj.id;
	var url='ajax_people_response.php?title=1&id='+id;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandlepeopleTitle;
	httpobj.send(null);
}

function HandlepeopleTitle()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showpeopletitle').innerHTML = text;
		 //document.getElementById('showpeopledetail').innerHTML = "<div class='content2' ><a class='servicetext' href='#'>Click image to view details.</a></div>";

	 }
}
//End : Ajax responce for people Title and details//

//************************************************************************//
//************************************************************************//
//12:25 PM 2/27/2009: Sarup:  Ajax responce for portfolio Title and details//
//************************************************************************//
//************************************************************************//

function portfoliodetails(objid)
{
	Getportfolio(objid);
}

function Getportfolio(idobj)
{
	//var id= idobj.id;
	var id= idobj;
	var url='ajax_portfolio_response.php?details=1&id='+id+'&clsname='+classname_container;
	redirect = url;
	//alert(url);
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = handleportfolio;
	httpobj.send(null);
}

function handleportfolio()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('showportfoliodetail').innerHTML = text;
		//alert(document.getElementById('showportfoliodetail').innerHTML);

	 }
}
function GetportfolioTitle(idobj)
{
	var id = idobj.id;
	var url='ajax_portfolio_response.php?title=1&id='+id;
	//alert(url);
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = HandleportfolioTitle;
	httpobj.send(null);
	//onComplete:Getportfolio(id);
}

function HandleportfolioTitle()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 //alert(text);
		 document.getElementById('showportfoliotitle').innerHTML = text;
		 //document.getElementById('showportfoliodetail').innerHTML = "<div class='content2' ><a class='servicetext' href='#'>Click image to view details.</a></div>";
	 }
}
//End : Ajax responce for portfolio Title and details//


//************************************************************************//
//************************************************************************//
//1:07 PM 3/2/2009: Sarup:  Ajax responce for new headlines               //
//************************************************************************//
//************************************************************************//

function GetHeadlines()
{
	var url='ajax_headlines_response.php?newid='+i;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = Handleheadlines;
	httpobj.send(null);
	return;
}

function Handleheadlines()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('newstext').innerHTML = text;
	 }
	 return;
}


//************************************************************************//
//************************************************************************//
//6:53 PM 3/13/2009: Sarup:  Ajax response for weblink                    //
//************************************************************************//
//************************************************************************//

function Getweblink(idobj)
{
	var id = idobj;
	var url='ajax_weblink_response.php?id='+id;
	redirect = url;
	httpobj.open('get',redirect);
	httpobj.onreadystatechange = handleweblink;
	httpobj.send(null);
}

function handleweblink()
{
	 if(httpobj.readyState==4)
	 {
		 text=httpobj.responseText;
		 document.getElementById('weblink').innerHTML = text;
	 }
}

function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) 
	  { 
	  Char = sText.charAt(i); 
	  if (ValidChars.indexOf(Char) == -1) 
		 {
		 IsNumber = false;
		 }
	  }
	return IsNumber;
}




// variable for top of the object
var PopupOpenTop
// variable for left of the object
var PopupLeft
// variable for browser check
var isMozilla;
// variable for Div Object
var objDiv = null;
// variable for geting Content of Div
var originalDivHTML = "";
// variable for Div
var DivID = "";
// variable for geting status of mouseover
var over = false;



function FindPosition(divID) {
	var obj;
	obj=document.getElementById(divID);
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	PopupLeft=curleft
	PopupOpenTop=curtop
	//alert(curleft+' '+curtop);
}


function DisplayWindow(divID)
		    {

			FindPosition(divID)
		        var w, h, l, t;
		     
                if (divID=='s_menu')
				{
					divId='submenu1';
				}
				else if (divID=='p_menu')
				{
					divId='submenu2';
				}
				else if (divID=='po_menu')
				{
					divId='submenu3';
				}
				else if (divID=='n_menu')
				{
					divId='submenu4';
				}
	t=PopupOpenTop+38
    l=PopupLeft
	//alert(PopupOpenTop+' '+PopupLeft);
	document.getElementById(divId).style.left = l + 'px';
    document.getElementById(divId).style.top = t + 'px';
	//document.getElementById(divId).className = divId;
	document.getElementById(divId).style.visibility = "visible";
	document.getElementById(divId).style.display= "";

		    }



function hiddenFloatingDiv(divId) 
{
	//alert(divId);
	if(divId==''){
	document.getElementById('submenu1').style.visibility='hidden';
	document.getElementById('submenu2').style.visibility='hidden';
	document.getElementById('submenu3').style.visibility='hidden';
	document.getElementById('submenu4').style.visibility='hidden';}
	else
	{
		document.getElementById('submenu1').style.visibility='hidden';
		document.getElementById('submenu2').style.visibility='hidden';
		document.getElementById('submenu3').style.visibility='hidden';
		document.getElementById('submenu4').style.visibility='hidden';
		document.getElementById(divId).style.visibility='visible';
	}

	
	
	//divId = "";
}

function MouseDown(e) 
{
    if (over)
    {
        if (isMozilla) {
            objDiv = document.getElementById(DivID);
            X = e.layerX;
            Y = e.layerY;
            return false;
        }
        else {
            objDiv = document.getElementById(DivID);
            objDiv = objDiv.style;
            X = event.offsetX;
            Y = event.offsetY;
			return false;
        }
    }
}


function MouseMove(e) 
{
    if (objDiv) {
        if (isMozilla) {
            objDiv.style.top = (e.pageY-Y) + 'px';
            objDiv.style.left = (e.pageX-X) + 'px';
            return false;
        }
        else 
        {
			
            objDiv.pixelLeft = event.clientX-X + document.body.scrollLeft;
            objDiv.pixelTop = event.clientY-Y + document.body.scrollTop;
            return false;
        }
    }
}
function MouseUp() 
{
    objDiv = null;
}


function init()
{
    // check browser
    isMozilla = (document.all) ? 0 : 1;

    if (isMozilla) 
    {
        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
    }

    document.onmousedown = MouseDown;
    document.onmousemove = MouseMove;
    document.onmouseup = MouseUp;
}
