// JavaScript Document
//Alloys Online 2009 Global Script


//---------------------------------------------------------------------------
//Custom Scriptaculus Scripts
//---------------------------------------------------------------------------

function updateDiv(div_name, page) {
new Effect.Fade(div_name);
setTimeout("new Ajax.Updater(div_name ,page,{onComplete:function(){ new Effect.Appear(div_name);},asynchronous:true, evalScripts:true});",1500);
}



//---------------------------------------------------------------------------

//Spry Rotating Banners

//---------------------------------------------------------------------------

//Project Data


//---------------------------------------------------------------------------
var dsImg= new Spry.Data.XMLDataSet("/2009/mktg/xml_data/anon_home_bnrs.xml", "items/herobnr");
var imageInterval = 9000; // 1000 is 1 second

/*
//Only rotate images - no fade effects
var obs = { onPostLoad: function() {
setInterval(function() { dsImg.setCurrentRowNumber((dsImg.getCurrentRowNumber() + 1) % dsImg.getData().length); }, imageInterval);
}};

dsImg.addObserver(obs);
*/



var obs = { onPostLoad: function() {
setInterval(function() { fadeOutContentThenSetRow((dsImg.getCurrentRowNumber() + 1) % dsImg.getData().length); }, imageInterval);
}};

//'floatHero'

function fadeInContent(notificationType, notifier, data)
{
if (notificationType != "onPostUpdate")
return;
var effect = new Spry.Effect.Fade('floatHero', { to: 100, from: 20, duration: 400 });
effect.start();
}

Spry.Data.Region.addObserver('floatHero', fadeInContent);

function fadeOutContentThenSetRow(rowID)
{
var effect = new Spry.Effect.Fade('floatHero', { to: 20, from: 100, duration: 400, finish: function() {
dsImg.setCurrentRow(rowID);
}});
effect.start();
}

dsImg.addObserver(obs);


//---------------------------------------------------------------------------

//Spry Fade In Main Content

function fadeIt(ele,url){
	Spry.Effect.DoFade(ele,{ duration: 500, from: 100, to: 0, finish: function() {
		Spry.Utils.updateContent(ele, url, function() {
			Spry.Effect.DoFade(ele,{ duration: 500, from: 0, to: 100 });
		});
  }
 });
}

function fadeIt_orig(ele,url){
	Spry.Effect.DoFade('mainContent',{ duration: 500, from: 100, to: 0, finish: function() {
		Spry.Utils.updateContent(ele, url, function() {
			Spry.Effect.DoFade('mainContent',{ duration: 500, from: 0, to: 100 });
		});
  }
 });
}

//Spry Update Content in a Div - BEst with IE, no fade transitions

function updatecontent(ele,url){
		Spry.Utils.updateContent(ele, url);
}

function fadeTabMenu(divcode,ele,url){
	
	Spry.Effect.DoFade(ele,{ duration: 250, from: 100, to: 0, finish: function() {
		Spry.Utils.updateContent(ele, url, function() {
			//SetAllDivisionBGImages(divcode);
			Spry.Effect.DoFade(ele,{ duration: 250, from: 0, to: 100 });
		});
  }
 });
	
}

//---------------------------------------------------------------------------


function SetTabMenuBGImage(whichImage){
	//backImage array

	//Set Tab Menu Backgrounds
	
	var backImage = new Array(); 
	
	backImage[0] = "/2009/images/Div_menu_home.jpg";
	backImage[1] = "/2009/images/Div_menu_pi.jpg";
	backImage[2] = "/2009/images/Div_menu_su.jpg";
	backImage[3] = "/2009/images/Div_menu_dm.jpg";
	backImage[4] = "/2009/images/Div_menu_nv.jpg";
	backImage[5] = "/2009/images/Div_menu_dh.jpg";
	backImage[6] = "/2009/images/Div_menu_aa.jpg";
	backImage[7] = "";

if (document.getElementById){
	document.getElementById('Tab_menu').style.background='url('+backImage[whichImage]+')'
	}
}

