// Login Control functions

/*********Image Gallery functions**************/
var rotate_delay = 2000; // delay in milliseconds (5000 = 5 secs)
    current = 0;
    
    var sliderDiv = null;
    var galleryDiv = null;
    
    var sliderBtn = null;
    var galleryBtn = null;

    var controlsDiv = null;
    var imgSlider = null;
    var imgSliderbutton = null;
    var namesSlider = null;
    var datesSlider = null;
    var descSlider = null;
    var txtName = null;
    var txtDesc = null;
    var txtDate = null;
    var imgWidth=null;
    
    function ActivatePage(page, pagesCount)
    {
        debugger;
        var pageID;
        for(i=0;i<pagesCount; i++)
        {
            pageID = document.getElementById('GalleryPage_' + i);
            
            if(pageID != null)
            {
                if( page != i )
                    pageID.style.display = "none";
                else
                    pageID.style.display = "block";
            }
        }
    }
    function ShowGallery()
    {
        init();
        if(( galleryDiv != null) && (sliderDiv != null))
        {   
            galleryDiv.style.display = "block";
            sliderDiv.style.display = "none";
            controlsDiv.style.display = "none";
            galleryBtn.src = "/design/Images/_migdal/Gallery/picture_chosen.gif";
            sliderBtn.src = "/design/Images/_migdal/Gallery/presentation.gif";
            
       }
    }
    function ShowSlideshow()
    {
        init();
        if(( galleryDiv != null) && (sliderDiv != null))
        {   
            galleryDiv.style.display = "none";
            sliderDiv.style.display = "block";
            controlsDiv.style.display = "block";
          
            galleryBtn.src = "/design/Images/_migdal/Gallery/picture.gif";
            sliderBtn.src = "/design/Images/_migdal/Gallery/presentation_chosen.gif";
         }
    }
    function init()
    {
    
        if( controlsDiv == null )
            controlsDiv = document.getElementById('controls');

        if( sliderBtn == null )
            sliderBtn = document.getElementById('btnSlide');
        if( galleryBtn == null )
            galleryBtn = document.getElementById('btnGallery');

        if( sliderDiv == null )
            sliderDiv = document.getElementById('sliderDiv');
        if( galleryDiv == null )
            galleryDiv = document.getElementById('pictureDiv');
        
        if( imgSlider == null )
            imgSlider = document.getElementById('ddlslide');
        if( namesSlider == null )
            namesSlider = document.getElementById('ddlslidename');
      
      if( imgWidth == null )
            imgWidth = document.getElementById('ddlslidewidth');
       
       
        if( descSlider == null )
            descSlider = document.getElementById('ddlslidedesc');
            
        if( datesSlider == null )
            datesSlider = document.getElementById('ddlslidedate');
            
       if(imgSliderbutton == null )
            imgSliderbutton = document.getElementById('imgSliderbutton');
            
        if(txtName == null )
            txtName = document.getElementById('txtName');

        if(txtDesc == null )
            txtDesc = document.getElementById('txtDesc');

        if(txtDate == null )
            txtDate = document.getElementById('txtDate');

    }

    function getFormatDate(str)
    {
        if( str == null )
            return "";
        
        if( str.length > 10)
            return str.substring(0,10);
        else
           return str;
    }
    function next() {
     
        init();
        if( imgSlider != null)
        {   
            if (imgSlider[current+1]) {
                document.images.show.src = imgSlider[current+1].value;
                 document.images.show.style.width = imgWidth[current+1].value;
            document.images.show.style.height = imgWidth[current+1].text;
                txtName.innerHTML = namesSlider[current+1].value;
                txtDesc.innerHTML = descSlider[current+1].value;
                txtDate.innerHTML = getFormatDate(datesSlider[current+1].value);
                imgSlider.selectedIndex = ++current;
           }
           else first();
        }
    }
    

    function previous() {
     
        init();
        if( imgSlider != null)
        {
            if (current-1 >= 0) {
                document.images.show.src = imgSlider[current-1].value;
                 document.images.show.style.width = imgWidth[current-1].value;
            document.images.show.style.height = imgWidth[current-1].text;
                 txtName.innerHTML = namesSlider[current-1].value;
                txtDesc.innerHTML = descSlider[current-1].value;
                txtDate.innerHTML = getFormatDate(datesSlider[current-1].value);
                imgSlider.selectedIndex = --current;
        }
        else last();
        }
    }

    function first() {
        init();
        if( imgSlider != null)
        {
            current = 0;
            document.images.show.src = imgSlider[current].value;
             document.images.show.style.width = imgWidth[current].value;
            document.images.show.style.height = imgWidth[current].text;
            txtName.innerHTML = namesSlider[current].value;
                txtDesc.innerHTML = descSlider[current].value;
                txtDate.innerHTML = getFormatDate(datesSlider[current].value);
            imgSlider.selectedIndex = 0;
        }
    }
    function last() {
   
        init();
        if( imgSlider != null)
        {
            current = imgSlider.length-1;
            document.images.show.src = imgSlider[current].value;
            document.images.show.style.width = imgWidth[current].value;
            document.images.show.style.height = imgWidth[current].text;
            txtName.innerHTML = namesSlider[current].value;
                txtDesc.innerHTML = descSlider[current].value;
                txtDate.innerHTML = getFormatDate(datesSlider[current].value);
            imgSlider.selectedIndex = current;
        }
    }
    function ap(text) {
        init();
        if( imgSlider != null)
        {
            imgSliderbutton.value = (text == "Stop") ? "Start" : "Stop";
            rotate();
        }
    }
    function change() {
    
        init();
        if( imgSlider != null)
        {
            current = imgSlider.selectedIndex;
            document.images.show.src = imgSlider[current].value;
             document.images.show.style.width = imgWidth[current].value;
            document.images.show.style.height = imgWidth[current].text;
            
            txtName.innerHTML = namesSlider[current].value;
                txtDesc.innerHTML = descSlider[current].value;
                txtDate.innerHTML = getFormatDate(datesSlider[current].value);
        }
    }
    function rotate() {
        init();
        if( imgSlider != null)
        {
            if (imgSliderbutton.value == "Stop") {
                imgSliderbutton.src = "/design/Images/_migdal/Gallery/but_paus.gif";
                current = (current == imgSlider.length-1) ? 0 : current+1;
                document.images.show.src = imgSlider[current].value;
                 document.images.show.style.width = imgWidth[current].value;
            document.images.show.style.height = imgWidth[current].text;
                txtName.innerHTML = namesSlider[current].value;
                txtDesc.innerHTML = descSlider[current].value;
                txtDate.innerHTML = getFormatDate(datesSlider[current].value);
                imgSlider.selectedIndex = current;
                window.setTimeout("rotate()", rotate_delay);
            }
            else
                imgSliderbutton.src = "/design/Images/_migdal/Gallery/but_play.gif";
       }
    }
    function SetImgSrc(oImg, sSrc)
    {
   
       if(oImg != null)
         oImg.src = "/design/Images/_migdal/Gallery/" + sSrc;
         
         
    }

