<?php
/*
File Name: Wordpress Theme Toolkit
Version: 1.0
Author: Ozh
Author URI: http://planetOzh.com/
*/

/************************************************************************************
 * THEME USERS : don't touch anything !! Or don't ask the theme author for support :)
 ************************************************************************************/

include(dirname(__FILE__).'/themetoolkit.php');

themetoolkit(
	'visteredLittle', 

	array(
	
	'sidebarlocation' => 'Sidebar Location {radio|right|Right (default)|left|Left} ## Select which side of the page you want your sidebar to be on.',
	'skin' => 'Skin {radio|default|Default|shiny|Shiny|citrus|Citrus} ## Select a skin/theme to change the design of your page.',
	
	),
	__FILE__	 
);
	
/************************************************************************************
 * THEME AUTHOR : Congratulations ! The hard work is all done now :)
 *
 * From now on, you can create functions for your theme that will use the array
 * of variables $mytheme->option. For example there will be now a variable
 * $mytheme->option['your_age'] with value as set by theme end-user in the admin menu.
 ************************************************************************************/

/***************************************
 * Additionnal Features and Functions
 *
 * Create your own functions using the array
 * of user defined variables $mytheme->option.
 *
 **************************************/

function pickaskin() {
	global $visteredLittle;
        if ($visteredLittle->option['skin']) {
				print "@import url(";
				bloginfo('template_directory');
				print "/";
				print $visteredLittle->option['skin'];
				print ".css);\n";
			}
        else { 
				print "@import url(";
				bloginfo('template_directory');
				print "/default.css);\n"; 
			}
}

function buildWallpaperArray() {

}

function spitOutWallpaperJS() {
	$d=TEMPLATEPATH.'/wallpapers/';
	$wallpapers=array();
	$dir = opendir($d);
	 while ($f = readdir($dir)) { 
	  if (eregi("\.jpg",$f)){ 
	   array_push($wallpapers,"$f"); 
	  }
	 }
	$countwallpapers = '0';
	foreach($wallpapers as $wallpaper) {
	print "if (number == '" . $countwallpapers . "') {document.body.style.background = \"url('";
	bloginfo('template_directory');
	print "/wallpapers/" . $wallpaper . "') top center fixed\"; createCookie('wpcookie','" . $countwallpapers . "',7); } else {}\n";
	$countwallpapers++;
	 }
}


function spitOutWallpaperCSS() {
	$d=TEMPLATEPATH.'/wallpapers/';
	$wallpapers=array();
	$dir = opendir($d);
	 while ($f = readdir($dir)) { 
	  if (eregi("\.jpg",$f)){ 
	   array_push($wallpapers,"$f"); 
	  }
	 }
	$countwallpapers = '0';
	foreach($wallpapers as $wallpaper) {
	if($countwallpapers == '0') { 
	print "#body { background: url('";
	bloginfo('template_directory'); 
	print "/images/" . $wallpaper . "') top center fixed; }\n";
	 }
	print "#wallpaper" . $countwallpapers . " { background: url('";
	bloginfo('template_directory'); 
	print "/wallpapers/" . $wallpaper . "') center; }\n";
	$countwallpapers++;
	 }
}

function spitOutWallpaperThumbs() {
	$d=TEMPLATEPATH.'/wallpapers/';
	$wallpapers=array();
	$dir = opendir($d);
	 while ($f = readdir($dir)) { 
	  if (eregi("\.jpg",$f)){ 
	   array_push($wallpapers,"$f"); 
	  }
	 }
	$countwallpapers = '0';
	foreach($wallpapers as $wallpaper) {
	print "<a href=\"javascript: void(0);\" onclick=\"changebackground(" . $countwallpapers . ");\" id=\"wallpaper" . $countwallpapers . "\" class=\"wallpaper\"></a>\n";
	$countwallpapers++;
	 }
}

function spitOutIEFix() {
	global $visteredLittle;
        if ($visteredLittle->option['skin']) {
				$skin = $visteredLittle->option['skin'];
			}
        else { 
				$skin = "default";
			}

	?>
	
	<!--[if lte IE 6]>

	<style type="text/css">
	 /* ie png hack */
	 /* special thanks to Christopher Walker (http://tibetanportal.com/) 
	    for his contribution */

	#header { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/header.png, sizingMethod=scale); }
	.blog { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/blogbackground.png, sizingMethod=scale); }
	.blogbefore { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/blogtop.png, sizingMethod=scale); }
	.blogafter { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/blogbottom.png, sizingMethod=scale); }
	.menu { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/menubackground.png, sizingMethod=scale); }
	.menubefore { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/menutop.png, sizingMethod=scale); }
	.menuafter { background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=<?php bloginfo('template_directory'); ?>/images/<?php echo $skin; ?>/menubottom.png, sizingMethod=scale); }
	#menucontainer h3, #wp-calendar caption, #menucontainer h2 { background: url('<?php bloginfo('template_directory'); ?>/images/bigstar.gif') left center no-repeat; }

	</style>

 	<![endif]-->   
	
	<?php

}

function spitOutMenuPosition() {
	global $visteredLittle;
        if ($visteredLittle->option['sidebarlocation'] == "left") {
				print "@import url(";
				bloginfo('template_directory');
				print "/menuleft.css);\n";
			}
        else { 
			}
}

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'before_widget' => '<div class="menubefore"></div>
<div class="menu">',
        'after_widget' => '</div>
<div class="menuafter"></div>',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
    ));

function widget_vistered_calendar() {
echo '<div class="menubefore"></div>
<div class="menu">';
 get_calendar();
echo '</div>
<div class="menuafter"></div>';
 }
 
if ( function_exists('register_sidebar_widget') )
 register_sidebar_widget(__('Calendar'), 'widget_vistered_calendar');

function widget_vistered_links() { ?>
<div class="menubefore"></div>
<div class="menu">
<ul id="links">
<?php get_links_list('id'); ?>
</ul>
</div>
<div class="menuafter"></div>
<?php }
if ( function_exists('register_sidebar_widget') )
 register_sidebar_widget(__('Links'), 'widget_vistered_links');

?>