/*
Theme Name: Model Metrics
Theme URI: http://www.modelmetrics.com/
Description: A custom theme coded by <a href="http://www.VelvetBlues.com/">Velvet Blues</a>.
Version: 1.0
Author: Shirley Patterson
Author URI: http://www.velvetblues.com/
*/

#wrap {
	position:absolute;
	overflow: hidden;
	text-align:center;
	margin:0px;
	padding:0px;
	background: #f8f8f8;
	border: 1px solid #c8c8c8;
}

#carousel {
	width: 1024px;
	height: 763px;
}

#carousel ul li img{
	width: 1024px;
	height: 763px;
   	border: none;
}

.shadow { -webkit-box-shadow: rgba(0,0,0,0.35) 0 1px 3px; -moz-box-shadow: rgba(0,0,0,0.35) 0 1px 3px; }
img.shadow { padding: 5px; background: #fff; margin-bottom: 2px; *border: 1px solid #e2e2e2; position: relative; }

/* simple dot navs */
#simple-nav li,
#simple-nav li a { display:-moz-inline-stack; display:inline-block; *display:inline; zoom:1; }
#simple-nav li { position:relative; margin-right:8px; width:13px; height:13px; *height: 12px; overflow:hidden; }
#simple-nav li.last-dot { margin-right: 0; }
#simple-nav li a { position:absolute; width:13px; height:38px; top:0; left:0; outline:none; cursor:pointer; text-indent:-9999px; line-height:0; }
#simple-nav li a.hover { top:-13px; }
#simple-nav li a.active { cursor:default; top:-26px; opacity:1; -moz-opacity:1; }

#gallerygraydots li,
#gallerygraydots li a { display:-moz-inline-stack; display:inline-block; *display:inline; zoom:1; }
#gallerygraydots li { position:relative; margin-right:7px; width:13px; height:13px; overflow:hidden; }
#gallerygraydots li.last-dot { margin-right: 0; }
#gallerygraydots li a { position: absolute;top:0;left:0;width:13px; height:32px; _overflow: hidden; outline:none; cursor:pointer; background-position: 0 -13px;background-repeat:no-repeat;}
#gallerygraydots li a.hover { background-position: 0 0; -moz-opacity:.8; filter:alpha(opacity=80); opacity:.80; }
#gallerygraydots li a.active { cursor:default; background-position: 0 0;  -moz-opacity:1; filter:alpha(opacity=100); opacity:1; }

*{margin:0px;padding:0px;border:0px;}
html{height:100%;min-height:100%;width:100%;}
body{background-color:#ffffff;color:#666666;font-family:Arial,Verdana,Helvetica;font-size:12px;font-weight:normal;width:100%;line-height:normal;text-align:center;letter-spacing:normal;}
#container{width:952px;position:relative;margin:0 auto;background-color:#ffffff;border-left:1px solid #cccccc;border-right:1px solid #cccccc;height:auto;}

p{line-height:16px;}
a{color:#669943;}
a:visited{color:#030;}

input{border-color:#666666 #999999 #cccccc #999999;}
#header{position:relative;width:918px;height:129px;margin:0 auto;}
#logo{position:absolute; left:8px; top:9px;width:265px; height:76px;}
#top-links{position:relative;float:right;margin-top:12px;display:inline;}
#top-links img{display:inline;vertical-align:text-top;margin-right:4px;}
#top-links a:link, #top-links a:visited{color:#666666;text-decoration:none;margin-left:20px;}
#top-links a:hover, #top-links a:active{color:#999999;}
#search{position:relative;float:right;margin-top:12px;}
#search .field,.field{border:1px solid; border-color:#666666 #999999 #cccccc #999999;height:14px;width:152px;;margin-right:7px;vertical-align:middle;color:#999999;font-size:11px;padding:2px 4px 2px 4px;}
#content input{margin-top:3px;margin-bottom:3px;border-color:#666666 #999999 #cccccc #999999;}
/*.entry p input{border:1px solid; border-color:#666666 #999999 #cccccc #999999;height:14px;width:152px;;margin:3px 7px;vertical-align:middle;color:#999999;font-size:11px;padding:2px 4px 2px 4px;}*/
.entry label{display:block;}
.entry select, .entry input{border:1px solid; border-color:#666666 #999999 #cccccc #999999;height:18px;margin:3px 0;vertical-align:middle;color:#999999;font-size:11px;}
#search .middle{vertical-align:middle;}
#nav{background: url(images/navBack.png) no-repeat; position:absolute;top:97px;left:0px;height:32px;}
#nav ul{width:918px;height:32px;}
#nav ul li{display:inline;float:left;list-style:none;}
#nav li a {
	background: url(images/navLiBack.png) no-repeat top right;
	font-family: Arial, sans-serif;
	color: #999;
	font-size: 14px;
	font-weight: normal;
	padding: 8px 15px 7px 15px;
	line-height: 32px;
	text-decoration: none;
}
#nav ul li.first {margin: 0 0 0 1px;}
#nav li a:hover {
	background: url(images/navLiBackOver.png) no-repeat top right;
	color: #333;
}
#nav li a.selected {
	color: #bbb;
}
#content{position:relative;width:918px;margin:13px auto 0 auto;text-align:left;}
#home{position:relative;width:952px;margin:13px auto 0 auto;text-align:left;}
#home h1{font-size:14px;color:#999999;font-weight:bold;font-family:"Century Gothic", Georgia, "Times New Roman";padding:0 0 0 19px;}
#home h2{font-size:12px;color:#333333;font-style:italic;font-weight:normal;padding:15px 0 0 19px;}
#home p{color:#666666;padding:10px 28px 0px 19px;text-align:justify;}
#home #left{}
#home #text{width:720px;border-right:1px solid #cccccc;margin-top:15px;float:left;}

#blog{position:relative;width:952px;margin:13px auto 0 auto;text-align:left;}
#blog h1{font-size:18px;color:#333333;font-weight:bold;/*font-family:"Century Gothic", Georgia, "Times New Roman";*/padding:0 0 5px 0px;}
#blog h2{font-size:16px;color:#333333;font-style:normal;font-weight:bold;padding:0px 0 10px 0px;}
#blog h2.pagetitle{font-size:18px;font-weight:bold;padding:0px 0 10px 0px;}
#blog p{color:#666666;padding:10px 3px 5px 0px;text-align:justify;}
#blog #left{}
#blog #text{width:709px;border-right:1px solid #cccccc;margin-top:15px;float:left;}
.blog-post{position:relative;float:left;display:inline;padding:0 0 20px 39px;width:660px;}
#blog .blog-post ul{margin-left:40px;}

#images{position:relative;float:left;display:inline;height:232px;width:720px;background:#ffffff url(images/home-gradient.jpg) repeat-x bottom;padding-bottom:10px;}
.feature{width:200px;position:relative;float:left;display:inline;margin:0 6px 0 27px;}
.feature h3{font-size:14px;color:#666666;font-weight:bold;font-family:"Century Gothic", Georgia, "Times New Roman";padding:0 0 0 17px;}
#images p{padding:0 0 0 25px;text-align:left;}
#images p a{color:#669933;font-size:11px;text-align:left;text-decoration:none;}
#images p a:hover{color:#003300;}
#home #news{width:215px;position:relative;float:right;display:inline;margin-top:5px;}
#news h4{font-size:12px;color:#333333;font-weight:normal;margin:10px 0 0 15px;}
#news h4 a:link,#news h4 a:visited{color:#333333;text-decoration:none;}
#news h4 a:hover,#news h4 a:active{text-decoration:underline;}
#news p{font-size:10px;color:#666666;margin:5px 10px 0 30px;text-align:left;padding:0px;}

#archives{width:215px;position:relative;float:right;display:inline;margin-top:5px;}
#archives h3{font-size:18px;color:#333333;font-weight:bold;margin:10px 0 6px 0;}
#archives h4 a:link,#news h4 a:visited{color:#333333;text-decoration:none;}
#archives h4 a:hover,#news h4 a:active{text-decoration:underline;}
#archives p{font-size:10px;color:#666666;margin:5px 10px 0 30px;text-align:left;padding:0px;}
#archives ul{}
#archives li{list-style-position:inside;}
#archives ul#authorlist li{list-style:none;margin-top:5px;}
#archives ul#authorlist a{text-decoration:none;}

#curve{position:relative;margin:0 auto;height:9px;width:954px;background:url(images/home-bottom.gif) no-repeat;}
#page-curve{position:relative;margin:0 auto;height:9px;width:954px;background:url(images/page-bottom.gif) no-repeat;}
#flash-place{position:relative;float:left;display:inline;width:918px; height:224px;margin-left:17px;}
#bannerdsav2_hype_container{position:relative;float:left;display:inline;width:918px; height:224px;margin-left:17px;}
#banner-place{position:relative;float:left;display:inline;width:918px; height:224px;margin-left:17px;}
#footer{position:relative;width:954px;margin:10px auto 0 auto;font-size:11px;}
#footer a:link,#footer a:visited{color:#666666;text-decoration:none;}
#footer a:hover,#footer a:active{color:#999999;}
#footer #top{background:#f3f3f3 url(images/footer-drk.gif) repeat;width:954px;height:28px;overflow:hidden;}
#footer #top ul#left{float:left;margin:7px 0 0 15px;}
#footer #top ul#right{float:right;margin:7px 15px 0 0;}
#footer #top ul li{display:inline;list-style:none;padding:0 5px 0 5px;}
#footer #bottom{position:relative;float:left;display:inline;margin-top:2px;height:165px;}
#footer #bottom ul{position:relative;float:left;display:inline;background:#f3f3f3 url(images/footer-lt.gif) repeat;height:142px;padding:20px 0 8px 17px;}
#footer #bottom ul li{text-align:left;list-style:none;padding:0;margin:0;display:inline;float:left;}
ul#products{width:102px;margin:0 2px 0 0;float:left;display:inline;}
ul#products li{width:100px;}
ul#services{width:173px;margin-right:2px;}
ul#services li{width:171px;}
ul#verticals{width:129px;margin-right:2px;}
ul#verticals li{width:127px;}
ul#customers{width:100px;margin-right:2px;}
ul#customers li{width:98px;}
ul#resources{width:98px;margin-right:2px;}
ul#resources li{width:96px;}
ul#careers{width:114px;margin-right:2px;}
ul#careers li{width:112px;}
ul#about-us{width:107px;}
ul#about-us li{width:107px;}
#salesforce{text-align:center;position:relative;width:954px;display:block;}
#salesforce img{vertical-align:text-top;margin:15px 30px 0 0;}
#copyright{text-align:center;position:relative;width:954px;display:block;color:#999999;font-size:10px;}
#copyright p{margin-top:15px;}
.br{border-right:1px solid #666666;}
.bl{border-left:1px solid #666666;}
.header{text-transform:uppercase;font-weight:bold;}
.clear{clear:both;}
.indent{margin:10px 0 0 15px;}
.block{display:block;}
.space{margin-top:10px;}
.lflash{margin-left:6px;}

#sidebar{width:178px;background:#f3f3f3 url(images/side-bg.gif) repeat-y; height:auto;float:left;position:relative;margin-right:10px;display:inline;}
#side-top{width:178px;height:8px;background:#f3f3f3 url(images/side-top.gif) no-repeat;}
#sidebar h2{font-size:18px;color:#333333;padding-bottom:10px;}
#side-content{position:relative;float:left;display:inline;padding:0 5px 0 15px;}
#side-bottom{width:#178px;height:8px;background:#f3f3f3 url(images/side-bottom.gif) no-repeat;}
#sidebar ul{padding-top:10px;padding-bottom:10px;border-bottom:1px dashed #cccccc;border-top:1px dashed #cccccc;}
#sidebar ul li{list-style:none;color:#666666;font-size:12px;padding:5px 0 5px 0;}
#sidebar ul li ul{border:none;margin:0 0 0 10px;padding:5px 0 5px 0;}
#sidebar ul li ul li{list-style:none;color:#666666;font-size:11px;padding:5px 0 5px 0;}
#sidebar .page_item a:link, #sidebar .page_item a:visited{color:#666666;text-decoration:none;}
#sidebar .page_item a:hover{color:#cccccc;}
#sidebar li.page_item ul{display:none;}
#sidebar li.current_page_item, #sidebar li.current_page_parent{font-weight:bold;}
#sidebar li.current_page_item ul{display:block;font-weight:normal;}
#sidebar li.current_page_parent ul{display:block;font-weight:normal;}
#sidebar li.current_page_parent ul li.current_page_item{font-weight:bold;}

#sitemap ul{padding-top:10px;padding-bottom:10px;list-style:none;}
#sitemap ul li{list-style:none;color:#666666;font-size:12px;padding:5px 20px 5px 0;width:215px;float:left;display:inline;position:relative;}
#sitemap ul li.c1{width:170px;}
#sitemap ul li.c3,#sitemap ul li.c4{width:130px;}
#sitemap ul li ul{border:none;margin:0 0 0 10px;padding:0;}
#sitemap ul li ul li{list-style:none;color:#666666;font-size:11px;padding:5px 0 0 0;}
#sitemap .page_item a:link, #sitemap .page_item a:visited{color:#666666;text-decoration:none;}
#sitemap .page_item a:hover{color:#cccccc;}

.post{width:706px;position:relative;float:right;display:inline;padding-left:20px;}
.clearit{width:700px;padding-right:6px;}
.no-sidebar-post{width:740px;position:relative;float:left;display:inline;padding-left:85px;}

#content h1{font-size:18px;color:#333333;padding:15px 0 10px 0;margin:0;font-weight:bold;}
#content h3{font-size:14px;color:#333333;padding:15px 0 10px 0;margin:0;font-weight:bold;}

.navigation{position:relative;float:left;width:100%;}
.entry p{margin-bottom:10px;}
.entry ul{margin:0 0 10px 20px;}

a.view{float:right;margin-right:40px;display:block;font-weight:bold;text-decoration:none;}
a.view:hover{text-decoration:underline;}
/*.grayalt h2.bhead{border-top:1px solid #ccc;padding-top:10px;}
.grayalt h2,.grayalt p{background:#f3f3f3 url(images/footer-lt.gif) repeat;}
.grayalt p{border-bottom:1px solid #ccc;padding-bottom:10px;}*/
.grayalt{background:#f3f3f3 url(images/footer-lt.gif) repeat;border-top:1px solid #ccc;padding-top:10px;border-bottom:1px solid #ccc;padding-bottom:10px;margin:5px 0 10px 0;}

a#feed{background: url(images/feed-icon-16x16.gif) no-repeat center left;padding:2px 0 2px 21px;margin-left:10px;}

.calnk a:hover {
         background-position:0 0;
         text-decoration:none;  
         color:#000000;
         border-bottom:1px dotted #000000;
         }
    .calnk a:visited {
         text-decoration:none;
         color:#000000;
         border-bottom:1px dotted #000000;
        }
    .calnk a {
        text-decoration:none; 
        color:#000000; 
        border-bottom:1px dotted #000000;
        }
    .calnk a span { 
        display:none; 
        }
    .calnk a:hover span {
        color:#333333; 
        background:#F6F79B; 
        display:block;
        position:absolute; 
        margin-top:1px; 
        padding:5px; 
        width:150px; 
        z-index:100;
        }
     .calendar-table {
        border:none;
        width:100%;
     }
     .calendar-heading {
        height:25px;
        text-align:center;
        border:1px solid #D6DED5;
        background-color:#E4EBE3;
     }
     .calendar-next {
        width:25%;
        text-align:center;
     }
     .calendar-prev {
        width:25%;
        text-align:center;
     }
     .calendar-month {
        width:50%;
        text-align:center;
        font-weight:bold;
     }
     .normal-day-heading {
        text-align:center;
        width:25px;
        height:25px;
        font-size:0.8em;
        border:1px solid #DFE6DE;
        background-color:#EBF2EA;
     }
     .weekend-heading {
        text-align:center;
        width:25px;
        height:25px;
        font-size:0.8em;
        border:1px solid #DFE6DE;
        background-color:#EBF2EA;
        color:#FF0000;
     }
     .day-with-date {
        vertical-align:text-top;
        text-align:left;
        width:60px;
        height:60px;
        border:1px solid #DFE6DE;
     }
     .no-events {

     }
     .day-without-date {
        width:60px;
        height:60px;
        border:1px solid #E9F0E8;
     }
     span.weekend {
        color:#FF0000;
     }
     .current-day {
        vertical-align:text-top;
        text-align:left;
        width:60px;
        height:60px;
        border:1px solid #BFBFBF;
        background-color:#E4EBE3;
     }
     span.event {
        font-size:0.75em;
     }
     .kjo-link {
        font-size:0.75em;
        text-align:center;
     }
     .event-title {
        text-align:center;
        font-weight:bold;
        font-size:1.2em;
     }
     .event-title-break {
        width:96%;
        margin-left:2%;
        margin-right:2%;
        margin-top:5px;
        margin-bottom:5px;
        text-align:center;
        height:1px;
        background-color:#000000;
     }
     .event-content-break {
        width:96%;
        margin-left:2%;
        margin-right:2%;
        margin-top:5px;
        margin-bottom:5px;
        text-align:center;
        height:1px;
        background-color:#000000;
     }
     .calendar-date-switcher {
        height:25px;
        text-align:center;
        border:1px solid #D6DED5;
        background-color:#E4EBE3;
     }
     .calendar-date-switcher form {
        margin:0;
        padding:0;
     }
     .calendar-date-switcher input {
        border:1px #D6DED5 solid;
     }
     .calendar-date-switcher select {
        border:1px #D6DED5 solid;
     }
     .cat-key {
        width:100%;
        margin-top:10px;
        padding:5px;
        border:1px solid #D6DED5;
     }
    .calnk a:hover {
         background-position:0 0;
         text-decoration:none;  
         color:#000000;
         border-bottom:1px dotted #000000;
         }
    .calnk a:visited {
         text-decoration:none;
         color:#000000;
         border-bottom:1px dotted #000000;
        }
    .calnk a {
        text-decoration:none; 
        color:#000000; 
        border-bottom:1px dotted #000000;
        }
    .calnk a span { 
        display:none; 
        }
    .calnk a:hover span {
        color:#333333; 
        background:#F6F79B; 
        display:block;
        position:absolute; 
        margin-top:1px; 
        padding:5px; 
        width:150px; 
        z-index:100;
        }
     .training_schedule-table {
        border:none;
        width:100%;
     }
     .training_schedule-heading {
        height:25px;
        text-align:center;
        border:1px solid #D6DED5;
        background-color:#E4EBE3;
     }
     .training_schedule-next {
        width:25%;
        text-align:center;
     }
     .training_schedule-prev {
        width:25%;
        text-align:center;
     }
     .training_schedule-month {
        width:50%;
        text-align:center;
        font-weight:bold;
     }
     .normal-day-heading {
        text-align:center;
        width:25px;
        height:25px;
        font-size:0.8em;
        border:1px solid #DFE6DE;
        background-color:#EBF2EA;
     }
     .weekend-heading {
        text-align:center;
        width:25px;
        height:25px;
        font-size:0.8em;
        border:1px solid #DFE6DE;
        background-color:#EBF2EA;
        color:#FF0000;
     }
     .day-with-date {
        vertical-align:text-top;
        text-align:left;
        width:60px;
        height:60px;
        border:1px solid #DFE6DE;
     }
     .no-events {

     }
     .day-without-date {
        width:60px;
        height:60px;
        border:1px solid #E9F0E8;
     }
     span.weekend {
        color:#FF0000;
     }
     .current-day {
        vertical-align:text-top;
        text-align:left;
        width:60px;
        height:60px;
        border:1px solid #BFBFBF;
        background-color:#E4EBE3;
     }
     span.event {
        font-size:0.75em;
     }
     .kjo-link {
        font-size:0.75em;
        text-align:center;
     }
     .event-title {
        text-align:center;
        font-weight:bold;
        font-size:1.2em;
     }
     .event-title-break {
        width:96%;
        margin-left:2%;
        margin-right:2%;
        margin-top:5px;
        margin-bottom:5px;
        text-align:center;
        height:1px;
        background-color:#000000;
     }
     .event-content-break {
        width:96%;
        margin-left:2%;
        margin-right:2%;
        margin-top:5px;
        margin-bottom:5px;
        text-align:center;
        height:1px;
        background-color:#000000;
     }
     .training_schedule-date-switcher {
        height:25px;
        text-align:center;
        border:1px solid #D6DED5;
        background-color:#E4EBE3;
     }
     .training_schedule-date-switcher form {
        margin:0;
        padding:0;
     }
     .training_schedule-date-switcher input {
        border:1px #D6DED5 solid;
     }
     .training_schedule-date-switcher select {
        border:1px #D6DED5 solid;
     }
     .cat-key {
        width:100%;
        margin-top:10px;
        padding:5px;
        border:1px solid #D6DED5;
     }
input#author,input#email,input#url{width:120px;margin-right:10px;}
input#author,input#email,input#url,textarea#comment{border:1px solid;border-color:#666666 #999999 #cccccc #999999;font-family:Arial, Helvetica, sans-serif;font-size:11px;padding:0px 0px;}
textarea#comment{width:400px;}
label small{font-size:11px;}
input#submit{background-color:#ADD036;padding:3px 4px;font-family:Arial, Helvetica, sans-serif;color:#fff;font-weight:bold;font-size:14px;}

.commentlist li, #commentform input, #commentform textarea {
	font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
	}
.commentlist li ul li {
	font-size: 1em;
}

.commentlist li {
	font-weight: bold;
}

.commentlist li .avatar { 
	float: right;
	border: 1px solid #eee;
	padding: 2px;
	background: #fff;
	}

.commentlist cite, .commentlist cite a {
	font-weight: bold;
	font-style: normal;
	font-size: 1.1em;
	}

.commentlist p {
	font-weight: normal;
	line-height: 1.5em;
	text-transform: none;
	}


.commentmetadata {
	font-weight: normal;
	}
#respond:after {
		content: "."; 
	    display: block; 
	    height: 0; 
	    clear: both; 
	    visibility: hidden;
	}
#commentform #submit {
	margin: 0 0 5px auto;
	}
/* Begin Comments*/
.alt {
	margin: 0;
	padding: 10px;
	}

.commentlist {
	padding: 0;
	text-align: justify;
	}

.commentlist li {
	margin: 15px 0 10px;
	padding: 5px 5px 10px 10px;
	list-style: none;

	}
.commentlist li ul li { 
	margin-right: -5px;
	margin-left: 10px;
}

.commentlist p {
	margin: 10px 5px 10px 0;
}
.children { padding: 0; }


.nocomments {
	text-align: center;
	margin: 0;
	padding: 0;
	}

.commentmetadata {
	margin: 0;
	display: block;
	}
/* End Comments */

<?php

   /*

   Plugin Name: WP CSS Dropdown Menu
   Plugin URI: http://zackdesign.biz
   Description: Creates a navigation menu of pages with dropdown menus for child pages. Uses ONLY cross-browser friendly CSS, no Javascript.
   Version: 2.3.7
   Author: Isaac Rowntree
   Author URI: http://www.zackdesign.biz

   */





	function curPageURL() {
	   $pageURL = 'http';
	   if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
	   $pageURL .= "://";
	   if ($_SERVER["SERVER_PORT"] != "80") {
	    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
	   } else {
	   $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	   }
	  return $pageURL;
	}

   function wp_css_dropdownmenu($before_plugin = '<div class="menu"><ul>', $after_plugin = '</ul></div>', $start_id = 0, $show_home = true, $one_level = false)
   {
     $before = '<ul>';
	   $after = '</ul>';		
		 $articles = get_pages_from_DB();
		 $no_urls = get_option('wp_css_menu_urls');
		 $urls = explode(',',$no_urls);
    
    if ($start_id == '0')
    {
        if (is_user_logged_in())
            $start_parent = get_option('wp_css_auth_ID');
        else
            $start_parent = get_option('wp_css_start_page');
    
        if (empty($start_parent))
            $start_parent = 0;
    }
    else
        $start_parent = $start_id;
        
    if (is_home() || is_page('home'))
        $class="current_page";
     
     if (get_option('wp_css_menu_home') && $show_home)
     {
         $text = get_option('wp_css_menu_hometext');
	 if (!empty($text))
             $result = '<li class="menu_item '.$class.'"><a href="'.get_bloginfo('url').'" rel="bookmark" title="'.get_bloginfo('name').'">'.$text.'</a></li>';
	 else
             $result = '<li class="menu_item '.$class.'"><a href="'.get_bloginfo('url').'" rel="bookmark" title="'.get_bloginfo('name').'">Home</a></li>';
    }
    else
         $result = '';
     
     $result = build_CSSDropDown_menu($articles, $start_parent, $urls, $result, $one_level);
     
     if (empty($result))
         $result = '<!--<li>No page posts to display.</li>-->';
     
		  //	Show the results
		 echo $before_plugin.$result.$after_plugin;	      
  }


function get_pages_from_DB ( $parent = -1 )
{
    global $wpdb; // Global wordpress variables
    
    if ($parent > -1)
        $parent = " AND $wpdb->posts.post_parent = '$parent'";
    else
        $parent = '';

     $pages = get_option('excluded_css_dropdown_pages');

     $remove = '';
     if ($pages)
     {
         $pages = explode(',',$pages);
         foreach ($pages as $page)
             $remove .= ' AND ID != ' . $page;
     }
     
      
     
      $postSQL =  "SELECT 
			$wpdb->posts.ID, 
			$wpdb->posts.post_title,
			$wpdb->posts.post_parent";
			
		$postSQL	.=	" FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' $parent AND $wpdb->posts.post_type = 'page'" . $remove;
      
      $sorting = get_option('wp_css_menu_sort');
      
      if ($sorting == 'alpha')
          $postSQL	.=	" ORDER BY $wpdb->posts.post_title";
      else
          $postSQL	.=	" ORDER BY $wpdb->posts.menu_order";

		  //	Get the results
		  return $wpdb->get_results($postSQL);
}

function css_dropdownmenu_css() {

    $dynamic = get_option('wp_css_menu_dynamic');
    $start_parent = get_option('wp_css_start_page');
    if (empty($start_parent))
        $start_parent = 0;
    $extra_pages = get_option('wp_css_extra');
    if (empty($extra_pages))
        $extra_pages = 0;
        
    if (get_option('wp_css_menu_home'))
        $extra_pages++;
        
    if ($dynamic)
    {
        $pages = sizeof(get_pages_from_DB($start_parent)) + $extra_pages;
        $width = get_option('wp_css_menu_width');
        $class = get_option('wp_css_menu_class');
        if (!$class || ($class == ''))
            $class = 'menu';
        
        // Li is the full width divided by the number of pages - the a width is li less a seemingly arbitrary number??
        $li = ($width - 1) / $pages ;
        $a  = $li - 10;
        
        $lili = 128;
        // Now the second level widths...
        $lili = 128;
        if ($li > $lili)
            $lili = $li - 21;
        $aa = $lili + 22;
            
        
        echo '
        <!-- wp_css_menu_dropdown dynamic menu widths -->
        <style type=\'text/css\' media=\'screen\'>
            .'.$class.' {width: '.$width.'px}
            * html .'.$class.' {width:'.$width.'px; w\idth:'.$width.'px;}
            .'.$class.' li {width:'.$li.'px; }
            .'.$class.' a, .'.$class.' a:visited {width:'.$a.'px; }
            * html .'.$class.' a, * html .'.$class.' a:visited {width:'.$a.'px; w\idth:'.($a-2).'px;}
            .'.$class.' ul ul a, .'.$class.' ul ul a:visited {width:'.$lili.'px;}
            * html .'.$class.' ul ul a, * html .'.$class.' ul ul a:visited {width:'.$aa.'px;w\idth:'.$lili.'px;}       
            .'.$class.' ul ul ul {width:'.$li.'px; left:'.$li.'px}
            .'.$class.' ul ul {width:'.$li.'px;}                     
        </style>
        <!-- /dynamic menu widths -->
        
        ';
    }
}


function CSSDropDownMenu_options () {

     echo '<div class="wrap"><h2>Wordpress CSS Drop-Down Menu</h2>';

     if ($_REQUEST['submit_css_content']) {
          update_CSSDropDownMenu_options();
     }

     displayCSSDropDownMenuAdminPage();

     echo '</div>';

}



  function update_CSSDropDownMenu_options()

  {

     $updated = false;
     
     if (!$_REQUEST['dynamic'])
         $_REQUEST['dynamic'] = 0;
         
     update_option('wp_css_menu_dynamic', $_REQUEST['dynamic']);
     update_option('wp_css_menu_class', $_REQUEST['cssclass']);
     update_option('wp_css_start_page', $_REQUEST['start_page']);
     update_option('wp_css_auth_ID', $_REQUEST['auth_ID']);
     update_option('wp_css_menu_width', $_REQUEST['menu_width']);
     update_option('wp_css_extra', $_REQUEST['extra_pages']);
     update_option('wp_css_menu_urls', $_REQUEST['urls']);
     update_option('wp_css_menu_home', $_REQUEST['home']);
     update_option('wp_css_menu_parent_urls', $_REQUEST['parent_url']);
     update_option('wp_css_menu_sort', $_REQUEST['sort']);
     update_option('wp_css_menu_hometext', $_REQUEST['home_text']);

          update_option('excluded_css_dropdown_pages', $_REQUEST['pages']);
     $updated = true;


     if ($updated) {

           echo '<div id="message" class="updated fade">';

           echo '<p>Options Updated</p>';

           echo '</div>';

      } else {

           echo '<div id="message" class="error fade">';

           echo '<p>Unable to update options</p>';

           echo '</div>';

      }

  }

	

	function displayCSSDropDownMenuAdminPage()

	{

	    $pages = get_option('excluded_css_dropdown_pages');
	    $class = get_option('wp_css_menu_class');
	    $width = get_option('wp_css_menu_width');
	    $page = get_option('wp_css_start_page');
	    $auth_ID = get_option('wp_css_auth_ID');
	    $extra = get_option('wp_css_extra');
	    $urls = get_option('wp_css_menu_urls');
	    $sorting = get_option('wp_css_menu_sort');	    
	    $home = get_option('wp_css_menu_hometext');
	    if (empty($home))
	        $home = 'Home';   
	    
	    if (get_option('wp_css_menu_dynamic'))
        $checked = 'checked="checked"';
      else
        $checked = '';
      if (get_option('wp_css_menu_home'))
        $hchecked = 'checked="checked"';
      else
        $hchecked = '';
      if (get_option('wp_css_menu_parent_urls'))
        $pchecked = 'checked="checked"';
      else
        $pchecked = '';

?>



	<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">

		<h3>Home Page Button? <input type="checkbox" name="home" value="1" <?php echo $hchecked; ?>> </h3>
		<p>Button text:  <input type="text" value="<?php echo $home; ?>" name="home_text" /></p>
		
		<h3>No URLs for Menu Parents? <input type="checkbox" name="parent_url" value="1" <?php echo $pchecked; ?>></h3>

    <h3>Exclude Pages by ID</h3>

		<p><b>Pages: </b><input type="text" name="pages" value="<?php echo $pages; ?>"></p>
		
		<p>Seperate by commas if putting in multiple pages, e.g. 12,23,43.</p>
		
		<h3>Remove URLs by ID</h3>

		<p><b>Pages: </b><input type="text" name="urls" value="<?php echo $urls; ?>"></p>

    <p>Seperate by commas if putting in multiple pages, e.g. 12,23,43.</p>
    
    <h3>Authenticated Menu</h3>
    
    <p><b>Authenticated Starting ID: </b><input type="text" name="auth_ID" value="<?php echo $auth_ID; ?>"></p>
    <p>Give logged-in users a different menu starting on a given page ID.</p>
    <p><b>Non-Authenticated ID: </b><input type="text" name="start_page" value="<?php echo $page; ?>"></p>
    <p>Use this if you have no need for authentication but want a different starting parent ID other than 0, or to give non-authenticated users a menu.</p>
    
    <h3>Page Ordering</h3>
    
       <p><b>Choose:</b> <select name="sort"><option value="alpha" <?php if ($sorting == 'alpha' ) echo 'selected ="selected"'; ?>>Alphabetically</option><option value="menu" <?php if ($sorting == 'menu' ) echo 'selected ="selected"'; ?>>Menu Order</option></select></p>
    
    <h3>Dynamic Menu Width</h3>


		<p><b>Dynamic? </b><input type="checkbox" name="dynamic" value="1" <?php echo $checked; ?>></p>
		<p><b>Dynamic class (to be used if you set something other than .menu): </b>
     <b>.</b><input type="text" name="cssclass" value="<?php echo $class; ?>"></p>
    <p><b>Width: </b><input type="text" name="menu_width" value="<?php echo $width; ?>"></p>
    <p><b>Extra Pages: </b><input type="text" name="extra_pages" value="<?php echo $extra; ?>"></p>
    <p>Extra pages are the pages you have added in when creating your own 'wrapping' HTML. Expected is the number of extra pages. This will be used to 
    decide how wide to make each list element.</p>
  


		<div class="submit">

			<input type="submit" name="submit_css_content" value="<?php _e('Save', 'CSSDropDownMenu') ?>" />

		</div></form>



<?php

	}

function build_CSSDropDown_menu($pages, $cur_level, $no_urls, $result = '', $one_level = false)
{    
    foreach ($pages as $page)
    {      
        if ($page->post_parent == $cur_level)
        {
            $listTitle	=	stripslashes(str_replace('"', '', $page->post_title));
	    
	    // Go through list of 'no urls' and check this one
            if (is_array($no_urls))
            {
                foreach ($no_urls as $u)
                {
                    if ($page->ID == $u)
                    {
                        $url = false;
                        break;
                    }
                    else
                        $url = post_permalink($page->ID);
		}
            }
	    
	    // Get children
	    if (!$one_level)
          $children = build_CSSDropDown_menu($pages,$page->ID,$no_urls);
	    
	    // If menu parents can't be clicked also check to see if there are children present
	    if (get_option('wp_css_menu_parent_urls') && !empty($children))
	    {
		$url = false;
	    }
            
            if (strstr($children, 'current_page'))
                $parent = 'current_parent';
            else if (!empty($children))
                $parent = 'parent';
	    else
	        $parent = '';
            
            // Need to find the current page the user is visiting and add the class accordingly
            global $post;
            if ($post->ID == $page->ID)
            {
                $class="class='menu_item menu_item_$page->ID current_page $parent'";
                $aclass="class='menu_item_link menu_item_link_$page->ID current_page_link $parent'";
            }
            else
            {
                $class="class='menu_item menu_item_$page->ID $parent'";
                $aclass="class='menu_item_link menu_item_link_$page->ID $parent'";
            }
            
	    $title = apply_filters( 'the_title', htmlspecialchars($listTitle) );
	    
	    if (!$url)
	        $result .= '
		<li '.$class.'><a '.$aclass.' rel="bookmark" title="' . $title . '">' . $title;
	    else
	        $result .= '
		<li '.$class.'><a href="' . $url . '" '.$aclass.' rel="bookmark" title="' . $title . '">' . $title;
            
            if (!empty($children))
                $result .= '<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
		<ul>'.$children.'</ul><!--[if lte IE 6]></td></tr></table></a><![endif]--></li>';
            else
                $result .= '</a></li>';
        }
    }
    
    return $result;
}
	

	function setupCSSDropDownMenuAdminPanel()

	{

			add_options_page('CSS Drop-down Menu', 'CSS Drop-down Menu', 9, basename(__FILE__), 'CSSDropDownMenu_options');

	}



	add_action('wp_head', 'css_dropdownmenu_css', 1);

	add_action('admin_menu', 'setupCSSDropDownMenuAdminPanel');


?>