/***********************/
var isFirstFocusOnUserNameControl = true;
var EditMode = false;

function SetCorners()
{
    var parentTR;   
    var lang = 	'rtl';
    var rtlClassName, ltrClassName;
    for (var x=1; x < 30; x++) 
    {                                       
        var wpTD = document.getElementById('WebPartTitleWPQ' + x);
        if (wpTD) 
        {
            parentTR = wpTD.parentNode;
            for (var i=0; i < parentTR.childNodes.length; i++)
            {
                parentTR.childNodes[i].className = 'SterchGrad';
            } 
            var rightCell = document.createElement("td"); 
            var leftCell = document.createElement("td");
            var imageCell = document.createElement("td");
            parentTR.appendChild(rightCell); 
            parentTR.insertBefore( leftCell,wpTD); 
            parentTR.insertBefore(imageCell, wpTD);
            if(lang == "rtl")
            {
                imageCell.className = "RtlWpImage";
                imageCell.innerHTML = "<table cellpadding='0' border='0' cellspacing='0' style='height:24px'><tr><td>&nbsp;</td></tr></table>";
                leftCell.className = "RtlRightImage";
                leftCell.innerHTML = "<table cellpadding='0' border='0' cellspacing='0' style='height:24px'><tr><td>&nbsp;</td></tr></table>";
                rightCell.className = "RtlCustomLeftImage"; 
                rightCell.innerHTML = "<table  cellpadding='0' border='0' cellspacing='0' style='height:24px'><tr><td >&nbsp;</td></tr></table>";}
            else
            {
                imageCell.className = "LtrWpImage";
                imageCell.innerHTML = "<table cellpadding='0' border='0' cellspacing='0' style='height:24px'><tr><td>&nbsp;</td></tr></table>";
                leftCell.className = "LtrCustomLeftImage";
                leftCell.innerHTML = "<table cellpadding='0' border='0' cellspacing='0' style='height:24px'><tr><td>&nbsp;</td></tr></table>";
                rightCell.className = "LtrRightImage";
                rightCell.innerHTML = "<table  cellpadding='0' border='0' cellspacing='0' style='height:24px'><tr><td >&nbsp;</td></tr></table>";
            }
         }
     }//for
     //setScrolling();
 }// JScript source code
     
