| Current Path : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/ |
| Current File : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/accord_trans.php |
<?php
/**
* swmenupro v6.0
* http://swmenupro.com
* Copyright 2006 Sean White
* */
defined('_JEXEC') or die('Restricted access');
function AccordTransMenu($ordered, $swmenupro) {
$live_site = JURI::base();
if (substr($live_site, (strlen($live_site) - 1), 1) == "/") {
$live_site = substr($live_site, 0, (strlen($live_site) - 1));
}
if (substr($live_site, (strlen($live_site) - 13), 13) == "administrator") {
$live_site = substr($live_site, 0, (strlen($live_site) - 14));
}
if (substr($live_site, (strlen($live_site) - 1), 1) != "/") {
$live_site =$live_site."/" ;
}
// echo $expand;
$topcounter = 0;
$counter = 0;
$subcount = -1;
$doMenu = 1;
$act = 0;
$sub_str="";
$sub_menu="";
$uniqueID = $swmenupro['id'];
$number = count($ordered);
$topmenu = chain('ID', 'PARENT', 'ORDER', $ordered, $swmenupro['parentid'], 1);
$topcount = count($topmenu);
$indicator_image1="";
$indicator_image2="";
if ($swmenupro['top_sub_indicator']) {
// echo $top_sub_indicator;
$indicator_image1 = "<img src='" . $live_site . $swmenupro['top_sub_indicator'] . "' align='" . $swmenupro['top_sub_indicator_align'] . "' style='position:relative;left:" . $swmenupro['top_sub_indicator_left'] . "px;top:" . $swmenupro['top_sub_indicator_top'] . "px;' alt='' border='0' />";
}
if ($swmenupro['sub_sub_indicator']) {
$indicator_image2 = "<img src='" . $live_site . $swmenupro['sub_sub_indicator'] . "' align='" . $swmenupro['sub_sub_indicator_align'] . "' style='position:relative;left:" . $swmenupro['sub_sub_indicator_left'] . "px;top:" . $swmenupro['sub_sub_indicator_top'] . "px;' alt='' border='0' />";
}
$str = "\n<table cellpadding='0' cellspacing='0' border='0' id=\"accord-menu" . $uniqueID . "\"><tr><td>\n<div id=\"click-menu" . $uniqueID . "\" class=\"click-menu" . $uniqueID . "\" ><table cellpadding='0' cellspacing='0' border='0'><tr> \n";
$str.=$swmenupro['orientation']=='vertical'?"<td>":"" ;
$act = "";
while ($doMenu) {
if ($ordered[$counter]['indent'] == 0) {
$topcounter++;
$ordered[$counter]['URL'] = str_replace('&', '&', $ordered[$counter]['URL']);
$hasSub = 0;
$name = swmenu_getname($ordered[$counter]);
if ($counter + 1 == $number) {
$doSubMenu = 0;
$topmenu[$topcounter]['hassub'] = 0;
$doMenu = 0;
$classname = "nonbox" . $uniqueID;
} elseif ($ordered[$counter + 1]['indent'] == 0) {
$doSubMenu = 0;
$topmenu[$topcounter]['hassub'] = 0;
$classname = "nonbox" . $uniqueID;
} else {
$doSubMenu = 1;
$act == $topcounter ? $topmenu[($topcounter)]['hassub'] = 1 : $topmenu[($topcounter)]['hassub'] = 0;
$classname = "box" . $uniqueID;
$subcount++;
if ($swmenupro['disable_parent']) {
$ordered[$counter]['URL'] = "javascript:void(0);";
}
}
if (($ordered[$counter]['ID'] == $swmenupro['active_menu']) && $doSubMenu) {
$act = $subcount;
} elseif (($ordered[$counter]['ID'] == $swmenupro['active_menu']) && !$doSubMenu) {
$act = "";
}
$str.=$swmenupro['orientation']=='horizontal'?"<td>":"" ;
$linktext = "id=\"slideclick" . $uniqueID . $topcounter . "\" class=\"" . (($ordered[$counter]['ID'] == $swmenupro['active_menu']) ? "inbox1 act" : "inbox1") . "" . ($topcounter == $topcount ? " last" : "" ) . "\"";
if ($ordered[$counter]['TARGETLEVEL'] == "0") {
$str .= '<div class="' . $classname . '" id="topclick' . $uniqueID . ($counter + 1) . '"><a ' . $linktext . ' href="javascript:void(0);" >' . $name . '</a></div>' . "\n";
} else {
switch ($ordered[$counter]['TARGET']) {
case 1:
$str .= '<div class="' . $classname . '" id="topclick' . $uniqueID . ($counter + 1) . '"><a ' . $linktext . ' href="' . $ordered[$counter]['URL'] . '" target="_blank" >' . $name . '</a></div>' . "\n";
break;
case 2:
$str .= "<div class='" . $classname . "' id='topclick" . $uniqueID . ($counter + 1) . "'><a ' . $linktext . ' href=\"#\" onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" >" . $name . "</a></div>\n";
break;
case 3:
$str .= "<div class='" . $classname . "' id='topclick" . $uniqueID . ($counter + 1) . "'>" . $name . "\n";
break;
default:
$str .= '<div class="' . $classname . '" id="topclick' . $uniqueID . ($counter + 1) . '"><a ' . $linktext . ' href="' . $ordered[$counter]['URL'] . '" >' . $name . '</a></div>' . "\n";
break;
}
}
$counter++;
if (!$doSubMenu) {
// $str.= '<div style="position:absolute;top:-3000px;left:-3000px;" class="section' . $uniqueID . '"></div>' . "\n";
}
$str.=$swmenupro['orientation']=='horizontal'?"</td>":"" ;
while ($doSubMenu) {
if ($ordered[$counter]['indent'] != 0) {
if (($ordered[$counter]['indent'] == 1) && ($ordered[$counter - 1]['indent'] == 0)) {
$sub_str = '<div id="subsection' . $uniqueID . $topcounter . '" class="section' . $uniqueID . '">' . "\n";
$sub_str.=$swmenupro['orientation']=='horizontal'?"<table cellpadding='0' cellspacing='0'><tr>":"" ;
}
$ordered[$counter]['URL'] = str_replace('&', '&', $ordered[$counter]['URL']);
$name = swmenu_getname($ordered[$counter]);
if (($counter + 1 == $number) || ($ordered[$counter + 1]['indent'] == 0)) {
$doSubMenu = 0;
}
if ($ordered[$counter]['indent'] == 1) {
// $ordered[$counter]['indent'] = 1;
$classname = "inbox2";
if ($ordered[$counter]['indent'] > $ordered[$counter - 1]['indent']) {
$classname .= " first";
}
if (($counter + 1 == $number) || ($ordered[$counter + 1]['indent'] == 0)) {
$classname .= " last";
}
if (!$swmenupro['preview']){
$sub_itemid=sw_getsubactive($ordered);
}else{
$sub_itemid=0;
}
if ($sub_itemid == $ordered[$counter]['ID']) {
$classname .= ' sub-active';
}
if (($counter + 1 != $number) && ($ordered[$counter + 1]['indent'] > $ordered[$counter]['indent']) && $swmenupro['levelx_sub_indicator']) {
$name = "<img src='" . $live_site . $swmenupro['levelx_sub_indicator'] . "' align='" . $swmenupro['levelx_sub_indicator_align'] . "' style='position:relative;left:" . $swmenupro['levelx_sub_indicator_left'] . "px;top:" . $swmenupro['levelx_sub_indicator_top'] . "px;' alt='' border='0' />" . $name;
}
$sub_str.=$swmenupro['orientation']=='horizontal'?"<td>":"" ;
if ($ordered[$counter]['TARGETLEVEL'] == "0") {
$sub_str .= "<a id=\"menu" . $uniqueID . $ordered[$counter]['ID'] . "\" class=\"" . $classname . "\" href=\"javascript:void(0);\" >" . $name . "</a>\n";
} else {
switch ($ordered[$counter]['TARGET']) {
case 1:
$sub_str .= '<a id="menu' . $uniqueID . $ordered[$counter]['ID'] . '" class="' . $classname . '" href="' . $ordered[$counter]['URL'] . '" target="_blank" >' . $name . '</a>' . "\n";
break;
case 2:
$sub_str .= "<a id=\"menu" . $uniqueID . $ordered[$counter]['ID'] . "\" class=\"" . $classname . "\" href=\"#\" onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" >" . $name . "</a>\n";
break;
case 3:
$sub_str .= '' . $name . '' . "\n";
break;
default:
$sub_str .= '<a id="menu' . $uniqueID . $ordered[$counter]['ID'] . '" class="' . $classname . '" href="' . $ordered[$counter]['URL'] . '" >' . $name . '</a>' . "\n";
break;
}
}
$sub_str.=$swmenupro['orientation']=='horizontal'?"</td>":"" ;
}
$counter++;
$hasSub = 1;
}
}
}
if ($hasSub == 1) {
$sub_str.=$swmenupro['orientation']=='horizontal'?"</tr></table>":"" ;
$sub_str .= "</div> \n";
if($swmenupro['orientation']=='vertical'){
$str.=$sub_str;
}else{
$sub_menu.=$sub_str;
}
} else {
$str .= " \n";
}
if ($counter == ($number)) {
$doMenu = 0;
}
}
$str.=$swmenupro['orientation']=='vertical'?"</td>":"" ;
$str .= "</tr></table></div></td></tr></table>\n";
// echo $swmenupro['orientation'];
if($swmenupro['orientation']=='horizontal'){
$str.="<div class='click-menu".$swmenupro['id']."' >".$sub_menu."</div>\n";
}
$str .= "<script type=\"text/javascript\">\n";
$str .= "<!--\n";
$str .= "/***********************************************\n";
$str .= "* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)\n";
$str .= "* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts\n";
$str .= "* This notice must stay intact for legal use\n";
$str .= "***********************************************/\n\n";
$str .= "ddaccordion.init({\n";
$str .= "headerclass: 'box" . $uniqueID . "',\n";
$str .= "contentclass: 'section" . $uniqueID . "',\n";
$str .= "revealtype:'" . ($swmenupro['revealtype'] ? 'click' : 'mouseover') . "',\n";
$str .= "mouseoverdelay: " . $swmenupro['specialB'] . ",\n";
$str .= "collapseprev: " . ($swmenupro['autoclose'] ? 'true' : 'false') . ", \n";
$str .= "defaultexpanded: [" . $act . "],\n";
$str .= "onemustopen: false,\n";
$str .= "animatedefault: false,\n";
$str .= "persiststate: false,\n";
$str .= "toggleclass: ['','active'],\n";
$str .= "togglehtml: [\"prefix\", \"" . $indicator_image1 . "\", \"" . $indicator_image2 . "\"],\n";
$str .= "animatespeed:'normal',\n";
$str .= "oninit:function(headers, expandedindices){ },\n";
$str .= "onopenclose:function(header, index, state, isuseractivated){ }\n";
$str .= "})\n";
// $str .= "jQuery.noConflict();\n";
if (($swmenupro['c_corner_style'] != 'none') && ($swmenupro['c_corner_style'])&& ($swmenupro['c_corner_style'] != 'curvycorner')){
if (($swmenupro['main_border_width'] > 0) && ($swmenupro['main_border_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9 ) {\n";
// $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').css('z-index','-1');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').css('border','0');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').wrap('<div></div>');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').parent().css('padding', '" . $swmenupro['main_border_width'] . "px');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').parent().css('background-color', '" . $swmenupro['main_border_color'] . "');\n";
// $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').corner('" . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').parent().corner('keep " . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size'] + $swmenupro['main_border_width']) . "px');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').corner('keep " . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
// $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').parent().css('z-index','-1');\n";
$str .= "}else{\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').corner('keep " . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
$str .= "}\n";
}else{
$str .= "jQuery('#click-menu" . $swmenupro['id'] . "').corner('" . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
}
}
if (($swmenupro['t_corner_style'] != 'none') && ($swmenupro['t_corner_style'])&& ($swmenupro['t_corner_style'] != 'curvycorner')){
if (($swmenupro['main_border_over_width'] > 0) && ($swmenupro['main_border_over_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9) {\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').css('z-index','-1');\n";
// $str .= "jQuery('#swmenu .item1').wrap('<span></span>');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').parent().css('padding', '" . $swmenupro['main_border_over_width'] . "px');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').parent().css('background-color', '" . $swmenupro['main_border_color_over'] . "');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').corner('" . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size']) . "px');\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').parent().corner('" . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size'] + $swmenupro['main_border_over_width']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
$str .= "}else{\n";
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').corner('keep " . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size']) . "px');\n";
$str .= "}\n";
}else{
$str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').corner('" . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size']) . "px');\n";
}
}
if (($swmenupro['s_corner_style'] != 'none') && ($swmenupro['s_corner_style'])&& ($swmenupro['s_corner_style'] != 'curvycorner')){
if (($swmenupro['sub_border_width'] > 0) && ($swmenupro['sub_border_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9) {\n";
// $str .= "jQuery('.section').css('z-index','-1');\n";
// $str .= "jQuery('.section').wrap('<span></span>');\n";
// $str .= "jQuery('.section').parent().css('padding', '" . $swmenupro['sub_border_width'] . "px');\n";
// $str .= "jQuery('.section').parent().css('background-color', '" . $swmenupro['sub_border_color'] . "');\n";
$str .= "jQuery('.section" . $swmenupro['id'] . " .inbox2').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size']) . "px');\n";
// $str .= "jQuery('.section').parent().corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size'] + $swmenupro['sub_border_width']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
$str .= "}else{\n";
$str .= "jQuery('.section" . $swmenupro['id'] . " .inbox2').corner('keep " . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size']) . "px');\n";
$str .= "}\n";
}else{
if (@$swmenupro['stl_corner'] + @$swmenupro['str_corner'] != 0) {
$str .= "jQuery('.section" . $swmenupro['id'] . " .inbox2.first').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . @$swmenupro['s_corner_size'] . "px');\n";
}
if (@$swmenupro['sbl_corner'] + @$swmenupro['sbr_corner'] != 0) {
$str .= "jQuery('.section" . $swmenupro['id'] . " .inbox2.last').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . @$swmenupro['s_corner_size'] . "px');\n";
}
}
}
if ($swmenupro['expand_all']) {
$str .= "jQuery(document).ready(function($){\n";
$str .= "ddaccordion.expandall('box" . $uniqueID . "');\n";
$str .= "})\n";
}
if ($swmenupro['top_ttf']) {
$str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox1',{hover: true, fontFamily: '" . $swmenupro['top_font_face'] . "' });\n";
$str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox1-active',{hover: true, fontFamily: '" . $swmenupro['top_font_face'] . "' });\n";
}
if ($swmenupro['sub_ttf']) {
$str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox2',{hover: true, fontFamily: '" . $swmenupro['sub_font_face'] . "' });\n";
$str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox2-active',{hover: true, fontFamily: '" . $swmenupro['sub_font_face'] . "' });\n";
}
$str .= "//--> \n";
$str .= "</script> \n";
// $ordered = $menu;
$str .= "<div id=\"subwrap" . $swmenupro['id'] . "\"> \n";
$str .= "<script type=\"text/javascript\">\n";
$str .= "<!--\n";
$str .= "if (TransMenu.isSupported()) {\n";
if ($swmenupro['levelx_align'] == "right") {
$str .= "var ms = new TransMenuSet(TransMenu.direction.right, " . $swmenupro['level1_sub_left'] . ", " . $swmenupro['level1_sub_top'] . ", TransMenu.reference.topRight);\n";
} else {
$str .= "var ms = new TransMenuSet(TransMenu.direction.left, " . $swmenupro['level1_sub_left'] . ", " . $swmenupro['level1_sub_top'] . ", TransMenu.reference.topLeft);\n";
}
$par = $ordered[0];
for ($i = 0; $i < count($ordered); $i++) {
$sub=$ordered[$i];
$name = swmenu_getname($sub);
$sub2 = next($ordered);
if ($sub['TARGETLEVEL'] == "0" || $sub['TARGET'] == "3") {
$sub['TARGET'] = 0;
$sub['URL'] = "javascript:void(0);";
}
if (($sub['indent'] == 1) && (($sub2['indent']) > 1)) {
$str .= "var menu" . $swmenupro['id'] . $sub['ID'] . " = ms.addMenu(document.getElementById(\"menu" . $swmenupro['id'] . $sub['ID'] . "\"));\n ";
} else if (($sub['ORDER'] == 1) && ($sub['indent'] > 2)) {
$str .= "var menu" . $swmenupro['id'] . ($sub['ID']) . " = menu" . $swmenupro['id'] . findPar2($ordered, $par) . ".addMenu(menu" . $swmenupro['id'] . findPar2($ordered, $par) . ".items[" . ($par['ORDER'] - 1) . "]," . $swmenupro['levelx_sub_left'] . "," . $swmenupro['levelx_sub_top'] . ");\n";
}
if ($sub['indent'] > 1) {
$str .= "menu" . $swmenupro['id'] . findPar2($ordered, $sub) . ".addItem(\"" . addslashes($name) . "\", \"" . addslashes($sub['URL']) . "\", \"" . $sub['TARGET'] . "\");\n";
}
$par = $sub;
}
$str .= "function init" . $swmenupro['id'] . "() {\n";
$str .= "if (TransMenu.isSupported()) {\n";
$str .= "TransMenu.initialize();\n";
$counter = 0;
for ($i = 0; $i < count($ordered); $i++) {
if ($ordered[$i]['indent'] == 1) {
$counter++;
if (@$ordered[$i + 1]['indent'] == 2) {
//$str.="alert(temp_class);";
$str .= "menu" . $swmenupro['id'] . ($ordered[$i]['ID']) . ".onactivate = function() {\n";
$str.="temp_class=document.getElementById(\"menu" . $swmenupro['id'] . $ordered[$i]['ID'] . "\").className;\n";
$str.="document.getElementById(\"menu" . $swmenupro['id'] . $ordered[$i]['ID'] . "\").className = temp_class+\" active\";\n";
$str.="};\n ";
if ($ordered[$i]['ID'] == $sub_itemid) {
$str .= "menu" . $swmenupro['id'] . ($ordered[$i]['ID']) . ".ondeactivate = function() {\n";
$str.="temp_class=document.getElementById(\"menu" . $swmenupro['id'] . $ordered[$i]['ID'] . "\").className;\n";
$str.="document.getElementById(\"menu" . $swmenupro['id'] . $ordered[$i]['ID'] . "\").className = temp_class+\" active\";\n";
$str.="};\n ";
} else {
$str .= "menu" . $swmenupro['id'] . ($ordered[$i]['ID']) . ".ondeactivate = function() {\n";
// $str.="temp_class=document.getElementById(\"menu" . $swmenupro['id'] . $ordered[$i]['ID'] . "\").className;\n";
$str.="document.getElementById(\"menu" . $swmenupro['id'] . $ordered[$i]['ID'] . "\").className = temp_class;\n";
$str.="};\n ";
}
} else {
}
}
}
$str .= "}}\n";
if ($swmenupro['levelx_sub_indicator']) {
$str.="TransMenu.spacerGif = \"" . $live_site . "/modules/mod_swmenupro/images/transmenu/x.gif\";\n";
$str.="TransMenu.dingbatOn = \"" . $live_site . $swmenupro['levelx_sub_indicator'] . "\";\n";
$str.="TransMenu.dingbatOff = \"" . $live_site . $swmenupro['levelx_sub_indicator'] . "\"; \n";
$str.="TransMenu.sub_indicator = true; \n";
} else {
$str.="TransMenu.dingbatSize = 0;\n";
$str.="TransMenu.spacerGif = \"\";\n";
$str.="TransMenu.dingbatOn = \"\";\n";
$str.="TransMenu.dingbatOff = \"\"; \n";
$str.="TransMenu.sub_indicator = false;\n";
}
$str .= "TransMenu.menuPadding = 0;\n";
$str .= "TransMenu.itemPadding = 0;\n";
$str .= "TransMenu.shadowSize = 2;\n";
$str .= "TransMenu.shadowOffset = 3;\n";
$str .= "TransMenu.shadowColor = \"#888\";\n";
$str .= "TransMenu.shadowPng = \"" . $live_site . "/modules/mod_swmenupro/images/transmenu/grey-40.png\";\n";
$str .= "TransMenu.backgroundColor = \"" . ($swmenupro['sub_back'] ? $swmenupro['sub_back'] : '#fff') . "\";\n";
$str .= "TransMenu.backgroundPng = \"" . $live_site . "/modules/mod_swmenupro/images/transmenu/white-90.png\";\n";
$str .= "TransMenu.hideDelay = " . ($swmenupro['specialB'] * 2) . ";\n";
$str .= "TransMenu.slideTime = " . $swmenupro['specialB'] . ";\n";
$str .= "TransMenu.modid = " . $swmenupro['id'] . ";\n";
$str .= "TransMenu.selecthack = false;\n";
$str .= "TransMenu.autoposition = true;\n";
$str .= "TransMenu.fontFace = \"" . (@$fontface ? $fontface : '') . "\";\n";
$str .= "TransMenu.fontColor = \"" . $swmenupro['main_font_color'] . "\";\n";
$str .= "TransMenu.activeId = \"" . @$active_id . "\";\n";
//$str .= "TransMenu.preview = \"" . $preview . "\";\n";
$str .= "TransMenu.renderAll();\n";
$str .= "if ( typeof window.addEventListener != \"undefined\" )\n";
$str .= "window.addEventListener( \"load\", init" . $swmenupro['id'] . ", false );\n";
$str .= "else if ( typeof window.attachEvent != \"undefined\" ) {\n";
$str .= "window.attachEvent( \"onload\", init" . $swmenupro['id'] . " );\n";
$str .= "}else{\n";
$str .= "if ( window.onload != null ) {\n";
$str .= "var oldOnload = window.onload;\n";
$str .= "window.onload = function ( e ) {\n";
$str .= "oldOnload( e );\n";
$str .= "init" . $swmenupro['id'] . "();\n";
$str .= "}\n}else\n";
$str .= "window.onload = init" . $swmenupro['id'] . "();\n";
$str .= "}\n}\n-->\n</script>\n</div>\n";
if ($swmenupro['overlay_hack']) {
$str .= "<script type=\"text/javascript\">\n";
$str .= "<!--\n";
$str .= "jQuery(document).ready(function($){\n";
$str .= "jQuery('#click-menu" . $uniqueID . "').parents().css('position','static');\n";
$str .= "jQuery('#click-menu" . $uniqueID . "').parents().css('z-index','100');\n";
$str .= "jQuery('#click-menu" . $uniqueID . "').css('z-index','101');\n";
$str .= "});\n";
$str .= "//--> \n";
$str .= "</script> \n";
}
return $str;
}
?>