$(document).ready(function() {

	//Call News effect function
	$("#home_news_content").newsTicker();

	//Call Mobile Phones Slidershow Function
	$( "#slidershow" ).accessNews({
		speed : "normal",
		slideBy : 6
	});
	$( "#slidershow_wide" ).accessNews({
		speed : "normal",
		slideBy : 7
	});
	$( "#slidershow_quick" ).accessNews({
		speed : "normal",
		slideBy : 7
	});

	//Call Tabs effect function
	$("#rotate > ul").tabs({fx:{opacity:'toggle'}});

	//Call Promotion effect function
	$('#home_billboard_content').cycle({fx:'scrollLeft',pager:'#home_billboard_control'});
	$("#accordion").accordion();

	// Accordion
	jQuery('#serviceContent').accordion({autoheight:false});
	$("#faq_list").accordion({header:"dt",autoheight:false});
	
	$("form.forms").jqTransform();

	$("a[rel]").overlay();

	// Top Panel
	$("div.panel_button").click(function(){
		$("div#panel").animate({height: "200px"}).animate({height: "180px"}, "fast");
		$("div.panel_button").toggle();
	});	
  $("div#hide_button").click(function(){
		$("div#panel").animate({height: "0px"}, "fast");
	});
	
	$('#mobile_phone_show').serialScroll({
		target:'#mobile_phone_images',
		items:'li',
		axis:'xy',
		navigation:'#mobile_phone_colors li a',
		duration:400,
		force:true,
		onBefore:function( e, elem, $pane, $items, pos ){e.preventDefault();if( this.blur )this.blur();},
		onAfter:function( elem ){}
	});

	$('.repair_center_old li').each(function () {
		var distance = 10;
		var time = 250;
		var hideDelay = 500;
		var hideDelayTimer = null;
		var beingShown = false;
		var shown = false;
		var trigger = $('.trigger', this);
		var info = $('.popup', this).css('opacity', 0);
		$([trigger.get(0), info.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				// don't trigger the animation again
				return;
			} else {
				// reset position of info box
				beingShown = true;
				info.css({
					bottom: -50,
					left: -40,
					display: 'block'
				}).animate({
					top: '-=' + distance + 'px',
					opacity: 1
				}, time, 'swing', function() {
					beingShown = false;
					shown = true;
				});
			}
			return false;
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				info.animate({
					top: '-=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					shown = false;
					info.css('display', 'none');
				});
			}, hideDelay);
			return false;
		});
	});

	//call Fancybox effect function
	$("a.color_one").fancybox({
		'zoomOpacity' : true,
		'overlayShow' : false,
		'zoomSpeedIn' : 500,
		'zoomSpeedOut' : 500
	});
	$("a.color_two").fancybox({
		'zoomOpacity' : true,
		'overlayShow' : false,
		'zoomSpeedIn' : 500,
		'zoomSpeedOut' : 500
	});
	$("a.color_three").fancybox({
		'zoomOpacity' : true,
		'overlayShow' : false,
		'zoomSpeedIn' : 500,
		'zoomSpeedOut' : 500
	});
	$("a.color_four").fancybox({
		'zoomOpacity' : true,
		'overlayShow' : false,
		'zoomSpeedIn' : 500,
		'zoomSpeedOut' : 500
	});
	
	//call Mobile Phons Color Change effect function
	$('.mobile_phone_show').each(function() {
		var wrapper = this.id;
		$('.mobile_phone_colors', this).localScroll( {
			target: $('.content', this), 
			duration: 1500,
			hash: false,
			axis: 'xy',
			queue: true,
			onBefore: function(e, anchor, $target, $wrapper){ 
				$('.scrolling').removeClass('scrolling');
				$(this).addClass('scrolling');
				this.blur();
			}
		} );
		$('li.sub p, li.sub li', this).localScroll( {
			target: $('.content', this),
			axis: 'xy',
			queue: true,
			hash: false,
			duration: 1500
		} );
	} );
	
	$(document).pngFix();

} )

// Function of Search Textbox
function clearInput(textbox, initial) {
	if (textbox.value == initial) { textbox.value = ""; }
}
function checkInput(textbox, initial) {
	if (textbox.value == '') { textbox.value = initial; }
}
function checkSearchForm(defaultText){
	if(document.getElementById("SearchText").value==defaultText || document.getElementById("SearchText").value=="Please enter search text"){
		document.getElementById("SearchText").value="Please enter search text";
		document.getElementById("SearchText").style.color="red";
		document.getElementById("SearchText").style.background="yellow";
		setTimeout("document.getElementById('SearchText').style.color='';document.getElementById('SearchText').style.background='#FFF';document.getElementById('SearchText').value='"+defaultText+"'",2000);
	}else{
		document.getElementById("keywordsearch").submit();
	}
}

function jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function usermanual(restore){
  eval("parent.location='"+document.getElementById("ummenu").options[document.getElementById("ummenu").selectedIndex].value+"'");
  if (restore) getElementById("ummenu").selectedIndex=0;
}

function changelocation() {
	var myform=document.getElementById("location_form");
	var mylocation=document.getElementById("locations").value;
	myform.action=mylocation;
}