var ccWin = null
var cc_time

function cc_window()
{
//	cc_open = 1
if(!GetCookie('homemovie'))
	{
	alert("You do not seem to be logged in.  You must be logged in to retrieve billing information.")
	return
	}
else if (document.getElementById("cust_phone").value)
	{
	if (document.getElementById("cust_phone").value == "~" || document.getElementById("cust_phone").value == "~")
		{
		alert("Your account has not yet been created.  Please try again in 15 minutes.")
		return
		}
	}
else
	{
	parse_cookie()
	}

var myBars = 'directories=no,location=no,menubar=no,status=yes,titlebar=no,toolbar=no'
var myOptions = 'scrollbars=no,width=620,height=330,resizeable=no'
var myFeatures = myBars + ',' + myOptions
if(document.location.host == "dev.stashspace.com" || document.location.host == "qa.stashspace.com" || (document.location.host).indexOf("thinkpad") > -1)
	{
	var myDest = (document.location.protocol + "//" + document.location.host + "/secure/cc_window.htm?"+code)
	}
else
	{
	var myDest = ("https://" + document.location.host + "/secure/cc_window.htm?"+code)
	}
var myDest = ("https://www.stashspace.com/secure/cc_window.htm?"+code)

if(ccWin == null)
	{
	ccWin = window.open(myDest, 'myWin', myFeatures)
	}
else if(ccWin.closed == false)
	{
	ccWin.focus()
	}
else
	{
	ccWin = window.open(myDest, 'myWin', myFeatures)
	}
//	var cc_time = window.setInterval("refresh()",5000)
}

function refresh()
{
if (ccWin && ccWin.closed)
	{
	window.clearInterval(cc_time)
	ccWin = null
//	window.location.reload()
	}
else
	{
	window.clearInterval(cc_time)
	}
}