function switchToPass(objRef,cssClassName)
{
	n = objRef.name;
	newInput = document.createElement("INPUT");
	newInput.type = "password";
	newInput.name = objRef.name;
	newInput.value = "";
	newInput.style.width = objRef.offsetWidth;	
	newInput.style.height = objRef.offsetHeight;
	newInput.className = cssClassName;
	passParent = objRef.parentNode;
	passParent.replaceChild(newInput, objRef);
	x = setTimeout(function()
	                {
	                  newInput.focus()
	                },150);
} 
function username_focus(objRef)
{	
	if (isFirstFocusOnUserNameControl)
	{
		objRef.value='';
		isFirstFocusOnUserNameControl = false;
	}
}
function IdCheck(sender, args)
{
    var iIdNumber = parseInt(args.Value);
    if (ClientIDValidate(iIdNumber)) 
    {    
        args.IsValid = true;
    }
    else
    {
       args.IsValid = false;
       return;
    }
}
function ClientIDValidate(idnumber)
{
    var strID = idnumber.toString();
    var leng = strID.length;
    var objRegExp = new RegExp("[^0-9]","g");
    

    if(leng < 9) // checking for leading zero
    {
        var addNull = 9 - leng;
        var addn = "0";
        for( i = 1; i <= (addNull-1); i++ )
        {
            addn += "0";
        }
        strID = addn + idnumber;
        leng = 9;
    }

    if(objRegExp.test(strID))
    {
        return false;
    }
    //****** Algorithm CheckID Number *******************************
    var sum = 0;
    var mul = 1;
    var result;
    var sum2;
    for( var i = 0; i <= (leng - 2); i++ )
    {
    sum2 = mul * Number( strID.substr(i,1) );
    if( sum2 > 9 )
    {
    sum2 -= 9;
    }
    sum += sum2;
    mul = 3 - mul;
    }

    sum = sum % 10;
    var result = 10 - sum;
    if( result == 10 )
    result = 0;

    if( Number( strID.substr(i,1) ) != result )
    {
        return false;
    }
    //ID passed successfuly
    return true;
}




// End Login Control functions

