ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
var step = 1;
mozila = (!document.all && document.getElementById)? true:false;
var newwin = null;
var timerID;
function openWindow(width, height, url, windowname){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == 'Netscape' 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
		) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();	
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	x = (screenW - width)/2; y = (screenH - height)/2;
	newwin = window.open(url, windowname,'scrollbars=yes,toolbar=no,width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',directories=no,status=yes,resizable=yes,menubar=no,location=no');
	if(newwin != null)
	    newwin.focus();
}

function openWindowNoScroll(width, height, url, windowname){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == 'Netscape' 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
		) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();	
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	x = (screenW - width)/2; y = (screenH - height)/2;
	newwin = window.open(url, windowname,'scrollbars=no,toolbar=no,width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',directories=no,status=yes,resizable=yes,menubar=no,location=no');
	if(newwin != null)
	    newwin.focus();
}

function openWindowNoClose(width, height, url, windowname){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == 'Netscape' 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
		) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();	
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	x = (screenW - width)/2; y = (screenH - height)/2;
	var newwin2 = window.open(url, windowname,'scrollbars=yes,toolbar=no,width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',directories=no,status=yes,resizable=yes,menubar=no,location=no');
	newwin2.focus();
}
function flush()
{
	if (newwin != null && newwin.open) newwin.close();
}
var step = 1;
function removefeedback() {
	var label;
	if (ns4)
	{
		obj = document.layers["lblFeedback"];
		label = document.layers["lblFeedback"];
	}
	else if(ie4)
	{
		obj = document.all["lblFeedback"].style;
		label = document.all["lblFeedback"];
	}
	else
	{
		obj = document.getElementById("lblFeedback").style
		label = document.getElementById("lblFeedback");
	}
	if (step < 10) {
		step++;
		setTimeout("removefeedback()", 1000);
	}
	else{
		label.innerHTML = "&nbsp";
		//obj.display = "none";
	}
}		
function showprogress() {
	if (ns4)
		obj = document.layers["progress"];
	else if(ie4)
		obj = document.all["progress"].style;
	else
		obj = document.getElementById("progress").style
	obj.display = "inline";
}

function changeImages(imgName, imgSource) {
	document.getElementById(imgName).src = eval(imgSource + '.src')
}
function showToolTip(whichTip,TipText, e, addLeft, addTop) {
	if(TipText == '')
		return false;
	
	//Size div based on tip text length and Position to cursor
	TipText = ' ' + TipText + ' ';
	
	//Set length as 6 pixels per lowercase character, 9 per uppercase
	var UppercaseRegExp = /[A-Z]/g;
	var NumMatches = TipText.match(UppercaseRegExp);
	if (NumMatches != null) {
		var NumUpperChars = NumMatches.length; 
	} else {
		var NumUpperChars = 0 
	}	
	
	var NumLowerChars = TipText.length - NumUpperChars;	
	var txtlth = (NumLowerChars * 6) + (NumUpperChars * 9);	
	
	var ns6=document.getElementById && !document.all
	var leftPos = (ns6)?e.pageX : e.clientX;
	var topPos = (ns6)?e.pageY : e.clientY;
	
	leftPos = leftPos + addLeft;
	topPos = topPos + addTop;
    
	dropmenuobj = document.getElementById(whichTip)
	
	//TipText = '<table cellpadding=0 cellspacing=0 border=1 style=border-collapse: collapse;border-width:0;><tr><td align=center style=border-width:0;><img src=images/arrow2.gif></td></tr><tr><td style=background-Color:#ffdab9;padding:5px;>' + TipText + '</td></tr></table>'
	//TipText = '<div style=position:relative;><img src=images/arrow2.gif></div><div background-Color:#ffdab9;padding:5px;border: gray 1px solid>' + TipText + '</div>'
	dropmenuobj.innerHTML = TipText;
	//dropmenuobj.style.width = txtlth;
	dropmenuobj.style.left = leftPos + 'px';
	dropmenuobj.style.top = topPos + 'px';
	
	if (timerID) {
		//clearTimeout(timerID);
	}
	
	//Show tip
	flip(whichTip,true);
	
	//Set code to automatically hide tip after a few seconds
	hideTipCode = 'flip(\'' + whichTip + '\',false ' + ')';	
	//timerID = window.setTimeout(hideTipCode,2500);
	
}

function flip(block, showhide) {
	//document.all(block).style.visibility = (showhide  ==  true) ? "visible" : "hidden"
	document.getElementById(block).style.visibility = (showhide  ==  true) ? "visible" : "hidden";
	
}

function refreshTopFrame(url)
{
	window.parent.parent.TopBar.document.location.href=url;
}
function refreshRightFrame(url)
{
	window.parent.RightFrame.document.location.href=url;
}
function refreshLeftFrame(url)
{
	window.parent.leftframe.document.location.href=url;
		
}
function refreshBottomFrame(url)
{
	window.parent.ContentFrame.document.location.href=url;
		
}	

function refreshBottomFrameFromPopup(url, SelectTab)
{
    if (SelectTab != '')
	{
	    
	    if (opener.window.parent.TopBar != null)
	    {
	        
	        if (opener.window.parent.TopBar.TabStrip2.getSelectedTab().get_id() != 'undefined')
	        {
	            if(opener.window.parent.TopBar.TabStrip2.getSelectedTab().get_id() != SelectTab) //check if the tab passed is not already selected
	            {
	            
	                //alert(opener.window.parent.parent.TopBar.TabStrip2.getSelectedTab().id);
	                opener.window.parent.TopBar.TabStrip2.selectTabById(SelectTab);
	                opener.window.parent.TopBar.TabStrip2.render();         
	            }
	        }
	    }
	}
	
	if (opener.window.parent.ContentFrame != null)
	{
	    opener.window.parent.ContentFrame.document.location.href=url;
	}
	else
	{
	    opener.window.parent.parent.ContentFrame.document.location.href=url;
	}    
	
		
}	

function refreshCurrent(url)
{
	document.location.href=url;
}	

function Login(region,LoginChoice,EmailID)
{
    if(EmailID == '')
    {
        var url = self.location.href;
        var info = url.split('?');
        if (info.length == 2)
        {
            openWindow('900', '710', 'http://www.innerpass.com/innerpass_prod/login.aspx?Region='+ region + '&LoginChoice=' + LoginChoice + '&' + info[1] , 'Iplogin');
        }
        else if (info.length > 2)
        {
            openWindow('900', '710', 'http://www.innerpass.com/innerpass_prod/login.aspx?Region='+ region + '&LoginChoice=' + LoginChoice + '&' + info[1] + '?' + info[2], 'Iplogin');
        }
        else
        {
            openWindow('900', '710', 'http://www.innerpass.com/innerpass_prod/login.aspx?Region='+ region + '&LoginChoice=' + LoginChoice , 'Iplogin');
        }
    }
    else
    {
        openWindow('900', '710', 'http://www.innerpass.com/innerpass_prod/login.aspx?Region='+ region + '&LoginChoice=' + LoginChoice + '&EmailID=' + EmailID, 'Iplogin');
    }    
}
