function getHostname() {
	var url = String(document.location);
	var split1 = url.split("//");
	var split2 = split1[1].split("/");
	var host = split2[0];
	return host;
}

function hideSignUp(){
document.getElementById('signup').style.visibility='hidden';
}
function ShowSignUp(){
if (document.getElementById('signup').innerHTML=="")
	loadSignUp(1);
document.getElementById('signup').style.visibility='visible';
}
function loadSignUp(withClip)
{
q = param(); //categoryKey=mccain&clipID=46953
if (withClip)
{
signup("TEMPLATE_"+(q.categoryKey[0].toUpperCase()),q.clipID[0]);
}
else
{
signup("0","0");
}
}	
	
function signup(TEMPLATE,mainClipId) {
	// Calculate the page's base URL
	//alert(mainClipId + "-"+bgImage );
	var url = String(document.location); // or: window.location.href
	var split1 = url.split("//");
	var split2 = split1[1].split("/");
	var base = split1[0] + "//" + split2[0];

	// Decide which URL to call when a new user joins
	var joinNotifyUrl = "";
	var host = getHostname();
	if ((host == "vringo.com")
		 || (host == "www.vringo.com")
		 || (host == "orange.vringo.com"))
		joinNotifyUrl = "http://www.googleadservices.com/pagead/conversion/1060714295/imp.gif?value=1&label=signup&script=0";


	var so = new SWFObject( "/falcon/SignUp.swf", "channel", "670", "510", "8", "#000000", false); // Last param is ExpressInstallation boolean
	so.addParam("align", "middle");
	so.addParam("allowScriptAccess", "always");
	so.addParam("allowNetworking", "all");
	so.addParam("menu", "false");
	so.addParam("wmode", "opaque");

	so.addVariable("VISITORS_URL", base);
	so.addVariable("REGISTERED_URL", base);

	so.addVariable("REFERRER_WEB", referrerWeb);
	so.addVariable("REFERRER_PARAM", referrerParam);
	so.addVariable("SMSID", "5");
	so.addVariable("mainClipId", mainClipId);
	so.addVariable("SMS_TEMPLATE", TEMPLATE);
	//so.addVariable("bgImage", "bgImage");
	try
		{
		geoipCode = geoip_country_code();
		//alert(geoipC);
		}
	catch(err)
		{
		geoipCode = "NONE: " + err.description
		//alert("NONE: " + err.description);
		}
	
	//util to overide Geoip with querystring value for country

	if (window.location.search.indexOf("country=") != -1){
		s = window.location.search.indexOf("country=")+ 8 ;
		geoipCode = window.location.search.substring(s,s+3)
		//queryStringVal
	}		
	so.addVariable("GeoIpCountryCode", geoipCode);
	
	so.write("signup");
}