function SaveAsHtml()
{
    if (document.all) 
    {
    
        var OLECMDID_SAVEAS = 4;

        var OLECMDEXECOPT_DONTPROMPTUSER = 2;

        var OLECMDEXECOPT_PROMPTUSER = 1;

        var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";

        document.body.insertAdjacentHTML("beforeEnd", WebBrowser);

        WebBrowser1.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER);

        WebBrowser1.outerHTML = "";
    } 
    else 
    {
        alert("This is only applicable to Internet Explorer");
    }
}


/* Begin webpart design*/
function SetWebpartBorder()
{
	var arrTableCells = document.getElementsByTagName("td");
	var i = 0;
	
	while(i < arrTableCells.length)
	{
		var cell = arrTableCells[i];
		if(cell.className.toLowerCase() == "ms-wpborder")
		{ 
		    WrapWebpart(cell, false); 
		}
		if(cell.className.toLowerCase() == "ms-wpborderborderonly")
		{  
		    WrapWebpart(cell, true); 
		}
		++i;
	}
	
	var arrTableRows = document.getElementsByTagName("tr");
	var i = 0;
	while(i < arrTableRows.length)
	{
		if(arrTableRows[i].className.toLowerCase() == "ms-wpheader")
		{
			AddBorderCell(arrTableRows[i]);
		}
		++i;
	}
}

function AddBorderCell(parentTr)
{
	var customTd = document.createElement("td");
	customTd.innerHTML = "&nbsp;"
	customTd.className = "ms-WPHeaderSideTd";
	parentTr.appendChild(customTd);
}

function WrapWebpart(cell, addHeaderRow)
{
	var arrDivs = cell.getElementsByTagName("div");
	var div = arrDivs[0];
	var wpMainTable= div.getElementsByTagName('table');
	var HasCombo=null;
	if (wpMainTable[0]!=null && wpMainTable[0]!='undefined')
	{
	    HasCombo =wpMainTable[0].getAttribute('cancel_JS_Border');
	}
	if(HasCombo==null || HasCombo=='')
	{
	    var sInnerTable = "";
	    sInnerTable += "<table cellpadding='0' cellspacing='0' width='100%'>";

	    if(addHeaderRow)
	    {
	        sInnerTable += " <tr>";
	        sInnerTable += "     <td class='ms-WPTopLeft'></td>";
	        sInnerTable += "     <td class='ms-WPTopMid'></td>";
	        sInnerTable += "     <td class='ms-WPTopRight'></td>";
	        sInnerTable += " </tr>";
	    }
    	
	    sInnerTable += " <tr>";
	    sInnerTable += "     <td class='ms-WPMidLeft'>&nbsp;</td>";
	    sInnerTable += "     <td class='" + div.className + "'>" + div.innerHTML + "</td>";
	    sInnerTable += "     <td class='ms-WPMidRight'>&nbsp;</td>";
	    sInnerTable += " </tr>";
	    sInnerTable += " <tr>";
	    sInnerTable += "     <td class='ms-WPBottomLeft'></td>";
	    sInnerTable += "     <td class='ms-WPBottomMid'></td>";
	    sInnerTable += "     <td class='ms-WPBottomRight'></td>";
	    sInnerTable += " </tr>";
	    sInnerTable += "</table>";
    	
	    try
	    {
	        div.innerHTML = sInnerTable;
	    }
	    catch(err)
	    {
	        //alert(err);
	    }
    }
}

/* End webpart design*/

