/* Slideshow

--------

Author: Sovit Tamrakar

URl: http://ssovit.com

Version: 1.0

---------

*/

(function (jQuery) {

	jQuery.fn.slideshow = function (input) {

		var defaults = {

			autoplay: true,

			loop: true,

			width: 500,

			music: false,

			map: false,

			topbar: true,

			height: 400,

			thumbwidth: 35,

			thumbheight: 30,

			timeout: 5000,

			imgdata: '[]',

			thumbshow:2,
			description: null,
			contact: null,
			website: null

		};

		var htmlMakeup = ''

			+'<div class="ccloader mix-slideshow">'

			+'	<div class="info">'

			+'		<div class="description">{DESCRIPTION}</div>'

			+'		<div class="contact">{CONTACT}</div>'

			+'		<a href="{WEBSITE}" class="website_url">&nbsp;</a>'

			+'	</div>'	

			+'	<div class="ichurakov_update"></div>'

			+'</div>'

		//alert(this.length)

		return this.each(function () {
			
			var options = jQuery.extend(defaults, input);

			htmlMakeup = htmlMakeup.replace("{DESCRIPTION}", options.description).replace("{CONTACT}", options.contact).replace("{WEBSITE}", options.website);
			
			//Crucial Inits

			var $ = jQuery;

			//alert($(this).html())

			var element = $(htmlMakeup);

			

			var surfix = $(this).attr("id")

			var $this = $(this)

			///

			var holder = jQuery(".ichurakov_update", element);

			//$(this).remove();

			$this.replaceWith(element)

			

			//alert(holder.attr("class"))

			//return

			//element.append(holder.remove());

			

			///return

			//return;

			var holder_name = holder.attr('id');

			

			//Object Setup

			

			var container = jQuery(options.container, holder);

			var w = options.width;

			var h = options.height;

			var map = options.map;

			var topbar = options.topbar;

			//Animation Variables

			var tw = options.thumbwidth;

			var th = options.thumbheight;

			

			var tshow = options.thumbshow;

			if( tshow == 0 )

			{

				tw = 0;

				th = 0;

			}

			

			var autoplay = options.autoplay;

			var music = options.music;

			var loop = options.loop;

			var ani_timeout = options.timeout;

			

			var imgdata1 = options.imgdata;

			//return;

			//Working Variables

			var myInterval = 0;

			var Li = jQuery('li', $this);

			

			//alert(Li.length)

			var cName = 'container-' + holder_name;

			var c = jQuery('<div class="container"></div>');

			

			holder.prepend(c);

			

			c.append('<div class="ssovit-controls"></div>');

			c.append('<div class="ssovit-info-wrapper"></div>');

			c.append('<div class="ssovit-image-title"></div>');

			var cn = jQuery('.ssovit-controls', c);

			var iT = jQuery('.ssovit-image-title', c);

			var iB = $(".info", element);///jQuery('#info-' + holder_name);

			var iW = jQuery('.ssovit-info-wrapper', c);

			var bH = th + 10;

			var bM = 25;

			bH = th + 10 + bM;

			if (music) {}

			cn.wrap(jQuery('<div></div>').css({

				width: w,

				height: bH,

				position: 'absolute',

				bottom: 0,

				left: 0,

				overflow: 'hidden',

				//20dec by vc background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8zMS8xMMky0QkAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAATklEQVRYhe3OQQ3AMAwAsWz82ZTgOOxxVSQbgZ+ZObPMezvwh3RFuiJdka5IV6Qr0hXpinRFuiJdka5IV6Qr0hXpinRFuiJdka5IV1amP/V6AQ1qQuZ6AAAAAElFTkSuQmCC)',

				//v3 background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8zMS8xMMky0QkAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAATklEQVRYhe3OQQ3AMAwAsWz82ZTgOOxxVSQbgZ+ZObPMezvwh3RFuiJdka5IV6Qr0hXpinRFuiJdka5IV6Qr0hXpinRFuiJdka5IV1amP/V6AQ1qQuZ6AAAAAElFTkSuQmCC)',

				zIndex: 30

			})).css({

				width: w,

				height: th + 10,

				position: 'relative',

				marginTop: bM,

				bottom: 0,

				left: 0,

				overflow: 'hidden',

				zIndex: 30

			});

			iT;

			cn.append('<div class="strip"></div>');

			cn.append('<a class="ssovit-nav-left" title="Previous Slide"><span style="font-size: 19px; font-weight:bold; color: ' + button_colors["color"] + ';">-</span></a>');

			cn.append('<a class="ssovit-image-target" style="display:none"></a>');

			cn.append('<a class="ssovit-nav-right" title="Next Slide"><span style="font-size: 19px; font-weight:bold; color: ' + button_colors["color"] + ';">+</span></a>');

			cn.append('<a class="ssovit-nav-play" title="Play/Pause"></a>');

			cn.parent().append('<div class="ssovit-info-links"></div>');

			var iLinks = jQuery('.ssovit-info-links', c);

			iLinks.css({

				position: 'absolute',

				top: 0,

				height: 25,

				left: 5,

				fontFamily: 'verdana',

				width:'auto'

		   });

			var strip = jQuery('.strip', c);

			var navLeft = jQuery('.ssovit-nav-left', c);

			var navRight = jQuery('.ssovit-nav-right', c);

			var playBtn = jQuery('.ssovit-nav-play', c);

			var stripwidth = Li.length * (tw + 4);

			c.css({

				width: w + 'px',

				height: h + 'px',

				margin: 0,//10,

				//v3 background: '#000',

				position: 'relative',

				overflow: 'hidden'

			});

			strip.wrap(jQuery('<div></div>').css({

				width: w - (tw * 3),

				height: th + 4,

				position: 'absolute',

				bottom: 3,

				left: tw,

				overflow: 'hidden',

				zIndex: 30

			}));

			var counter=0;
			
			//alert(iB.html())

			if(jQuery('.description', iB).html().length>0){

			iLinks.append(jQuery('<a class="ssovit-hover ssovit-popup" rel="'+counter+'">DESCRIPTION</a>').css({

				marginRight:10

			}));

//////////////////////

			iW.append(jQuery('.description', iB).clone().css({

				position: 'absolute',

				width: w - 10,

				background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8zMS8xMMky0QkAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAATklEQVRYhe3OQQ3AMAwAsWz82ZTgOOxxVSQbgZ+ZObPMezvwh3RFuiJdka5IV6Qr0hXpinRFuiJdka5IV6Qr0hXpinRFuiJdka5IV1amP/V6AQ1qQuZ6AAAAAElFTkSuQmCC)',

				height: 'auto',

				left: 0,

				padding: 5,

				bottom: bH,

				zIndex: 33

			}).addClass('ssovit-info').hide()); 

			counter++;

//return;

			}

			if(jQuery('.contact', iB).html().length>0){

			iLinks.append(jQuery('<a class="ssovit-hover ssovit-popup" rel="'+counter+'">CONTACT</a>').css({

				marginRight:10

			}));

			iW.append(jQuery('.contact', iB).clone().css({

				position: 'absolute',

				width: w - 10,

				background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8zMS8xMMky0QkAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAATklEQVRYhe3OQQ3AMAwAsWz82ZTgOOxxVSQbgZ+ZObPMezvwh3RFuiJdka5IV6Qr0hXpinRFuiJdka5IV6Qr0hXpinRFuiJdka5IV1amP/V6AQ1qQuZ6AAAAAElFTkSuQmCC)',

				height: 'auto',

				left: 0,

				padding: 5,

				bottom: bH,

				zIndex: 33

			}).addClass('ssovit-info').hide());

			counter++;

			}

//return

			if (map) {

				iLinks.append(jQuery('<a class="map ssovit-popup thickbox" title="Map" href="' + options.map + '&TB_iframe=1" target="_new">MAP</a>').css({

				marginRight:10

				}));

			}

			if(jQuery('.website_url', iB).attr('href').length>0){

//return

			iLinks.append(jQuery('<a class="website ssovit-popup" rel="Visit Website" href="' + jQuery('.website_url', iB).attr('href') + '" target="_new">WEBSITE</a>').css({

				marginRight:10

			}));

			}

			navLeft.css({

				position: 'absolute',

				left: 15,

				bottom: 5,

				width: tw,

				height: th,

				zIndex: 31,

				display: 'block',

				outline: 'none',

				cursor: 'pointer'

			});

			navRight.css({

				position: 'absolute',

				right: tw,

				bottom: 4,

				//left: '90%',

				width: tw,

				height: th,

				zIndex: 31,

				display: 'block',

				outline: 'none',

				cursor: 'pointer'

			});

			playBtn.css({

				position: 'absolute',

				right: 0,

				bottom: 5,

				width: tw,

				height: th,

				zIndex: 31,

				display: 'block',

				background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAKCAYAAAB8OZQwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAnEAAAJxABlGlRGQAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNS8xNi8xME31j+oAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAANElEQVQImX2OuREAIAzDdBx7slo2FQVVEkClfX5Qg4qHuInZMBMAs7QtldFGXvHvULvUzm8l5FAbk4vy8QAAAABJRU5ErkJggg==) center center no-repeat',

				outline: 'none',

				cursor: 'pointer'

			});

			var i = 0;

			jQuery('img', Li).each(function () {

				 var picurl=jQuery(this).parent().attr('href');

				strip.append(jQuery('<img rel="' + i + '" src="' + jQuery(this).attr('src') + '", id="'+jQuery(this).attr('id')+'" linkurl="'+picurl+'" width="600px" />').width(tw).height(th).css({

					border: '1px solid #000',

					margin: 1,

					cursor: 'pointer'

				}).attr('alt', jQuery(this).attr('alt')));

				i++;

			});

			//alert(strip.html())

			strip.css({

				width: stripwidth

			});

			//jQuery('>ul', holder).remove();

			iB.remove();

			var myinterval = 0;

			if (strip.width() > w - (tw * 3)) {

				strip.parent().mousemove(function (e) {

					var maxScroll = strip.width() - strip.parent().width();

					myinterval = clearInterval(myinterval);

					scrollvalue = (Number)(((Number)(e.pageX) - (Number)(jQuery(this).offset().left)) / (Number)(jQuery(this).width()) * 100);

					handleBioSliderChange(scrollvalue, maxScroll);

				});

			}

			strip.parent().mouseout(function (e) {

				myinterval = clearInterval(myinterval);

			});

//return

			function handleBioSliderChange(value, maxScroll) {

				var left = Math.round(value);

				if (left > 50) {

					left += (left / 100 * 5);

				} else {

					left -= (left / 100 * 5);

				}

				if (left > 98) {

					left = 100;

				}

				if (left < 2) {

					left = 0;

				}

				scrollIt((Number)(left / 100 * maxScroll));

			}

			function scrollIt(value) {

				strip.css({

					marginLeft: - value + 'px'

				});

			}

			var cI = 0;

			jQuery('img', strip).click(function () {

				var i = jQuery(this).attr('rel');

//alert(i)

				cI = i;

				anim(i);

				jQuery('img', strip).css({

					border: '1px solid #000'

				}).stop().css({

					opacity: .5

				});

				jQuery(this).css({

					border: '1px solid #DDD'

				}).stop().css({

					opacity: 1

				});

				myInterval = clearInterval(myInterval);

				startAnim();

			});

			jQuery('img', strip).hover(function () {

				

				jQuery('img', strip).css({

					border: '1px solid #000'

				}).stop().css({

					opacity: .5

				});

				jQuery(this).css({

					border: '1px solid #DDD'

				}).stop().css({

					opacity: 1

				});

				jQuery('img:eq(' + cI + ')', strip).css({

					border: '1px solid #DDD'

				}).stop().css({

					opacity: 1

				});

			}, function () {

				jQuery('img', strip).css({

					border: '1px solid #000'

				}).stop().css({

					opacity: .5

				});

				jQuery('img:eq(' + cI + ')', strip).css({

					border: '1px solid #DDD'

				}).stop().css({

					opacity: 1

				});

			});

			jQuery('img:first', strip).trigger('click');

///return

			function anim(i) {

				jQuery('.img2', c).addClass('img-out').removeClass('img2');

				jQuery('.img1', c).addClass('img2').removeClass('img1');

				c.prepend('<img class="img1" />');

				var imgsrc = jQuery('img:eq(' + i + ')', strip).attr('src');

				var targeturl=jQuery('img:eq('+i+')', strip).attr('linkurl');				

				jQuery('.img1', c).attr('src', imgsrc).attr('linkurl',targeturl);

				

				var imgId2 = jQuery('img:eq(' + i + ')', strip).attr('id').split('_')[2];

				var tempLeft = 0;	

				var tempTop = 0;

				if ( typeof imgId2 != 'undefined' ) {

					if( typeof imgdata1[imgId2].image_width != 'undefined' && imgdata1[imgId2].image_width != '' )

					{

						var thW = imgdata1[imgId2].image_width;

						if( thW < w ) {

							var midW = w/2;							

							tempLeft = midW - ( thW / 2 );

						}

					}

					

					if( typeof imgdata1[imgId2].image_height != 'undefined' && imgdata1[imgId2].image_height != '' )

					{

						var thH = imgdata1[imgId2].image_height;

						if( thH < h ) {

							var midH = h/2;

							tempTop = midH - ( thH / 2 );

						}

					}

				}

				

///return;

				

				jQuery('.img1', c).hide();

				if(jQuery('.img1', c).attr('linkurl')!="")

					{	

					jQuery('.img1', c).css({

					position: 'absolute',

					left: tempLeft,

					top: tempTop,

					zIndex: 29,

					margin: 0,

					padding: 0,

					border: 0,

					cursor:'pointer'

				   }).click(function(){			
						var urltarget=jQuery(this).attr('linkurl');					
						if(urltarget.length>0){
							window.location=urltarget;
							jQuery('.ssovit-image-target', cn).attr('href',urltarget).trigger('click');
						}										 
					});

					

					}

				else

				{

					jQuery('.img1', c).css({

					position: 'absolute',

					left: tempLeft,

					top: tempTop,

					zIndex: 29,

					margin: 0,

					padding: 0,

					border: 0

					})

				}

				c.children('.image_label').remove();

				jQuery('.img1', c).fadeIn(ani_timeout * 0.2);

				jQuery('.img2', c).stop().fadeOut(ani_timeout * 0.2);

				jQuery('.img-out', c).remove();

				

				var imgId = jQuery('img:eq(' + i + ')', strip).attr('id').split('_')[2];

				

				if ( typeof imgId != 'undefined' ) {

					var imgTilte = '';

					var imgDescription = '';

					if( typeof imgdata1[imgId].image_title != 'undefined' )

					{

						

						if( typeof imgdata1[imgId].image_description != 'undefined' && imgdata1[imgId].image_description!='')

						{

							imgTilte = ( imgdata1[imgId].image_title != '' ) ? imgdata1[imgId].image_title + ': ' : '';

						}

						else

						{

							imgTilte = ( imgdata1[imgId].image_title != '' ) ? imgdata1[imgId].image_title : '';

						}

						//imgTilte = ( imgdata1[imgId].image_title != '' ) ? imgdata1[imgId].image_title + ': ' : '';

						var titleFont = typeof imgdata1[imgId].image_title_font != 'undefined' ? imgdata1[imgId].image_title_font : 'verdana';

						var titleFontSize = typeof imgdata1[imgId].image_title_fontsize != 'undefined' ? imgdata1[imgId].image_title_fontsize : '16';

						var titleFontColor = typeof imgdata1[imgId].image_title_color != 'undefined' ? imgdata1[imgId].image_title_color : '#FFF';

					}

					

					if( typeof imgdata1[imgId].image_description != 'undefined' )

					{

						imgDescription = imgdata1[imgId].image_description;

						var descriptionFont = typeof imgdata1[imgId].image_description_font != 'undefined' ? imgdata1[imgId].image_description_font : 'verdana';

						var descriptionFontSize = typeof imgdata1[imgId].image_description_fontsize != 'undefined' ? imgdata1[imgId].image_description_fontsize : '16';

						var descriptionFontColor = typeof imgdata1[imgId].image_description_color != 'undefined' ? imgdata1[imgId].image_description_color : '#FFF';

					}

					if( imgDescription != '' || imgTilte != '' )

					{

						if(topbar==true)

						{

						var labelDiv = jQuery('<div>').addClass('image_label').css({

							width: w-10,

							height: 'auto',

							position: 'absolute',

							top: 0,

							left: 0,

							padding:5, 

							background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8zMS8xMMky0QkAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAATklEQVRYhe3OQQ3AMAwAsWz82ZTgOOxxVSQbgZ+ZObPMezvwh3RFuiJdka5IV6Qr0hXpinRFuiJdka5IV6Qr0hXpinRFuiJdka5IV1amP/V6AQ1qQuZ6AAAAAElFTkSuQmCC)',

							zIndex: 35

						});

						}

						else

						{

							var labelDiv = jQuery('<div>').addClass('image_label').css({

							width: w-10,

							height: 'auto',

							position: 'absolute',

							top: 0,

							left: 0,

							padding:5, 

							zIndex: 35

						});

						}

						

					  var titleSpan = jQuery('<span>').css({color:'#'+titleFontColor,fontFamily:titleFont,fontSize:titleFontSize + 'px'}).text(imgTilte);

					  var descriptionSpan = jQuery('<span>').css({color:'#'+descriptionFontColor,fontFamily:descriptionFont,fontSize:descriptionFontSize + 'px'}).text(imgDescription);				

					labelDiv.append(titleSpan);

					labelDiv.append(descriptionSpan);

					c.append(labelDiv);

					

				 }

			  }

			}

			

			navLeft.bind('click', function () {

				cI--;

				if (cI < 0) {

					cI = Li.length - 1;

				}

				jQuery('img:eq(' + cI + ')', strip).trigger('click');

			});

			navRight.bind('click', function () {

				cI++;

				if (cI > Li.length - 1) {

					cI = 0;

				}

				jQuery('img:eq(' + cI + ')', strip).trigger('click');

			});

			function startAnim() {

				if (autoplay) {

					myInterval = setInterval(function () {

						cI++;

						if (cI > Li.length - 1) {

							cI = 0;

							if (!loop) {

								autoplay = false;

								cI = Li.length - 1;

							}

						}

						jQuery('img:eq(' + cI + ')', strip).trigger('click');

					}, ani_timeout);

					playBtn.css({

						background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAALCAYAAACzkJeoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAnEAAAJxABlGlRGQAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNS8xNi8xME31j+oAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAAPUlEQVQYlWP8//+/AgMDQwIDA8MDRkbGBch8hv///zv8h4ADDAwMKHwmBjxgGEmyMDAwPGBgYGiE0gzIfAAS+iPhOCHWfwAAAABJRU5ErkJggg==) center center no-repeat'

					});

				} else {

					myInterval = clearInterval(myInterval);

					playBtn.css({

						background: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAKCAYAAAB8OZQwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAnEAAAJxABlGlRGQAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNS8xNi8xME31j+oAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAANElEQVQImX2OuREAIAzDdBx7slo2FQVVEkClfX5Qg4qHuInZMBMAs7QtldFGXvHvULvUzm8l5FAbk4vy8QAAAABJRU5ErkJggg==) center center no-repeat'

					});

				}

			}

			navLeft.css({

				opacity: .5

			});

			navRight.css({

				opacity: .5

			});

			playBtn.css({

				opacity: .5

			});

			navLeft.hover(function () {

				jQuery(this).css({

					opacity: 1

				});

			}, function () {

				jQuery(this).stop().css({

					opacity: .5

				});

			});

			navRight.hover(function () {

				jQuery(this).stop().css({

					opacity: 1

				});

			}, function () {

				jQuery(this).stop().css({

					opacity: .5

				});

			});

			playBtn.hover(function () {

				jQuery(this).stop().css({

					opacity: 1

				});

			}, function () {

				jQuery(this).stop().css({

					opacity: .5

				});

			});

			playBtn.click(function () {

				if (autoplay) {

					autoplay = false;

					startAnim();

				} else {

					autoplay = true;

					startAnim();

				}

			});
			
			jQuery('.img1', c).live('click',function(){

			 var urltarget=jQuery(this).attr('linkurl');

			if(urltarget.length>0){

				window.location=urltarget;

				jQuery('.ssovit-image-target', cn).attr('href',urltarget).trigger('click');

			}

													 

			});

			var controlHideInterval = 0;

			

			if( tshow == 1 )

			{

				setInterval(function () {

					controlHideInterval = clearInterval(controlHideInterval);

					cn.parent().show();

				}, 0);

			}

			else

			{

				c.mouseover(function () {

					controlHideInterval = clearInterval(controlHideInterval);

					cn.parent().show();

				});

				c.mouseout(function () {

					controlHideInterval = setInterval(function () {

						cn.parent().hide();

						iW.children('.ssovit-info').hide();

						controlHideInterval = clearInterval(controlHideInterval);

					}, 500);

				});

			}

			///return;

			jQuery('.ssovit-hover', c).hover(function () {

				jQuery('.ssovit-info', iW).hide();

				jQuery('.ssovit-info:eq(' + jQuery(this).attr('rel') + ')', iW).stop().show();

			}, function () {

				//jQuery('.ssovit-info:eq(' + jQuery(this).attr('rel') + ')', iW).stop().hide();

				//Do Nothing

			});

			cn.parent().hide();

			// music
			if(options.music){
				var player = jQuery('<div class="slider-player"></div>');
				var player_button = $('<a class="slider-music-control" play="1" class="ssovit-music-control" rel=""></a>');
				player_button
				.css({position:'absolute',right:0,top:0,color:'#FFF',width:'auto',height:20,zIndex:32,fontSize:8,fontFamily:'verdana',cursor:'pointer', padding:'0 4px'})
				.text('MUSIC OFF');
				
				c.append(player);

				jQuery('.ssovit-controls', c)
					.parent()
					.append(player_button);					

				player.jPlayer({
					ready: function (){
						this.element.jPlayer("setFile", options.music).jPlayer("play");
					},
					customCssIds: true,
					swfPath: options.swfUrl
				}).jPlayer("onSoundComplete", function() {
					this.element.jPlayer("play"); // Auto-Repeat
				});	
				player_button.click(function(){
					var $this = $(this);											 	
					$status = $this.attr('play');
					if ($status == 1) {
						$id = $this.attr('rel');
						player.jPlayer("pause");
						$this.text('MUSIC ON');
						$this.attr('play', '0')
					} else {
						$id = $this.attr('rel');						
						player.jPlayer("play");
						$this.text('MUSIC OFF');
						$this.attr('play', '1')
					}
				});
			}

		});

	

	};

})(jQuery);
