	embedPlayer = function (id, width, height, vid, ap, share) {

jQuery(".topVideo").html('<div id="videoPlayHome"><img src="" width="398" height="268" alt="" /></div>');
		if ( vid.length > 12 )
		{
			flashvars = {
				MediaLink: escape(vid),
				playOnStart: ap,
				autoHideOther: false,
				fullVideoScale: false,
				allowFullScreen: true,
				autoHideVideoControls: false,
				htmlpath: location.href,
				share: false,
				script_path: vidShareUrl,
				bufferSize: 5,
				logo: logoUrlsm,
				logoLink: baseUrl,
				logoTarget: '_new',
				fitToPlayer: false,
				logoX: 2,
				logoY: 2
			};
			params = {
				bgcolor: "#333333",
				allowfullscreen: "true",
				wmode: 'transparent'
			};
			attributes = {};
			so = new swfobject.embedSWF(vidPlayer, id, width, height, "9.0.0", "expressInstall.swf", flashvars, params, attributes);

		}
		else
		{

			jQuery(".topVideo").html('<iframe src="/site/video-js/post.php?vdata=' + vid + '" style="border: none;width: 398px; height: 268px;overflow: hidden;" scrolling="no" ></iframe>');

			//jQuery("#videoPlayHome").html('<video id="example_video_1" class="video-js" width="398" height="268" controls="controls" preload="auto" autoplay="autoplay" ><source src="http://video-js.zencoder.com/oceans-clip.mp4" type=' + "'video/mp4; codecs=" + '"avc1.42E01E, mp4a.40.2"' + "'" + ' /><source src="http://video-js.zencoder.com/oceans-clip.webm" type=' + "'" + 'video/webm; codecs="vp8, vorbis"' + "'" + ' /><source src="http://video-js.zencoder.com/oceans-clip.ogv" type=' + "'video/ogg; codecs=" + '"theora, vorbis"' + "'" + '/><object id="flash_fallback_1" class="vjs-flash-fallback" width="398" height="268" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"><param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" /><param name="allowfullscreen" value="true" /><param name="flashvars" value=' + "'" + 'config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":true,"autoBuffering":true}]}' + "'" + ' /><img src="http://video-js.zencoder.com/oceans-clip.png" width="398" height="268" alt="Poster Image" title="No video playback capabilities." /></object></video>');
			//VideoJS.setupAllWhenReady();
		}

	};
jQuery(document).ready(function ($) {
								 
	$i = 0;
	$vcontainer = $('#videoArea');
	$videoPlayId = "videoPlayHome";
	$('#videoScroll').empty().append('<ul></ul>');
	$('#videoList li').each(function () {
		$(this).attr('rel', $i);
		$('.videoSelect ul').append('<li><img src="' + $('.thumb img', $(this)).attr('src') + '" width="94" height="78" rel="' + $i + '" vid="' + $('.videoId', $(this)).attr('rel') + '" alt="' + $('h2', $(this)).text() + '" /></li>');
		$i++;
	});
	$('.videoSelect').append('<div class="clr"></div>');
	embedPlayer($videoPlayId, 398, 268, $('#videoList li:eq(0) .videoId').text(), true, false);
	$('.videoSelect ul li:eq(0) img').addClass('active');
	$('.controls span').text($('.videoSelect ul li:eq(0) img').attr('alt'));
	$('.videoSelect img', $vcontainer).click(function () {
		$('.videoSelect img').removeClass('active');
		$vid = $('#videoList li:eq(' + $(this).attr('rel') + ') .videoId').text();
		embedPlayer($videoPlayId, 398, 268, $vid, true, false);
		$('.controls span').empty().hide().text($(this).attr('alt')).fadeIn();
		$(this).addClass('active');
	});
	$container = $('#featured');
	$i = 0;
	$('.featuredBanner li').each(function () {
		$(this).attr('rel', $i);
		$('.thumbs .inner').append('<img src="' + $('img', $(this)).attr('src') + '" width="70" height="43" alt="" rel="' + $i + '" />')
		$i++;
	});
	$curr = 0;
	$totalSlide = $i;
	var setSlide = function ($i) {
		$slide = $('.featuredBanner li:eq(' + $i + ')');
		$('.thumbs img', $container).removeClass('active');
		$('.imageBox', $container).empty().append('<img src="" width="470" height="268" alt="" style="display:none" />');
		$('.imageBox img', $container).attr('src', $('img', $slide).attr('src'));
		$('.feature h3', $container).text($('h2', $slide).text());
		$('.feature p:first', $container).text($('p:first', $slide).text());
		$('.imageBox img', $container).ready(function ($) {
			$('.imageBox img', $container).fadeIn('slow');
		});
		$('.thumbs img[rel=' + $i + ']', $container).addClass('active');
	};
	var makeSlide = function () {
		$curr = $curr + 1;
		if ($curr > $totalSlide - 1) {
			$curr = 0;
		}
		setSlide($curr);
	};
	setSlide($curr);
	var slideInterval = 0;
	slideInterval = setInterval(function () {
		makeSlide();
	}, 7000);
	$('.thumbs img', $container).click(function () {
		slideInterval = clearInterval(slideInterval);
		$curr = (Number)($(this).attr('rel'));
		setSlide($curr);
		slideInterval = setInterval(function () {
			makeSlide();
		}, 7000);
	});
	$("#videoScroll").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		visible: 4,
		circular: false
	});
	$('.page-item-222>a,.page-item-241>a,.page-item-3>a').click(function () {
		return false;
	}).attr('href', '#');


// For Live Radio in header
	$radioHeaderTimeout = 0;
	$liveHeader = $('#radioHeader');
	$('.leftCol',$liveHeader).empty().append('<img />');

	function radioHeaders() {
		$.getJSON("http://dgtizer.com/radio/playlistjson.php",
		//$.getJSON("http://localhost/playlistjson.txt",
				function(data){
						$p=data.playlist[0];
						$pC=data.count;
						//$('.leftCol img', $liveHeader).attr('src', thumbUrl+'?w=94&h=78&zc=1&src='+escape($p.albumart)).attr('width', '94').attr('height', 78);
						$('.leftCol img', $liveHeader).attr('src', $p.albumart).attr('width', 94).attr('height', 78);
						$('.rightCol h3', $liveHeader).empty().append($p.title);
						$('.rightCol .album', $liveHeader).empty().append($p.album);
						$pL=$('#playlistOnline');
						if($pL.html()){
								$pL.empty();
							for(i=1;i<$pC;i++){
							$p=data.playlist[i];
								$pL.append('<div class="row" id="r'+i+'"><div class="c1"><img /></div><div class="c2"><h2></h2><div class="album"></div></div><div class="clr"></div></div>');
								$r=$('#r'+i);
								$('.c1 img', $r).attr('src', $p.albumart).attr('width', 120).attr('height', 120);
								$('.c2 h2', $r).empty().append($p.title);
								$('.c2 .album', $r).empty().append($p.album);
								
								}
							
							
							}
				});


/*$.ajax({
			url: 'http://dgtizer.com/radio/playjs.php?callback=?',
			dateType: 'jsonp',
			success: function (data, textStatus) {
				$p = eval(data) || {
					pics: null,
					artist: null,
					album: null
				};
				$('.leftCol img', $liveHeader).attr('src', $p.pics).attr('width', '94').attr('height', 78);
				$('.rightCol h3', $liveHeader).empty().append($p.artist);
				$('.rightCol .album', $liveHeader).empty().append($p.album);
			}
		});
*/	};
	$radioHeaderTimeout = setInterval(function () {
		radioHeaders();
	}, 50000);
	radioHeaders();
	
	
	
});