/* Master Pages Common Functions */
function HideEmptyZones()
{	

    var CountLeftAdvertisementZone =0;
    var ObjTblLeftAdvertisementZone = document.getElementById("tblLeftAdvertisementZone");
    
    //tdLeftAdvertisementZoneInner
    var CountPlaceHolderVerticalBanner =0;
    var ObjTdPlaceHolderVerticalBanner = document.getElementById("tdPlaceHolderVerticalBanner");
	var Count = 0;
	Count = WebpartZoneIsNotEmpty("tdLeftTop") + WebpartZoneIsNotEmpty("tdCenterTop") + WebpartZoneIsNotEmpty("tdRightTop");
	HideEmptyElement("tdRightTop", Count);
	HideEmptyElement("tdCenterTop", Count, "tdRightTop");
	HideEmptyElement("tdLeftTop", Count, "tdCenterTop");

	Count = WebpartZoneIsNotEmpty("tdLeftBottom") + WebpartZoneIsNotEmpty("tdCenterBottom") + WebpartZoneIsNotEmpty("tdRightBottom");
	HideEmptyElement("tdRightBottom", Count);
	HideEmptyElement("tdCenterBottom", Count, "tdRightBottom");
	HideEmptyElement("tdLeftBottom", Count, "tdCenterBottom");
	CountLeftAdvertisementZone = WebpartZoneIsNotEmpty("tdLeftAdvertisementZoneInner");
	CountPlaceHolderVerticalBanner = WebpartZoneIsNotEmpty("tdPlaceHolderVerticalBanner");
	
	if (CountPlaceHolderVerticalBanner==0)
	{
	    if (ObjTdPlaceHolderVerticalBanner!=null)
	    {
	        ObjTdPlaceHolderVerticalBanner.style.display = "none";
	    }
	}
	else
	{
	    if (ObjTdPlaceHolderVerticalBanner!=null)
	    {
	        ObjTdPlaceHolderVerticalBanner.style.display = "";
	    }
	    
	}
	
	

}

function WebpartZoneIsNotEmpty(tdZoneId)
{
	var tdZone = document.getElementById(tdZoneId);
	var iWebpartZoneIsNotEmpty = 0;
	var iMinmumElements = 0;
	
	if(tdZone != null)
	{
	    if (DetectBrowser() != "1" ) //All browsers other than IE
	    {
	        iMinmumElements = 1;
	    }
	    
        if(tdZone.childNodes.length > iMinmumElements)
        {
            iWebpartZoneIsNotEmpty = 1;
        }

	}
	return iWebpartZoneIsNotEmpty;
}

function HideEmptyElement(tdZoneId, cellsCount, tdAdjecntZoneId)
{
    var tdZone = document.getElementById(tdZoneId);
    if(tdZone != null)
    {
        if (WebpartZoneIsNotEmpty(tdZoneId) == 0)
        {
            tdZone.style.display = "none";
            
        }
        else
        {
            tdZone.width = (100/cellsCount) + "%";
        }
    }
}
/* End of Master Pages Common Functions */

function SetResolution()
{
    var HighResolutionCell = document.getElementById("HighResolutionCell");
    var MasterPageOuterTable = document.getElementById("MasterPageOuterTable");
    
    if(HighResolutionCell != null)
    {   
        if (screen.width >= 920)
        {
            HighResolutionCell.style.display = "";
        }
        else
        {
            MasterPageOuterTable.className = "masterContent";
        }
    }
}

function DetectBrowser()
{
    if (navigator.userAgent.indexOf("MSIE") != -1)
    {
        return "1";
    }
    else
    {
        return "2";
    }
}

// this method serves both the master pages and the search result page layout
function ModifySearchButton(containerId)
{
    var oSearchButton = null;
    if(containerId == null)
    {
        oSearchButton = document.getElementById("SRSB");
     }
     else
     {
        var container = document.getElementById(containerId);
        if(container != null)
        {
            var arrDivs = container.getElementsByTagName("div");
            if(arrDivs != null)
            {
                var i = 0;
                while(i < arrDivs.length && oSearchButton == null)
                {
                    if(arrDivs[i].id.toUpperCase() == "SRSB")
                    {
                        oSearchButton = arrDivs[i];
                    }
                    ++i;
                }
            }
        }
     }

    if(oSearchButton != null)
    {
        var arrImages = oSearchButton.getElementsByTagName("img");
        if(arrImages != null)
        {
            if(arrImages.length > 0)
            {
                ReplaceSearchButtonImage(arrImages[0]);
            }
        }
    }
}