function SetAllDivisionBGImages(divcode){
		//alert(divcode);
		//alert('Tab_'+divcode);

		//Division Tabs
		SetDivTabs(divcode);
	
		//TabMenu
		document.getElementById('Tab_menu').style.background='url("/2009/images/Div_menu_'+divcode+'.jpg")';
		
		//Footer
		document.getElementById('container_footer_ds').style.background='url("/2009/images/footer_div_'+divcode+'.gif")';
	}

function SetSSLBGImages(){
		//alert(divcode);
		//alert('Tab_'+divcode);

		//Division Tabs
		//SetDivTabs(divcode);
	
		//TabMenu - is none...
		//document.getElementById('Tab_menu').style.background='url("/2009/images/Div_menu_ssl.jpg")';
		
		//Footer
		document.getElementById('container_footer_ds').style.background='url("/2009/images/footer_ssl.gif")';
		
	}

function SetDivTabs(divcode) {
	//DivTab array
	
	//alert(divcode);
	var DivTab = new Array(); 

	DivTab[0] = "home";
	DivTab[1] = "pi";
	DivTab[2] = "su";
	DivTab[3] = "dm";
	DivTab[4] = "nv";
	DivTab[5] = "dh";
	DivTab[6] = "aa";
	
	for (var index = 0; index < DivTab.length; ++index) {
	  var item = DivTab[index];
	  // Your code working on item here...
	  //alert(item);
	  if (item!=divcode){
		//tab set to transaprent
		document.getElementById('Tab_'+item).style.background='url("/2009/images/div_tab_bg_transparent.gif")'; 
	  }
	  else {
		//Colour the tab
		document.getElementById('Tab_'+item).style.background='url("/2009/images/div_tab_bg_'+divcode+'.gif")';
		}
	}
}


/* 
//not working... can not get object...
function setDivTab(divcode) {
	//alert(document.getElementById('mainContent').style.background-color);
	//document.getElementById('Tab_'+divcode).style.background-color: #eee;
	document.getElementById('mainContent').style.background-color = '#eeeeee';
}
*/

//Silmulate Home Tab Click
function SetHomeTabDefault(){
	if (document.getElementById){
		fadeIt('mainContent','/2009/mktg/divisions/home/home.asp');
		PT_SetDivisionUI('home'); 
		return false;
	}
}


function SetHomeTabDefault_New(){
	if (document.getElementById){
		fadeIt('mainContent','/2009/mktg/divisions/home/home_new.asp');
		PT_SetDivisionUI('home'); 
		return false;
	}
}

//Silmulate Print Imaging Tab Click
function SetpiTabDefault(){
	if (document.getElementById){
		fadeIt('mainContent','/2009/mktg/divisions/home/home.asp');
		PT_SetDivisionUI('pi'); 
		return false;
	}
}


//Setup the page state for products list
function SetPageStateProducts(divcode){
	//alert(divcode);
	if (document.getElementById){
		//fadeIt('mainContent','/2009/mktg/divisions/'+divcode+'/home_'+divcode+'.asp');
		PT_SetDivisionUI(divcode); return false;	
		}
	}

//Setup the page state for products list
function SetPageStateGeneral(divcode){
	//alert(divcode);
	if (document.getElementById){
		fadeIt('mainContent','/2009/mktg/divisions/'+divcode+'/home_'+divcode+'.asp');
		PT_SetDivisionUI(divcode); return false;	
		}
	}

//Setup the page state for products list
function SetPageStateCustomContent(divcode){
	//alert(divcode);
	if (document.getElementById){
		PT_SetDivisionUI(divcode); return false;	
		}
	}
	
//Setup the page state for SSL Content
function SetPageStateSSL(page_url){
	//alert(divcode);
	
	if (document.getElementById){
		fadeIt('mainContent',page_url);
		PT_SetSSLUI(); return false;	
		}
	}

