if(!$.my_promo) { $.my_promo = {}; }
if(!$.my_promo.bg) { $.my_promo.bg = {}; }


$.my_promo.bg.init = function() {
  var flashvars = { };
  var params = {
    quality: "best",
    wmode: "transparent",
    salign: "t",
    pluginspage: "http://www.macromedia.com/go/getflashplayer",
    scale: "noscale",
    allowFullScreen: "true",
    allowScriptAccess: "always",
    menu: "false"
  };
  var attributes = {
    id: "bg_lemon_set_movie",
    name: "bg_lemon_set_movie"
  };
  swfobject.embedSWF("/images/themes/mypromo/swf/bg.swf", "bg_lemon_set_movie", "100%", "700", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
};


if(!$.my_promo.schema) { $.my_promo.schema = {}; }

$.my_promo.schema.init = function(init_nid) {
  var flashvars = {
    nid: init_nid
	};
  var params = {
    quality: "best",
    wmode: "transparent",
    salign: "t",
    pluginspage: "http://www.macromedia.com/go/getflashplayer",
    scale: "noscale",
    allowFullScreen: "true",
    allowScriptAccess: "always",
    menu: "false"
  };
  var attributes = {
    id: "schema_movie",
    name: "schema_movie"
  };
  swfobject.embedSWF("/images/themes/mypromo/swf/schema.swf", "schema_movie", "100%", "420", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
};

$.my_promo.schema.updatePage = function(data) {
    alert(data);
};


$.my_promo.schema.loadPage = function(nid) {
	var pageUrl = null;
	if(schemaData.pages[nid].url) { pageUrl = schemaData.pages[nid].url; }
	if(pageUrl!==null) {
		//alert(pageUrl);
		$('#page').load(pageUrl+' #page_hld');
		$('#page_header_table td.title').load(pageUrl+' #title_hld');
		$('#path').load(pageUrl+' #path_hld');
		
		//$.get(pageUrl, $.my_promo.schema.updatePage);
	}
};

jQuery.getSchemaJSON = function() {
	if(schemaData && JSON) {
		return JSON.stringify(schemaData);
	} else {
		return null;
	}
};

jQuery.updatePage = function(id, updateSchema) {
	//alert(id+' '+updateSchema);
	if(!updateSchema) {
		$.my_promo.schema.loadPage(id);
	}
};