function ReplaceSearchButtonImage(img)
{
    var parent = img.parentNode;
    var searchSpan = document.createElement("span");
    var searchText = img.getAttribute("title");
    var searchAltText = img.getAttribute("alt");
    var spanInnerHTML = "";
    spanInnerHTML += "  <table width='100%' height='100%' cellpadding='0' cellspacing='0'>";
    spanInnerHTML += "      <tr>";
    spanInnerHTML += "          <td class='SearchBoxLeftCorner'>&nbsp;</td>";
    spanInnerHTML += "          <td class='SearchBoxCenter'>" + searchText + "</td>";
    spanInnerHTML += "          <td class='SearchBoxRightCorner'>&nbsp;</td>";
    spanInnerHTML += "      </tr>";
    spanInnerHTML += "  </table>";
    searchSpan.innerHTML = spanInnerHTML
    searchSpan.setAttribute("title", searchAltText);
    parent.removeChild(img);
    parent.parentNode.className += " SearchBoxImage";
    parent.appendChild(searchSpan);
    searchSpan.onclick = new Function("this.parentNode.click();");
}

/* Kav Manche Methods */
var arrImageSources = null;

function PopulateImageSourcesArray()
{
	var iTabsCount = 3; //
	var i = 0;		
	arrImageSources = new Array(iTabsCount);
	while(i < iTabsCount)
	{
		arrImageSources[i] = new Array(2); // two image sources for each tab (big & small)
		++i;
	}
	arrImageSources[0][0] = "http://web.bizportal.co.il/export/external/migdal/migdalxml.shtml?type=gifday";
	arrImageSources[0][1] = "http://web.bizportal.co.il/export/external/migdal/migdalxml.shtml?type=gifdayv";
	arrImageSources[1][0] = "http://web.bizportal.co.il/export/external/migdal/migdalxml.shtml?type=gifyear";
	arrImageSources[1][1] = "http://web.bizportal.co.il/export/external/migdal/migdalxml.shtml?type=gifyearv";
	arrImageSources[2][0] = "http://web.bizportal.co.il/export/external/migdal/migdalxml.shtml?type=gifyears";
	arrImageSources[2][1] = "http://web.bizportal.co.il/export/external/migdal/migdalxml.shtml?type=gifyearsv";
}

function SwitchTab(tabClickedRow)
{
	var oldValue = "selected";
	var newValue = "regular";

	if(tabClickedRow.className == "regularTabRow")
	{
		if(arrImageSources == null)
		{
			PopulateImageSourcesArray();
		}
		// switch other tabs
		var MainTabsRow = document.getElementById("MainTabsRow");
		if(MainTabsRow != null)
		{
			var selectedTabRowId = MainTabsRow.getAttribute("selectedTabRowId");
			var selectedTabRow = document.getElementById(selectedTabRowId);
			ModifyTabStyle(selectedTabRow , oldValue , newValue);
		}
		oldValue = "regular";
		newValue = "selected";
		ModifyTabStyle(tabClickedRow , oldValue , newValue);
		MainTabsRow.setAttribute("selectedTabRowId" , tabClickedRow.id);

		var imageSourceId = tabClickedRow.getAttribute("imageIndex");
		var imgBigGraph = document.getElementById("bigGraphImage");
		var imgSmallGraph = document.getElementById("smallGraphImage");
		imgBigGraph.src = arrImageSources[imageSourceId][0];
		imgSmallGraph.src = arrImageSources[imageSourceId][1];
	}
}

