﻿var _currentTab = 1;
var cobjno = 1;
     
       function showvacancy(vacancypage)
      {
         settings='menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes,status=yes,width=660,height=590';    
     window.open(vacancypage,'Vacancy',settings);
      }
      
      function show(sname)
  {
    document.getElementById(sname).style.display = "block";
    
  }
  function hide(sname)
  {
    document.getElementById(sname).style.display = "none";
    
  }
  
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showpic(picno)
     {
        cobj = document.getElementById("pic" + cobjno);
        cobj.style.display = "none";
        
        lobj = document.getElementById("l" + cobjno);
        lobj.className = "";
        
        nobj = document.getElementById("pic" + picno);
        nobj.style.display = "block";
     
        lobj = document.getElementById("l" + picno);
        lobj.className = "sel";
        
     cobjno = picno;
     }
     
function showTab(tabNo)
{
	obj = document.getElementById(_currentTab);
    obj.className = "tab";
 
    obj = document.getElementById(tabNo);
    obj.className = "seltab";
	
	document.getElementById("tab" + _currentTab).style.display = "none";
	
	document.getElementById("tab" + tabNo).style.display = "block";

	
	_currentTab = tabNo;
}

function viewbrochure(bid)
{
 settings='menubar=no,toolbar=no,status=no,resizable=yes';
    window.open("ViewBrochure.aspx?bid=" + bid, "Brochure", settings);
}
function showsignin()
{
    document.getElementById("overlay").style.display = "block";
   document.getElementById("overlay").style.height = GetPageSize()[1] + "px";
   document.getElementById("PopUpSignIn").style.display = "block";
}
function closesignin()
{
    document.getElementById("overlay").style.display = "none";
    
    document.getElementById("PopUpSignIn").style.display = "none";
}

function showplot(encpd)
{
//    document.getElementById("SelSite").value = sc;
//    document.getElementById("SelPlot").value = sc;
//    document.getElementById("pdetail").src = "plotdetail.aspx?sc=" + sc + "&pn=" + pid;
//    document.getElementById("overlay").style.display = "block";
//   document.getElementById("overlay").style.height = GetPageSize()[1] + "px";
//   document.getElementById("PopUpDetail").style.display = "block";
   
   
   
   window.location = "PlotDetail.aspx?c=s&pno=" + document.forms[0].pageno.value + "&x=" + encpd;
   
   return false;
   
}

function showhome(hc, b)
{
//    document.getElementById("SelSite").value = sc;
//    document.getElementById("SelPlot").value = sc;
//    document.getElementById("pdetail").src = "plotdetail.aspx?sc=" + sc + "&pn=" + pid;
//    document.getElementById("overlay").style.display = "block";
//   document.getElementById("overlay").style.height = GetPageSize()[1] + "px";
//   document.getElementById("PopUpDetail").style.display = "block";
   
   window.location = "HomeDetail.aspx?hc=" + hc + "&b=" + b;
   
}

function ClosePlot()
{
    document.getElementById("overlay").style.display = "none";
    
    document.getElementById("PopUpDetail").style.display = "none";
}
function setplot(pn)
{
    document.getElementById("SelectedPlot").value = pn;

}
function calpopup(ctl)
{
   settings='width=370,height=200,left=300,top=300,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no';
   popupcal = window.open('DatePicker.aspx?Ctl=' + ctl,'DatePicker',settings);
}
function SetDate(dateValue)
{
    ctl = window.location.search.substr(5);
    
    thisForm = window.opener.document.forms[0].elements[ctl].value = dateValue;
    
    self.close();

}
function ConfirmDelete()
{
   
    return confirm("Are you sure you wish to delete this?");
}
function SetNewColor(source)
{
    _oldColor = source.style.backgroundColor;
    source.style.backgroundColor = '#CCC';
}
  
function SetOldColor(source)
{
    source.style.backgroundColor = _oldColor;
}

function setoverlay(onoff)
{
    if (onoff == "on")
    {
        document.getElementById("overlay").style.display = "block";
        document.getElementById("overlay").style.height = GetPageSize()[1] + "px";
    }
    else
    {
        document.getElementById("overlay").style.display = "none";
    }
}


function popup()
{
   document.getElementById("overlay").style.display = "block";
   document.getElementById("overlay").style.height = GetPageSize()[1] + "px";
   document.getElementById("PopUpMessage").style.display = "block";
  
}
   
function ClosePopUp()
{
    document.getElementById("overlay").style.display = "none";
    
    document.getElementById("PopUpMessage").style.display = "none";
}

function GetPageSize() 
{	
	var xScroll, yScroll, windowWidth, windowHeight;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.scrollWidth;
		yScroll = self.innerHeight + self.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = document.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < document.body.offsetWidth) ? document.body.offsetWidth : xScroll;
		yScroll = (yScroll < document.body.offsetHeight) ? document.body.offsetHeight : yScroll;
	}
	
	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = document.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? document.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? document.body.clientHeight : windowHeight;
	}
	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	
	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
};