var url = window.location.href;
var nohttp = url.split('//')[1];
var hostPort = nohttp.split('/')[0];
var fullPath = 'http://'+hostPort+'/home/';

// Set parameter for Slide VDO for V1
$("#mynewsdis").ready(function(){
var newsoption = {
firstname: "vdo_news", //firstname: has to be the id of the div containing the news
secondname: "showhere", //secondname: is the id of container where you like news to display
fourthname:"vdo_button" , //fourthname :   is the id of container where images file inside(prev.pause.next) 
newsspeed:'5000', //newsspeed : auto play pause time (1000=1sec default is 6sec)
isauto:'0', //isauto : 1:for autoplay (default is 1)
imagedir: fullPath+'main/images/icon/', //imagedir: images  path of (prev.gif ,next.gif,pause.gif ....),default is blank
disablenewscount:false //disablenewscount:  true for disable news counter(Deault is false)
}
$.init_plus(newsoption);
});

/*---------- Caption Vdo ---------------------------*/
var floattext=new Array()
var floatiewidth="263px" //default width of floatie in px
var floatieheight="63px" //default height of floatie in px. Set to "" to let floatie content dictate height.
var floatiebgcolor="#000" //default bgcolor of floatie
var fadespeed=0 //speed of fade (5 or above). Smaller=faster.

var baseopacity=0
function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",fadespeed)
}

function instantset(degree){
cleartimer()
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+1, 0.7)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=70
else if (window.highlighting)
clearInterval(highlighting)
}

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function paramexists(what){
return(typeof what!="undefined" && what!="")
}

function showfloatie(thetext, e, optbgColor, optWidth, optHeight){
var dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft;
var dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop;
var floatobj=document.getElementById("vdoCaption")
floatobj.style.left="0"
floatobj.style.display="block"
floatobj.style.backgroundColor=paramexists(optbgColor)? optbgColor : floatiebgcolor
floatobj.style.width=paramexists(optWidth)? optWidth+"px" : floatiewidth
floatobj.style.height=paramexists(optHeight)? optHeight+"px" : floatieheight!=""? floatieheight : ""
floatobj.innerHTML=thetext
var floatWidth=floatobj.offsetWidth>0? floatobj.offsetWidth : floatobj.style.width
var floatHeight=floatobj.offsetHeight>0? floatobj.offsetHeight : floatobj.style.width
var winWidth=document.all&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winHeight=document.all&&!window.opera? ietruebody().clientHeight : window.innerHeight
e=window.event? window.event : e
floatobj.style.left=15+"px"//dsocx+winWidth-floatWidth-5+"px"
if (e.clientX>winWidth-floatWidth && e.clientY+20>winHeight-floatHeight)
floatobj.style.top=110+"px"//dsocy+5+"px"
else
floatobj.style.top=110+"px"//dsocy+winHeight-floatHeight-5+"px"
slowhigh(floatobj)
}

function hidefloatie(){
var floatobj=document.getElementById("vdoCaption")
floatobj.style.display="none"
}

/*---------- Slide for KT TV -----------------------*/
if(jQuery){(function(A){A.fn.slider=function(B){var C=arguments.callee.support;new C(this[0].id,B);return this};
			      A.fn.slider.support=function(C,B){this.init(C,B)};
				  A.fn.slider.support.prototype=function(){
					  return{
 // Change Button						  
						  init:function(D,B){this.options=A.extend({
/*									duration:250,prev_img_src:"main/images/background/box-panal-L-on.png",
									prev_disabled_img_src:"main/images/background/box-panal-L-off.png",
									next_img_src:"main/images/background/box-panal-R-on.png",
									next_disabled_img_src:"/main/images/background/box-panal-R-off.png"*/},
						  B||{});
						  this.slider_id=D;
						  this.slider_sel="#"+D;
						  this._resize_timer=null;
						  var C=this;
						  A(window).unload(function(){return C.onUnload()});
						  A(window).resize(function(){return C.onResize()});
						  A(document).ready(function(){return C.onReady()})},
						  onReady:function(){this.items=A(this.slider_sel+" .item");
						  this.item_idx=0;
						  var B=this;
						  A(this.slider_sel+" .controls .prev").click(function(C){return B.onClickPrev(C)});
						  A(this.slider_sel+" .controls .next").click(function(C){return B.onClickNext(C)});
						  this.onResize()},
						  	onUnload:function(){delete this.items},
						  	onResize:function(){var B=this;
						if(this._resize_timer){clearTimeout(this._resize_timer)}
						this._resize_timer=window.setTimeout(function(){
							B._doResize()},50)},
							_doResize:function(){
								var C=A(this.slider_sel);
								var B=C.select(".viewport")[0];
								A(this.slider_sel+" .addon").width(B.offsetWidth-0);//******* set for position all
								this.revealSelectedItem(15)},
								onClickPrev:function(B){if((this.item_idx-1)<0){return false}this.item_idx--;
								return this.changeSelectedItem()},
								onClickNext:function(B){if((this.item_idx+1)>=this.items.length){return false}this.item_idx++;
								return this.changeSelectedItem()},changeSelectedItem:function(){this.updateItemNumber();
								this.updateButtonStates();
								this.revealSelectedItem();
								return false
						},
						updateItemNumber:function(){
							A(this.slider_sel+" .controls .index").text(this.item_idx+1)},
							updateButtonStates:function(){var B=A(this.slider_sel+" .controls .prev img")[0];
							if(this.item_idx==0){
								B.src=this.options.prev_disabled_img_src
							}else{
								B.src=this.options.prev_img_src
							}
							var C=A(this.slider_sel+" .controls .next img")[0];
							if(this.item_idx==this.items.length-1){
								C.src=this.options.next_disabled_img_src
							}else{
								C.src=this.options.next_img_src
							}
						},
						revealSelectedItem:function(B){
							if(!B){B=this.options.slide_duration}A(this.slider_sel+" .viewport").animate({scrollLeft:this.items[this.item_idx].offsetLeft},B)},
								EOF:null}}()})(jQuery)
};
