﻿
/*
*  Author: MHDY.com
*  Title: Bookmarking Scripts
*  Last Update: 2005/10/16
*/

var D = document;
var GET = new Object; // Record all values in the Query String
		
	// Read and Parse the QueryString
	// use the GET Object above to access these values. code: GET.foo = bar
function f_GetQS()
{
	if(!location.search) {return false}
	
	var x;
	var ar;
	
	x = location.search.substr(1);
	x = x.replace(/=/g, '=\'');
	
	if (x.indexOf('&') != -1)
	{
		ar =new Array;
		ar =x.split('&');

		for(i=0; i<ar.length; i++)
		{
			if (ar[i] != '')
			{
				eval("GET." + ar[i] + '\''); // only eval non empty array values
			}
		}
	}else{
		eval ("GET." + x + '\'');
	}
}

function f_QS2fla (FLASHID) 
{
	/* debug -  var prop_val = '';*/
	for (i in GET)
	{
		document[FLASHID].SetVariable("_global." + i.toUpperCase(), GET[i]);
		/* debug -  prop_val +=  "_global." + i.toUpperCase() + " " + GET[i] + '\n';*/
	}
	/* debug -  alert(prop_val);*/
}

// Mozilla will not allow direct access to the Flash file until it is fully loaded. This FS command will be called when the SWF file finishes loading. It is called from the "_inc_loadshell.as" file
// Handle all the FSCommand messages in a Flash movie.
function ccssobj_DoFSCommand(command, args) 
{
  switch(command)
	{
	case 'loaded':
	  f_QS2fla('ccssobj');
	  break;
	case 'bug':
	  alert(args);
	  break;
	}
}

// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) 
{
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub ccssobj_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call ccssobj_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

// Onload Function
function f_pageloaded()
{
	f_GetQS();
}

// ACTIONS
if (D.getElementById)
{
	window.onload = f_pageloaded;
}