function writeSWF(width,height,key,merchantid,language,admin)
{
	if(merchantid==98 || merchantid==95 || merchantid==73 || merchantid==105 || merchantid==81 || merchantid==83) {
		window.parent.location="http://www.planningwiz.com";
	}
	var text = '';
	text += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="PlanningWiz" align="middle" style="float:left;">';
	text += '<param name="allowScriptAccess" value="always" />';
//	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="quality" value="high" />';
	text += '<param name="allowFullScreen" value="true" />';
	text += '<param name="bgcolor" value="#FFFFFF" />';
	text += '<embed src="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" quality="high" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="PlanningWiz" id="PlanningWiz_movie" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	text += '</object>';
	if(merchantid!='') {
		if(merchantid==69) {
			//document.write(text);
			document.getElementById('flashContent').innerHTML = text;
//			document.contentFlash.innerHTML = text;
		}
		else{
			document.write(text);
		}
	}
	else {
		window.parent.location="http://www.planningwiz.com";
	}
}
function writeSWFWatts(width,height,key,merchantid,language,admin)
{
	if(merchantid==98 || merchantid==95 || merchantid==73 || merchantid==105 || merchantid==81 || merchantid==83) {
		window.parent.location="http://www.planningwiz.com";
	}
	var text = '';
	text += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="PlanningWiz" align="middle" style="float:left;">';
	text += '<param name="allowScriptAccess" value="always" />';
//	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="movie" value="http://main.planningwiz.com/watts_planner/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/watts_planner/" />';
	text += '<param name="quality" value="high" />';
	text += '<param name="allowFullScreen" value="true" />';
	text += '<param name="bgcolor" value="#FFFFFF" />';
	text += '<embed src="http://main.planningwiz.com/watts_planner/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/watts_planner/" quality="high" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="PlanningWiz" id="PlanningWiz_movie" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	text += '</object>';
	if(merchantid!='') {
		if(merchantid==69) {
			//document.write(text);
			document.getElementById('flashContent').innerHTML = text;
//			document.contentFlash.innerHTML = text;
		}
		else{
			document.write(text);
		}
	}
	else {
		window.parent.location="http://www.planningwiz.com";
	}
}
function writeSWFTest(width,height,key,merchantid,language,admin)
{
	var text = '';
	text += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="PlanningWiz" align="middle" style="float:left;">';
	text += '<param name="allowScriptAccess" value="always" />';
//	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="quality" value="high" />';
	text += '<param name="allowFullScreen" value="true" />';
	text += '<param name="bgcolor" value="#FFFFFF" />';
	text += '<embed src="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" quality="high" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="PlanningWiz" id="PlanningWiz_movie" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	text += '</object>';
	if(merchantid!='') {
//		document.write(text);
		document.getElementById('flashConent').innerHTML = text;
	}
	else {
		window.parent.location="http://www.planningwiz.com";
	}
}
function writeSWFNew(width,height,key,merchantid,language,admin)
{
	var text = '';
	text += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="PlanningWiz" align="middle">';
	text += '<param name="allowScriptAccess" value="always" />';
	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="quality" value="high" />';
	text += '<param name="allowFullScreen" value="true" />';
	text += '<param name="wmode" value="transparent" />';
	text += '<param name="bgcolor" value="#FFFFFF" />';
	text += '<embed src="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" quality="high" bgcolor="#FFFFFF" wmode="transparent" width="'+width+'" height="'+height+'" name="PlanningWiz" id="PlanningWiz_movie" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	text += '</object>';
	var div = document.getElementById('p');
	div.innerHTML = text;
//	document.write(text);
}
function writeSWFRumpa(width,height,key,merchantid,language,categoryId)
{
	window.parent.location="http://www.planningwiz.com";
	var text = '';
	text += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="PlanningWiz" align="middle">';
	text += '<param name="allowScriptAccess" value="always" />';
	text += '<param name="movie" value="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" />';
	text += '<param name="quality" value="high" />';
	text += '<param name="allowFullScreen" value="true" />';
	text += '<param name="bgcolor" value="#FFFFFF" />'; 
	text += '<embed src="http://main.planningwiz.com/Main.swf?screenwidth='+width+'&screenheight='+height+'&key='+key+'&merchantid='+merchantid+'&language='+language+'&path=http://main.planningwiz.com/" quality="high" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="PlanningWiz" id="PlanningWiz_movie" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	text += '</object>';
	if(merchantid != '') {
		document.write(text);
	}
	else {
		window.parent.location="http://www.planningwiz.com";
	}
}
function getSize() 
{
    var myWidth = 0;
    var myHeight = 0;
    if (typeof(window.innerWidth) == 'number') 
    {
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } 
    else 
    {
        if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
        {
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
        } 
        else 
        {
            if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
            {
                myWidth = document.body.clientWidth;
                myHeight = document.body.clientHeight;
            }
        }
    }
    return [myWidth, myHeight];
}
function resize()
{
	var s = getSize();
	var width = s[0];
	var height = s[1];
	var browser=navigator.appName;
	//alert(browser);
	if(browser!='Netscape')
	{
		document.getElementById('PlanningWiz').width=width;
		document.getElementById('PlanningWiz').height=height;
	}
	else
	{
		document.getElementById('PlanningWiz_movie').width=width;
		document.getElementById('PlanningWiz').width=width;
		document.getElementById('PlanningWiz_movie').height=height;
		document.getElementById('PlanningWiz').height=height;
	}
}
function resizeV3()
{
	var s = getSize();
	var width = s[0]-135;
	var height = s[1];
	var browser=navigator.appName;
	
	document.getElementById("flashContent").style.width=width+"px";
		
	if(browser!='Netscape')
	{
		document.getElementById('PlanningWiz').width=width;
		document.getElementById('PlanningWiz').height=height;
	}
	else
	{
		document.getElementById('PlanningWiz_movie').width=width;
		document.getElementById('PlanningWiz').width=width;
		document.getElementById('PlanningWiz_movie').height=height;
		document.getElementById('PlanningWiz').height=height;
	}
}
function MaximizeW()
{
	var s = getSize();
	var width = s[0];
	var height = s[1];
	var w_temp = screen.availWidth/width;
	var h_temp = screen.availHeight/height;
	if (w_temp >= 1.29 || h_temp >= 2.08) {
		window.moveTo(0,0);
		window.resizeTo(screen.availWidth ,screen.availHeight);
	}
}
function MaximizeWV3()
{
	var s = getSize();
	var width = s[0]-120;
	var height = s[1];
	var w_temp = screen.availWidth/width;
	var h_temp = screen.availHeight/height;
	if (w_temp >= 1.29 || h_temp >= 2.08) {
		window.moveTo(0,0);
		window.resizeTo(screen.availWidth ,screen.availHeight);
	}
}
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
//  alert(strHref);
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
} 
function getURLParam1(strParamName){
	var strReturn = "";
	var strHref = window.location.href;
	var strQueryString = strHref.substr(strHref.indexOf("planningwiz.com/")).toLowerCase();
	var aQueryString = strQueryString.split("/");
	for ( var iParam = 1; iParam < aQueryString.length; iParam++ ){
		if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "_") > -1 ){
        var aParam = aQueryString[iParam].split("_");
        strReturn = aParam[1];
        break;
		}
	}	
	return unescape(strReturn);
}
function getParam(param){
	var strHref = window.location.href;
//  alert(strHref);
	if ( strHref.indexOf("?") > -1 ){
		 return getURLParam(param);
	}
	else {
		return getURLParam1(param);
	}
}