function SetDivTabMenu(divcode){
		//alert('/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
	if (document.getElementById){
		//fadeIt('mainContent','/2009/mktg/divisions/home/home_'+divcode+'.asp');
		//SetAllDivisionBGImages(divcode);

		fadeIt('Tab_menu','/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
	}
}

function PT_SetDivisionUI(divcode){
	//Uses Prototype and scriptaculous libraries
		//alert('/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
		/*
		1. fade out content
		2. change colours
		3. switch bgs
		3. fade in content
		
		*/
		
	if (document.getElementById){
		//fadeIt('mainContent','/2009/mktg/divisions/home/home_'+divcode+'.asp');
		//alert('xxx');
		SetAllDivisionBGImages(divcode);
		//setDivTab(divcode);
		
		//Displays the Menu for a tab that is selected...
		fadeTabMenu(divcode,'Tab_menu','/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
	}
}

function PT_SetSSLUI(divcode){
	//Uses Prototype and scriptaculous libraries
		//alert('/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
		/*
		1. fade out content
		2. change colours
		3. switch bgs
		3. fade in content
		
		*/
		
	if (document.getElementById){
		//fadeIt('mainContent','/2009/mktg/divisions/home/home_'+divcode+'.asp');
		//alert('xxx');
		SetSSLBGImages();
		//setDivTab(divcode);
		
		//Displays the Menu for a tab that is selected...
		//fadeTabMenu(divcode,'Tab_menu','/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
	}
}


function SetDivisionUI(divcode){
		//alert('/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
		/*
		1. fade out content
		2. change colours
		3. switch bgs
		3. fade in content
		
		*/
		
	if (document.getElementById){
		//fadeIt('mainContent','/2009/mktg/divisions/home/home_'+divcode+'.asp');
		//SetAllDivisionBGImages(divcode);
		//setDivTab(divcode);
		//alert('rrr');
		fadeTabMenu(divcode,'Tab_menu','/2009/mktg/divisions/'+divcode+'/div_tab_menu_'+divcode+'.asp');
	}
}

//---------------------------------------------------------------------------

//Classic DreamWeaver Functions

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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  //if (restore) selObj.selectedIndex=0;
  }


function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


function ClosePopUps() {
	if (newWindow) {
		if (newWindow.closed == false) {
			newWindow.close();
		}
	}
}

function NavBack() {
  if (window.history.back)
    window.history.back(1)
  else
    alert("Sorry, your browser doesn't support this feature. Click your Back button to go back to the Order List.");
}

function NavigateBrowserPage(url) { //v1.0
//window.close;
if (window && !window.closed)
  //window.document.location=url;
  //document.main.location=url;
  window.location = url
  // change the url below to the url of the frameset page...
  //window.location.href = '/default.asp?' + url;
  //window.close();
}




function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


//---------------------------------------------------------------------------


//Ecom Functions

function GTT() {
	//click on trolley icon sets form element to flag a redirect to the trolley
	document.frmMultiBuy.action.value='settrolleyquantities';
	document.frmMultiBuy.goto.value='trolley';
	return true
}

function printPage() {
  if (window.print)
    window.print();
  else
    alert("Sorry, your browser doesn't support this feature. Please print from the browser menu bar.");
}

//Login Functions

function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function ProcessLogin(theForm) {
	//alert('form posted');
  if (theForm.UserName.value == "")
  {
    alert("Please enter your Login Username.");
    theForm.UserName.focus();
    return (false);
  }
  if (theForm.CompanyCode.value == "")
  {
    alert("Please enter your Company Code.");
    theForm.CompanyCode.focus();
    return (false);
  }
  if (theForm.Password.value == "")
  {
    alert("Please enter your Login Password.");
    theForm.Password.focus();
    return (false);
  }
	//Now save the variables to a cookie
  if(theForm.SaveSignOn.checked){
    var expdate = new Date();
	expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 31));
	SetCookie ('SavedCompanyCode', theForm.CompanyCode.value, expdate);
	SetCookie ('SavedUserName', theForm.UserName.value, expdate);
	SetCookie ("SaveSignOn", 1, expdate);
  }
  else
  {
	document.cookie='SavedCompanyCode=;path=/;expires=Sun, 1 Jan 1970 00:00:00 UTC';
	document.cookie='SavedUserName=;path=/;expires=Sun, 1 Jan 1970 00:00:00 UTC';
	document.cookie='SaveSignOn=;path=/;expires=Sun, 1 Jan 1970 00:00:00 UTC';
    }
	return (true);
}


