//Game Search Marketing www.gamesem.com - copyright 2008 - (some combined techniques are intellectual property of Game)
//DSXL this function includes all necessary js files for the application
//help include js files 
//http://www.chapter31.com/2006/12/07/including-js-files-from-within-js-files/
//help passing parameters
//http://www.techbubble.net/2008/08/23/XHTMLCompliant+Technique+For+Passing+Parameters+To+Javascript+Script+Files.aspx
//<script type="text/javascript" src="http://www.foo.com/myscript.js#obj1/ABC/obj2/XYZ"></script>
//
//http://www.learningjquery.com/2006/09/multiple-document-ready

//<script src="../js/master.js?#id/id-parameter/s/subdirs-parameter/n/level-parameter/e/js-exec-parameter/t/js-exec-type-parameter/l/js-exec-level-parameter" type="text/javascript"></script>          


var myParams = getScriptUrlParams();

//alert(myParams["id"]);
//alert(myParams["s"]);
//alert(myParams["n"]);
//alert(myParams["e"]);
//alert(myParams["t"]);
//alert(myParams["l"]);

//#########################################################
//#########################################################
//parameter parser 

function getScriptUrlParams()
{
	var scriptTags = document.getElementsByTagName("script");

	// This code is assumed to be in a file so the "src" attribute
	// is guaranteed to be present...no error-checking is needed
	var urlFrags = scriptTags[scriptTags.length-1].src.split("#");

	var urlParams=[];
	var urlParamRaw = [];
	if (urlFrags.length > 1)
	{
	    urlParamRaw = urlFrags[1].split("/");   
	    if (urlParamRaw.length >= 2)
	    {
	    	for(var param=0;param<urlParamRaw.length;param+=2)
	            urlParams[urlParamRaw[param]] = (urlParamRaw.length >= param + 1 ? unescape(urlParamRaw[param+1]) : null);
    	    }
	}

	return(urlParams);
}


//#########################################################
//#########################################################
//create http-equiv metatags via master.js procedure

//sample <meta http-equiv="Page-Enter" content="blendTrans(duration=0.2)">
//	 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

/*

function includehttpequiv(param1)
{

// var param1  = 'xxxxxx' ;


  document.write(param1);
  
 document.getElementsByTagName('head').item(0).appendChild('<meta http-equiv="Page-Enter" content="blendTrans(duration=1.2)">');
}

*/

//#########################################################
//#########################################################
//http-equiv -> attribute are equivalent to HTTP headers. Typically, they control the action of browsers...

/*

//includehttpequiv('xxxvia');

//includehttpequiv('<meta http-equiv="Page-Enter" content="blendTrans(duration=0.2)">');

*/


//#########################################################
//#######################LOAD JS###########################
//loading *.js in master.js procedure

function include(file)
{

  var script  = document.createElement('script');
 
  script.type = 'text/javascript';
  script.defer = true;

	for (var i=0; i<myParams["s"]; i++) {
		file = "../" + file ;
//document.write(file);
	} 

//document.write(file);

  script.src  = file;

  document.getElementsByTagName('head').item(0).appendChild(script);
}

//#########################################################
//#####################GLOBAL LOAD JS######################
//load scripts global 

include('js/menu.js');

include('js/jquery/jquery.js');  



include('js/pjquery/fademenu.js');


//#########################################################
//##########################ID#############################
//scripts special for an id

//if (myParams["id"] == 1234567890) 
//{
//include('js/pjquery/xxx.js');  
//}


//if (myParams["id"] == 249497)
//{ 
	//include('js/pjquery/xxx.js');
//}

//#########################################################
//#########################SUBDIRS#########################
//scripts special for an subdirs

//if (myParams["s"] == 1234567890) 
//{
//include('js/pjquery/xxx.js');  
//}


//#########################################################
//##########################LEVEL##########################
//scripts special for an level

/*

if (myParams["n"] == "2") 
{
//	include('js/pjquery/level2.js');
//	include('js/pjquery/level3.js');
}


*/


//#########################################################
//##########################EXEC###########################
//scripts special for an exec (execute specials)

//if (myParams["e"] == "") 
//{
//include('js/pjquery/xxx.js');  
//}


//#########################################################
//##########################TYPE###########################
//scripts special for an type

//if (myParams["t"] == "") 
//{
//include('js/pjquery/xxx.js');  
//}

//#########################################################
//##########################LEVEL##########################
//scripts special for an level

//if (myParams["l"] == "") 
//{
//include('js/pjquery/xxx.js');  
//}


//#########################################################
//################GLOBAL SITE SCRIPTS######################
//global site (jquery-)scripts

//alert('alert ->trigger master.js');


//*******************************************
//functie 1 test (werkt niet)

/*

$(function(){

$("p").click( function() { 
  alert("Hello tekst!");
} );

 });

*/

//*******************************************
//functie 2 test (werkt niet)

/*

$(function(){

$("li").hover( function() { 

  alert("Hello hover li ! vanuit level2.js ");
 
//$("li").css("border","1px solid red") 
  
  $(this).fadeTo("fast", 0.5);
  $(this).fadeTo("fast", 1);
  
//  $("div#nv2-2 h2").fadeOut("fast");
//  $("div#nv2-2 h2").fadeIn("fast");

//  $("div#upn h1").fadeOut("fast");
//  $("div#upn h1").fadeIn("fast");
  
  
} );

 });

*/

//*******************************************
//functie 3







//##########################################
// als functie gedefinieerd DAN alert uitvoeren, anders werkt jQuery niet!!

//alert('alert ->einde regel master.js');

