
var SK_MENU_TMPL_PREF="sk_menu_tmpl_";var SK_MENU_CONTAINER_PREF="sk_menu_container_";var SK_MENUITEM_LINK_PREFIX="sk_mi_link_";var SK_MENUITEM_TD_PREFIX="sk_mi_td_";var SK_SUBMENU_CONTAINER_PREF="sk_submenu_div_";var SK_SUBMENU_MAX_OPACITY=99;var SK_MENU_STROLL_LENGTH=30;var SKM_CONST={FLASH_LAYOUT:1,TEXT_LAYOUT:2,IMAGEN_LAYOUT:3,qqq:0}


function SKMenu(oProps){this.props=oProps;this.menuItems={};this.menuItemsIndexId=[];this.menuItemsCount=0;this.addMenuItem=function(oMIProps){this.menuItemsCount++;this.menuItems[oMIProps.id]=new SKMenuItem(this.props.id,oMIProps,this.menuItemsCount);this.menuItemsIndexId[this.menuItems[oMIProps.id].menuItemIndex]=oMIProps.id;}
this.hideSubMenus=function(){for(var i in this.menuItems){this.menuItems[i].hideSubMenu();}}
this.print=function(){if(this.menuItemsCount==0){return;}
var sMenuItemsHTML='';for(var i in this.menuItems){sMenuItemsHTML+=this.menuItems[i].getHTML();}
var sMenuTemplate=document.getElementById(SK_MENU_TMPL_PREF+this.props.id).value;var oCommonProps={menuitems:sMenuItemsHTML}
for(var i in this.props.tmpl_props){oCommonProps[i]=this.props.tmpl_props[i];}
var sMenuHTML=sMenuTemplate.supplant(oCommonProps);sMenuHTML=sMenuHTML.replace(/obj_inst\:\"(.*?)\"/g,"obj_inst\:&#34;$1&#34;");document.getElementById(SK_MENU_CONTAINER_PREF+this.props.id).innerHTML=sMenuHTML;for(var i in this.menuItems){this.menuItems[i].onMenuPrint();this.menuItems[i].updateCurrentState();}}
this.getMenuItemById=function(sID){return this.menuItems[sID];}
this.getMenuItemByIndex=function(iMIIndex){if(!this.menuItemsIndexId[iMIIndex]){return null;}
return this.getMenuItemById(this.menuItemsIndexId[iMIIndex])}
var self=this;}


var TIMEOUT_TO_HIDE_SUBMENU=500;function SKMenuItem(sMenuId,oMIProps,iMIIndex){this.menuId=sMenuId;this.menuItemIndex=iMIIndex;this.slideContentObj=null;this.props=oMIProps;this.isOpen=false;this.timeoutHandler=0;this.subItems=new Array();this.subItemsCount=0;this.addSubItem=function(oSIProps){this.subItemsCount++;this.subItems[oSIProps.id]=new SKMenuItem(this.menuId,oSIProps,this.subItemsCount);}
this.getSubMenuItemById=function(sID){return this.subItems[sID];}
this.showSubMenu=function(){if(typeof SKMenus=='undefined')return;SKMenus[this.menuId].hideSubMenus();this.isOpen=true;this.updateCurrentState();if(this.subItemsCount==0){return;}
this.setSubMenuPosition();SKLayerShow(SK_SUBMENU_CONTAINER_PREF+this.props.id);this.playAnimation(0);}
this.hideSubMenu=function(){this.isOpen=false;SKLayerHide(SK_SUBMENU_CONTAINER_PREF+this.props.id);if(!isUndefined(this.props.subMenuOpacity)){this.props.subMenuOpacity=0;this.opacityChange(0);}
this.updateCurrentState();}
this.playAnimation=function(direction){if(direction!=0){this.hideSubMenu();}}
this.setSubMenuPosition=function(){}
this.updateCurrentState=function(){}
this.opacityChange=function(iOpacity){this.props.subMenuOpacity=iOpacity;var oSubMenuLayer=document.getElementById(SK_SUBMENU_CONTAINER_PREF+this.props.id);if(this.props.subMenuOpacity<0){this.props.subMenuOpacity=0;this.hideSubMenu();}
if(this.props.subMenuOpacity>SK_SUBMENU_MAX_OPACITY){this.props.subMenuOpacity=SK_SUBMENU_MAX_OPACITY;if(document.all){oSubMenuLayer.style.filter='';}else{oSubMenuLayer.style.MozOpacity=99/100;}
return;}
if(document.all){oSubMenuLayer.style.filter='alpha(opacity='+this.props.subMenuOpacity+')';}else{oSubMenuLayer.style.MozOpacity=this.props.subMenuOpacity/100;}}
this.getHTML=function(){var sSubItemsHTML='';for(var i=0;i<this.subItems.length;i++){sSubItemsHTML+=this.subItems[i].getHTML();}
var sLayoutType=this.props.default_layout;var oLayout=this.props.layouts[sLayoutType];if(sLayoutType==SKM_CONST.FLASH_LAYOUT){if(!oLayout.template_props){oLayout.template_props={};}
oLayout.template_props['flash_code']=ComposeFlashCode(oLayout);}else if(sLayoutType==SKM_CONST.TEXT_LAYOUT){var sCutSuffix='...';if(oLayout.cut_suffix){sCutSuffix=oLayout.cut_suffix;}
if(oLayout.max_chars&&oLayout.text.length>oLayout.max_chars){oLayout.text=oLayout.text.substr(0,oLayout.max_chars-sCutSuffix.length);oLayout.text+=sCutSuffix;}
if(oLayout.wrap_chars){var iMaxTextChunkLength=oLayout.wrap_chars;var sMIText='';var arrSITextChunks=oLayout.text.split(' ');for(var i=0;i<arrSITextChunks.length;i++){var sTextChunk=arrSITextChunks[i];if(sTextChunk.toString().length>iMaxTextChunkLength){var sModifiedTextChunk='';function _add_new_lines(sText){return sText.substr(0,iMaxTextChunkLength)+'<br>';}
var j=0;var sRemainingText='';do{var sStartText=_add_new_lines(sTextChunk.substr(j*iMaxTextChunkLength,(j+1)*iMaxTextChunkLength));j++;sRemainingText=sTextChunk.substr(j*iMaxTextChunkLength,(j+1)*iMaxTextChunkLength);sModifiedTextChunk+=sStartText;}while(sRemainingText.length>iMaxTextChunkLength);sTextChunk=sModifiedTextChunk+sRemainingText;}
sMIText+=sTextChunk+' ';}
oLayout.text=sMIText.replace(/ $/,'');}
var re=/{/g;oLayout.text=oLayout.text.replace(re,"&#123;");re=/}/g;oLayout.text=oLayout.text.replace(re,"&#125;");if(!oLayout.template_props){oLayout.template_props={};}
oLayout.template_props['menuitem_text']=oLayout.text;}else if(sLayoutType==SKM_CONST.IMAGEN_LAYOUT){}
if(this.props.slide_content){this.slideContentObj=SlideContent_Create(this.props.slide_content_props);ONLOAD_FUNCTIONS.push('SlideContent_GetById("'+this.slideContentObj.id+'").init()');}
var sMenuItemTmpl=oLayout.template;var oCommonProps={menuitem_obj_id:this.props.id,menu_obj_id:this.menuId,menuitem_td_id:SK_MENUITEM_TD_PREFIX+this.props.id,menuitem_mouseover:"if( typeof SKMenus != 'undefined' ) { SKMenus["+this.menuId+"].getMenuItemById('"+this.props.id+"').onmouseover(); }",menuitem_mouseout:"if( typeof SKMenus != 'undefined' ) { SKMenus["+this.menuId+"].getMenuItemById('"+this.props.id+"').onmouseout(); }",menuitem_id:SK_MENUITEM_LINK_PREFIX+this.props.id,menuitem_href:this.props.href,menuitem_target:this.props.target,menuitem_title:this.props.title,menuitem_wce_icon:"",subitems_container_id:SK_SUBMENU_CONTAINER_PREF+this.props.id,subitem_block_mouseover:"if( typeof SKMenus != 'undefined' ) { SKMenus["+this.menuId+"].getMenuItemById('"+this.props.id+"').onmouseover(); }",subitem_block_mouseout:"if( typeof SKMenus != 'undefined' ) { SKMenus["+this.menuId+"].getMenuItemById('"+this.props.id+"').onmouseout(); }",subitems:sSubItemsHTML}
if(this.slideContentObj!=null){oCommonProps['slide_content_start']=this.slideContentObj.getStartHtml();oCommonProps['slide_content_end']=this.slideContentObj.getEndHtml();}
if(oLayout.template_props){for(var i in oLayout.template_props){oCommonProps[i]=oLayout.template_props[i];}}
var sMenuitemHTML=sMenuItemTmpl.supplant(oCommonProps);sMenuitemHTML=sMenuitemHTML.replace(/obj_inst\:\"(.*?)\"/g,"obj_inst\:&#34;$1&#34;");return sMenuitemHTML;}
this.onmouseover=function(){if(this.slideContentObj!=null){this.slideContentObj.forward();}
if(this.subItemsCount>0){window.clearInterval(this.timeoutHandler);this.timeoutHandler=0;if(!this.isOpen){this.showSubMenu();}}}
this.onmouseout=function(){if(this.slideContentObj!=null){this.slideContentObj.backward();}
if(this.subItemsCount>0){if(this.timeoutHandler==0){this.timeoutHandler=window.setTimeout('if( typeof SKMenus != "undefined" ) { SKMenus['+this.menuId+'].getMenuItemById('+this.props.id+').playAnimation(1); }',TIMEOUT_TO_HIDE_SUBMENU);}}}
this.onMenuPrint=function(){}
function ComposeFlashCode(oProps){var sHtml=''+'<OBJECT classid  = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+'codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '+'WIDTH    = "'+oProps.flash_width+'" '+'HEIGHT   = "'+oProps.flash_height+'" '+'>'+'<PARAM NAME = "FlashVars"          VALUE = "'+oProps.flash_vars+'">'+'<PARAM NAME = "movie"              VALUE = "'+oProps.flash_src+'">'+'<PARAM NAME = "quality"            VALUE = "high">'+'<PARAM NAME = "allowscriptaccess"  VALUE = "always">'+'<PARAM NAME = "allownetworking"    VALUE = "external">';if(oProps.flash_is_transparent){sHtml+='<PARAM NAME = "wmode"   VALUE = "transparent">';}
if(oProps.flash_bg_color){sHtml+='<PARAM NAME = "bgcolor" VALUE = "'+oProps.flash_bg_color+'">';}
sHtml+='<EMBED src          = "'+oProps.flash_src+'" '+'quality          = "high" '+'width            = "'+oProps.flash_width+'" '+'height           = "'+oProps.flash_height+'" '+'allowscriptaccess= "always" '+'allownetworking  = "external" '+'type             = "application/x-shockwave-flash" '+'pluginspage      = "http://www.macromedia.com/go/getflashplayer" '+'wmode            = "transparent" '+'FlashVars        = "'+oProps.flash_vars+'" ';if(oProps.flash_bg_color){sHtml+='bgcolor = "'+oProps.flash_bg_color+'" ';}
sHtml+='></EMBED>'+'</OBJECT>';return sHtml;}
var self=this;}


function SKLayerShow(id){document.getElementById(id).style.display="block";}
function SKLayerHide(id){document.getElementById(id).style.display="none";}
function SKGetIconHTML(id){var code='';if(admin){var menu=eval('wce_menu_'+id);var code=menu.GetRenderCode();}
return code;}


String.prototype.entityify=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");}
String.prototype.quote=function(){return'"'+this.replace(/(["\\])/g,'\\$1')+'"';}
String.prototype.supplant=function(oProps,bReplaceWithBlank,oCallBack){var i,j,vValue;var sString=this;var q=0;var sOpenTag=(isUndefined(oProps.__open_tag))?'{':oProps.__open_tag;var sCloseTag=(isUndefined(oProps.__close_tag))?'}':oProps.__close_tag;for(;;){i=q+sString.substring(q,sString.length).indexOf(sOpenTag);if(i<0){break;}
if(i+1<=q){break;}
j=sString.indexOf(sCloseTag,i+1);if(j==-1){break;}
if(isDefined(oCallBack)){vValue=oCallBack(sString.substring(i+1,j),oProps);}else{vValue=oProps[sString.substring(i+1,j)];}
if(isUndefined(vValue)){if(bReplaceWithBlank){vValue='';}else{q=i+1;continue;}}
sString=sString.substring(0,i)+vValue+sString.substring(j+1);}
return sString;}
String.prototype.trim=function(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");}
if(!isFunction(Function.apply)){Function.prototype.apply=function(o,a){var r,x='____apply';if(!isObject(o)){o={};}
o[x]=this;switch((a&&a.length)||0){case 0:r=o[x]();break;case 1:r=o[x](a[0]);break;case 2:r=o[x](a[0],a[1]);break;case 3:r=o[x](a[0],a[1],a[2]);break;case 4:r=o[x](a[0],a[1],a[2],a[3]);break;case 5:r=o[x](a[0],a[1],a[2],a[3],a[4]);break;case 6:r=o[x](a[0],a[1],a[2],a[3],a[4],a[5]);break;default:}
delete o[x];return r;}}
Function.prototype.inherits=function(parent){var d=0,p=(this.prototype=new parent());this.prototype.uber=function uber(name){var f,r,t=d,v=parent.prototype;if(t){while(t){v=v.constructor.prototype;t-=1;}
f=v[name];}else{f=p[name];if(f==this[name]){f=v[name];}}
d+=1;r=f.apply(this,Array.prototype.slice.apply(arguments,[1]));d-=1;return r;}
return this;}
Function.prototype.swiss=function(parent){for(var i=1;i<arguments.length;i+=1){var name=arguments[i];this.prototype[name]=parent.prototype[name];}
return this;}
function isAlien(a){return isObject(a)&&typeof a.constructor!='function';}
function isArray(a){return isObject(a)&&a.constructor==Array;}
function isBoolean(a){return typeof a=='boolean';}
function isEmpty(o){var i,v;if(isObject(o)){for(i in o){v=o[i];if(isUndefined(v)&&isFunction(v)){return false;}}}
return true;}
function isFunction(a){return typeof a=='function';}
function isNull(a){return typeof a=='object'&&!a;}
function isNumber(a){return typeof a=='number'&&isFinite(a);}
function isObject(a){return(a&&typeof a=='object')||isFunction(a);}
function isString(a){return typeof a=='string';}
function isUndefined(a){return typeof a=='undefined';}
function isDefined(a){return typeof a!='undefined';}
function stringify(arg){var i,o,v;switch(typeof arg){case'object':if(arg){if(arg.constructor==Array){o='[';for(i=0;i<arg.length;++i){v=stringify(arg[i]);if(v!='function'&&!isUndefined(v)){o+=(o!='['?',':'')+v;}else{o+=',';}}
return o+']';}else if(typeof arg.toString!='undefined'){o='{';for(i in arg){v=stringify(arg[i]);if(v!='function'&&!isUndefined(v)){o+=(o!='{'?',':'')+
i.quote()+':'+v;}}
return o+'}';}else{return;}}
return'null';case'unknown':case'undefined':return;case'string':return arg.quote();case'function':return'function';default:return String(arg);}}