function ModifyTabStyle(tabRow, oldClassName, newClassName)
{
	var arrTabCells = tabRow.getElementsByTagName("td");

	if(arrTabCells != null)
	{
		var i = 0;
		tabRow.className = tabRow.className.replace(oldClassName , newClassName);
		while(i < arrTabCells.length)
		{
			arrTabCells[i].className = arrTabCells[i].className.replace(oldClassName , newClassName);
			++i;
		}
	}
}
function OpenLargeImage(obj)
{
    var openWindow = window.open("", "", "resizable=yes,scrollbars=yes,status=yes");
    openWindow.document.write(obj);
    openWindow.document.close();
}


 function Check(e){
    var KeyNum;
    if(window.event){
        KeyNum = e.keyCode;
    }else if(e.which){
        KeyNum = e.which;
    }
    // enter is the pressed key
    if (KeyNum == 13){
        return false;
    }              
    return true;
}

// SELF SERVICE SCRIPTS

function SelfServiceShowDescription(control, display)
{
    if (control)
    {
        div = control.nextSibling.nextSibling;
        if (div)
        {
            div.style.display = display;                   
        }
    }
}

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
// if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = SelfServiceGetMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function SelfServiceGetMouseXY(e) 
{
  if (IE) 
  {     
  
    var top = document.documentElement.scrollTop ?
                document.documentElement.scrollTop :
                document.body.scrollTop;
    var left = document.documentElement.scrollLeft ?
                document.documentElement.scrollLeft :
                document.body.scrollLeft;          
                
    // grab the x-y pos.s if browser is IE
    tempX = event.clientX + left;
    tempY = event.clientY + top;
  } 
  else 
  {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  
  // catch possible negative values in NS4
  if (tempX < 0)
  {
    tempX = 0;
  }
  if (tempY < 0)
  {
    tempY = 0;
  }  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  // document.Show.MouseX.value = tempX;
  // document.Show.MouseY.value = tempY;
  return true;
}

function SelfServiceCloseMe(control)
{
    if (control)
    {
        control.style.display = 'none';
    }
}

function ShowBubble(control, display)
{
    if (control)
    {
        div = control.previousSibling;
        if (div)
        {
            if (div.innerText != "")
            {               
                div.style.display = display;
                if (tempX > 0 && tempY > 0)
                {
                    div.style.position = "absolute";
	                div.style.top = tempY - div.style.height;
	                div.style.left = tempX - 250;
                }
            }
        }
    }
}

// END SELF SERVICE SCRIPTS

//Start Registration Scripts

function ShowHideExplanation(div)
{
    divObj = document.getElementById(div);
    if (divObj!=null)
    {
        if (divObj.style.display == 'none')
        {
            divObj.style.display = '';
        }
        else
        {
            divObj.style.display = 'none'
        }
    }
}

//End Registration Scripts

function ActivateFlash()
{
    var theObjects = document.getElementsByTagName("object");
    if(theObjects != null)
    {
        var iObjectsNum = theObjects.length;
        for (var i = 0; i < iObjectsNum; i++)
        {
            theObjects[i].outerHTML = theObjects[i].outerHTML;
        }
    }
}


function ResizeIframe(){

     if (browseris.ie5up)
     {
        var objFrame = eval(document.getElementsByTagName('iframe')[0].id);
        var oBody = objFrame.document.getElementById("TabsMainTable");
        objFrame.frameElement.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight) + 20;
     }
     else{
        var oIframe = document.getElementById(document.getElementsByTagName('iframe')[0].id);
        var oBody = oIframe.contentDocument.getElementById("TabsMainTable");
        oIframe.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight) + 20 + "px";
     }
}

function DisableBack()
{
    window.history.go(1);
}


/* Reffer Cookie */



function setCookie(c_name,value,expiremins)
{
if (!ReadCookie(c_name)){
 
    var exdate=new Date();
    exdate.setMinutes(exdate.getMinutes() + expiremins);
    
    document.cookie= c_name + "=" + escape(value) +
   
    ((expiremins==null) ? "" : ";expires="+exdate.toGMTString());
  }
    
}
function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}


setCookie("Refferer",document.referrer, 20);