function SubmitLogin(theForm) {
	//alert('yeah');
	if (ProcessLogin(theForm)){
	Modalbox.show('/2009/design/login_page/login_control_panel.asp?CompanyCode='+URLEncode(theForm.CompanyCode.value)+'&UserName='+URLEncode(theForm.UserName.value)+'&Password='+URLEncode(theForm.Password.value)+'&SaveSignOn='+theForm.SaveSignOn.value, {title: 'Welcome to Alloys', width: 835});
	
	Modalbox.deactivate();
	}
}

function SubmitPWDRecovery(theForm) {
	//alert('yeah');
	if ((theForm.Email.value) !== "") {
		Modalbox.show('/activation/email_signon.asp?Email='+theForm.Email.value+'&Action=sendemail', {title: 'Credentials Recovery for '+theForm.Email.value, width: 600});
		//Modalbox.deactivate();
	}
	else return false;
}


function SetFormFocus() { //v1.0
	if (document.loginform){
		  if ((document.loginform.UserName.value)!== "")
		  {
		  document.loginform.Password.focus();
		  //document.loginform.Password.select();
		  }
		  else
		  {
		  document.loginform.UserName.focus();
		  }
	}
}

function SetLoginFormFocus() { //v1.0
	if (document.loginform){
		  if ((document.loginform.UserName.value)!== "")
		  {
		  document.loginform.Password.focus();
		  //document.loginform.Password.select();
		  }
		  else
		  {
		  document.loginform.UserName.focus();
		  }
		  //document.loginform.btnLogin.focus();
	}
}


function submitenter(myfield,e)
//Submit login details on Enter Key Press - Do not let form submit
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   //myfield.form.submit();
   SubmitLogin(myfield.form); return false;
   }
else
   return true;
}



//---------------------------------------------------------------------------

//FORMS and UI Elements

function ClearSearchTextBox(txtbox) {
	if (txtbox.value=='search...') {
        txtbox.value='';
	}
}

function SubmitSearch(theForm) {
if (theForm.keyword.value.length < 3)
	{
    alert("Please enter at least 3 characters to search for.");
    theForm.keyword.focus();
    return (false);
	}
else if (theForm.keyword.value == 'search...') {
    alert("Please enter a keyword to search for.");
    theForm.keyword.focus();
    return (false);
	}
else if (theForm.keyword.value == 'search') {
    alert("Please enter a keyword to search for.");
    theForm.keyword.focus();
    return (false);
	}
else
	{
	document.location.href = 'products.asp?keyword=' + theForm.keyword.value;
	theForm.keyword.focus();
	return (false);
	}
}





//---------------------------------------------------------------------------
// UI Modal Dialogs

function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';                          
  } else {
     dark.style.display='none';
  }
}

//---------------------------------------------------------------------------


function SetRSSPicture(pic_html) {
	//Set RSS Image if exists	
	if (document.getElementById("rss_image")){
		if ((pic_html)!== ""){
			//document.getElementById("rss_image").innerHTML='<img src="'+pic_html+'" id="rss_item" name="rss_item" alt="" width="320" height="168" />';
			document.getElementById("rss_image").innerHTML='<img src="'+pic_html+'" id="rss_item" name="rss_item" alt="" width="320" border="0" />';
		}
	}
}

function SetRSSPictureByID(img_id, pic_html) {
	//Set RSS Image if exists	
	if (document.getElementById(img_id)){
		if ((pic_html)!== ""){
			document.getElementById(img_id).innerHTML='<img src="'+pic_html+'" id="'+img_id+'_pic" name="'+img_id+'_pic" alt="" width="320" border="0" />';
		}
	}
}

/*
NavigateToNamedAnchor(anchorName)
    {
        window.location.hash = anchorName);
	}
*/
//---------------------------------------------------------------------------
// Accounts Functions

function popUpAccount(url,name) {
	if (newWindow) {
		if (newWindow.closed == false) {
			newWindow.focus();
		}
	}
	newWindow = window.open(url,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=628,height=580');
}
function popUpSetPWD(url,name) {
	if (newWindow) {
		if (newWindow.closed == false) {
			newWindow.focus();
		}
	}
	newWindow = window.open(url,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=628,height=450');
}

/* Functions that handle table highlights. */
function ShowMenuHighlight(oTable)
{
	oTable.style.border = '#0066CC solid 1px';
}function HideMenuHighlight(oTable)
{
	oTable.style.border = '#FFFFFF solid 1px';
}

function popUp(url,name) {
	if (newWindow) {
		if (newWindow.closed == false) {
			newWindow.focus();
		}
	}
	newWindow = window.open(url,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=600,height=406');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
	
function popUpRename(url,name) {
	if (newWindow) {
		if (newWindow.closed == false) {
			newWindow.focus();
		}
	}
	newWindow = window.open(url,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=628,height=450');
}

function RefreshUserList() { //v1.0
if (window.opener && !window.opener.closed)
	{
	  window.opener.document.location="users.asp";
	 }

}

function RefreshUserPage() { //v1.0
if (window.opener && !window.opener.closed)
	{
	  //window.opener.document.location="user.asp";
	  var usrurl=window.opener.document.URL+'&renamed=yes<%=signoffnow%>';
	  //var usrurl='hello';
	  window.opener.document.location=usrurl;
	  //window.opener.document.write(usrurl);
	 }
}

function RefreshOpener(url) { //v1.0
if (window.opener && !window.opener.closed)
	{
	  window.opener.document.location=url;
	 }
}

function SetUserNameFocus() { //v1.0
      if ((document.form1.FUserName.value)!== "")
      {
      document.form1.FUserName.focus();
      document.form1.FUserName.select();
      }
      else
      {
      document.form1.FUserName.focus();
      }
}  

function ClearDefaultFieldValue(thefield, default_value) {
	if (thefield.value == default_value) {
		//Clear the default value
		thefield.value='';
	}
	else {
		thefield.select();
	}
}

//Email Handling Functions
function EmailClient(URL) {
  if (window.navigate)
    window.navigate(URL)
  else
    alert("Sorry, your browser doesn't support this feature. Click on the Email address above to initiate an email to this user.");
}

	
//---------------------------------------------------------------------------
// Green Tick Functions
function TickGreenVerify(){
	TGWindow = window.open('http://www.tickgreen.com.au/certify/certify.php?uid=565484560','TGWindow','location=1,scrollbars,resizable,height=450,width=650');
	TGWindow.focus();
}

/*
function TickGreenVerify(){
	TGWindow = window.open('http://www.tickgreen.com/certify/certify.php?uid=565484560','TGWindow','location=1,scrollbars,resizable,height=450,width=650');
	TGWindow.focus();
}document.write('<a href="javascript:TickGreenVerify()"><img src="http://www.tickgreen.com/badge/tickgreen80x15.png" alt="Tickgreen.com" border="0"></a>');
*/

//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
// Encoding Functions
function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}

function URLDecode (encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
}

//---------------------------------------------------------------------------

//-->




