// Integration Tab Menu
function integration_rollOverImg(elId, tagName,type) {
	var el = document.getElementById(elId).getElementsByTagName(tagName);							
	for (i=0; i<el.length; i++) {							
	  if (el[i].src.indexOf(".gif") > 0 && el[i].src.indexOf("_over.gif") < 0) {
			el[i].onmouseover = integration_changeOver;
			el[i].onmouseout = integration_changeOut;
		}
	}
}

function integration_rollOverTab(elId, tagName,type) {
	var old_onload = window.onload;
	
	if(typeof old_onload != 'function'){
		window.onload = function(){
			integration_rollOverImg(elId, tagName,type);
		};
	}else{
		window.onload = function(){
			old_onload();
			integration_rollOverImg(elId, tagName,type);
		};
	}
}

function integration_changeOver() {
	this.src=this.src.replace(".gif", "_over.gif");
}

function integration_changeOut() {
	this.src=this.src.replace("_over.gif", ".gif");
}

// end of Integration Tab Menu


// Integration Featured applications TrynPlayGames image rolling
function imgView(prdName, aElem) {
	var imbView = document.getElementById('imbView');
	imbView.src = prdName;
	
	var thumbnail_ul = document.getElementById('thumbnail_ul');
	var thumbnail_lis = thumbnail_ul.children;
	var thumbnail_lis_lentgh = thumbnail_lis.length;
	for (var i = 0; i < thumbnail_lis_lentgh; i++) {
		thumbnail_lis[i].className = null;		
		if (aElem.parentNode == thumbnail_lis[i]) {
			thumbnail_lis[i].className = 'onselect';
		}
	}
}
var thumbnail_index = 0;
function photoScrollMove(moveF, EA) {
	var thumbnail_ul = document.getElementById('thumbnail_ul');
	var thumbnail_lis = thumbnail_ul.children;
	var thumbnail_lis_lentgh = thumbnail_lis.length;
	if (moveF == 'P' && thumbnail_index > 0) {
		thumbnail_index--;
		photoScrollMoveDetail(thumbnail_lis, thumbnail_lis_lentgh, thumbnail_index, EA);
	} else if (moveF == 'N' && thumbnail_index < thumbnail_lis_lentgh - EA) {
		thumbnail_index++;
		photoScrollMoveDetail(thumbnail_lis, thumbnail_lis_lentgh, thumbnail_index, EA);
	}
	refreshThumnailButtons(EA);
}
function photoScrollMoveDetail(lis, length, index, EA) {
	for (var i = 0; i < length; i++) {
		lis[i].style.display = (i >= index && i < index + EA) ? 'block' : 'none';
	}
}
function refreshThumnailButtons(EA) {
	var thumbnail_ul = document.getElementById('thumbnail_ul');
	var thumbnail_lis = thumbnail_ul.children;
	var thumbnail_lis_lentgh = thumbnail_lis.length;
	
	var thumbnail_prev = document.getElementById('thumbnail_prev');
	var thumbnail_next = document.getElementById('thumbnail_next');
	
	if (thumbnail_lis_lentgh <= EA) {	
		if (thumbnail_prev) thumbnail_prev.style.display = 'none';
		if (thumbnail_next) thumbnail_next.style.display = 'none';
	} else {
		if (thumbnail_index == 0) {
			if (thumbnail_prev) {
				thumbnail_prev.src = thumbnail_prev.src.replace('_on.gif', '_dim.gif');
				thumbnail_prev.src = thumbnail_prev.src.replace('_off.gif', '_dim.gif');
				thumbnail_prev.alt = 'first';
				thumbnail_prev.style.cursor = null;
			}
		} else {
			if (thumbnail_prev) {
				thumbnail_prev.src = thumbnail_prev.src.replace('_dim.gif', '_off.gif');
				thumbnail_prev.alt = 'previous';
				thumbnail_prev.style.cursor = 'pointer';
			}
		}
		
		if (thumbnail_index == thumbnail_lis_lentgh - EA) {
			if (thumbnail_next) {
				thumbnail_next.src = thumbnail_next.src.replace('_on.gif', '_dim.gif');
				thumbnail_next.src = thumbnail_next.src.replace('_off.gif', '_dim.gif');
				thumbnail_next.alt = 'last';
				thumbnail_next.style.cursor = null;
			}
		} else {
			if (thumbnail_next) {
				thumbnail_next.src = thumbnail_next.src.replace('_dim.gif', '_off.gif');
				thumbnail_next.alt = 'next';
				thumbnail_next.style.cursor = 'pointer';
			}
		}
	}
}
// end of Integration Featured applications TrynPlayGames image rolling



// news events TV Ads dropdown menu 20110126
function viewlayerShow(){
	var selObj=$(".tvOptionWrapper");
	var listObj=$("#Option_layer");
	var optObj=$(".tvOptionWrapper-active");
	
	if(listObj.css("display")=="none"){
		selObj.css("display","none");
		listObj.css("display","block");
	}

	$(".tvOptionListBody>ul>li").each(function(index){
		$(this).click(function(){			
			$(".tvOptionListHeader").find("span>span>span").text($(this).find("span>span>span").text());
			optHide();
		});
	});


	var psAtDc=optObj.offset();
	var msPs=optObj.position();	
	var psAtDc=optObj.offset();
	var elLeft = psAtDc.left;
	var elTop = psAtDc.top;		
	var lyLeft = elLeft + optObj.width();
	var lyTop = elTop + optObj.height();
	
	$(document).mousemove(function(e){
		if(  e.pageX < elLeft || e.pageY < elTop ||  e.pageX > lyLeft ||e.pageY > lyTop ){
		setTimeout(function () { optHide() },500);
		}
	});
		
}


function optHide(){	
	$(".tvOptionWrapper").css("display","block");
	$("#Option_layer").css("display","none");
}




// Integration news events TV Ads player
function onEmbed(tvadsNo, countryNm) {
	
	document.frm.tvadsNo.value = tvadsNo;
	document.frm.action = urlRoot+"/news-events/selectGGrTvads.do";
	var countryCdNo;
	if(countryNm=="Europe"){
		countryCdNo = "1";
	}else if(countryNm=="USA"){
		countryCdNo = "2";
	}else if(countryNm=="Latin America"){
		countryCdNo = "3";		
	}else if(countryNm=="Asia"){
		countryCdNo = "4";
	}else if(countryNm=="China"){
		countryCdNo = "5";		
	}else if(countryNm=="Russia"){
		countryCdNo = "6";		
	}
	document.frm.countryNo.value = countryCdNo;
	document.frm.submit();
}

function tvAdsSiteCd() {
	var dataMap = new Object();
	var countryCdNo = document.getElementById("adsRegion").value;
	if(countryCdNo == "0"){
		return;
	}
	dataMap["countryCdNo"] = countryCdNo;
	countryTvads.getSelectCountryTvads(dataMap, callBackTvadsList);
}

function writeWPlay(url_root, width, height, name){
	var str = null;
	var type = null;
 
	if(navigator.userAgent.indexOf("MSIE") != -1) {
		type = 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"';       
	}
	else {      
		type = 'type="application/x-ms-wmp"';        
	}
	
	str = '<object id="wmp" '+type+' width="'+width+'" height="'+height+'">'
			+ '    <param name="url" value="'+url_root+'">'
			+ '    <param name="autostart" value="1">'
			+ '    <param name="transparentatstart" value="1">'
			+ '    <param name="animationatstart" value="1">'
			+ '    <param name="autoresize" value="0">'
			+ '    <param name="showcontrols" value="1">'
			+ '    <param name="showcaptioning" value="0">'
			+ '    <param name="showstatusbar" value="0">'
			+ '    <param name="autosize" value="0">'
			+ '    <param name="showdisplay" value="0">'
			+ '    <param name="displaysize" value="0">'
			+ '    <param name="wmode" value="transparent">'
			+ '    <param name="windowlessvideo" value="0">'
			+ '</object>';
	
	document.write(str);

	
	/*
	document.write("<embed src='"+url_root+"' width='"+width+"' height='"+height+"' \n"
	      +"vspace='0' hspace='0' border='0' type='video/x-ms-asf' filename='"+url_root+"' \n"
	      +"transparentatstart='1' autostart='1' animationatstart='1' autoresize='0' showcontrols='1' \n"
	      +"showcaptioning='0' showstatusbar='0' autosize='0' showdisplay='0' displaysize='0' windowlessVideo='true'>");
	*/
}
// Integration news events TV Ads player


// display change
function display_change(tn,n,t) {
	for (i=1; i<=t; i++) {
		if (i==n) document.getElementById(tn+i).style.display='block';
		else document.getElementById(tn+i).style.display='none';
	}
}
// end of display change


// Integration DC Samsple Image Larger view 2010. 10. 15
 //<![CDATA[



/* var limgt;

var large_numberIni = 1;

function largeviewNum(){
	var numberWrap = document.getElementById("largeviewNumber");
	var numberList = numberWrap.getElementsByTagName("li");
	for(var i=1;i<numberList.length;i++){
		large_numberIni = large_numberIni+1;
	}
}

function largeview(limg,lino) { 
	var listno;		
	var largeimg_width;
	var largeimg_height;

	
	var layer = document.getElementById('largeview');
	var inlayer = document.getElementById('inner'); 
	var largeimg = document.getElementById('large'); 	
	largeimg.src = limg; 

	listno = lino;
	//alert('lino =' + lino);
	layer.style.visibility = 'visible'; 
	//setTimeout(printlayer, 500); 
	var new_img = new Image();
	new_img.src = largeimg.src; 
	largeimg_width = new_img.width;
	largeimg_height = new_img.height;
	
		
	if(listno == 1){
		inlayer.style.marginTop = 20 + "px";
	} else if(listno == 2){
		inlayer.style.marginTop = 150 + "px";
	} else if(listno == large_numberIni){
		inlayer.style.marginTop = listno * 206 - 75 - largeimg.height + "px";
	} else {	
		inlayer.style.marginTop = (listno-1) * 206 + 50 - (largeimg.height/2) + "px";
	}

	inlayer.style.width = largeimg.width + 50 + "px"; 
	inlayer.style.visibility = 'visible';
	
} 

//max-width, max-height fot ie6
function maxSize(obj,w,h){	
    if(obj.readyState != "complete") return "auto";
    real_w=obj.offsetWidth;
    real_h=obj.offsetHeight;
    largeimg_width=obj.offsetWidth;
    largeimg_height=obj.offsetHeight;
    if(w>0 && largeimg_width>w){
        largeimg_width = w;
        largeimg_height = real_h * (largeimg_width/real_w);
    }
    if(h>0 && largeimg_height>h){
        largeimg_height = h;
        largeimg_width = real_w * (largeimg_height/real_h);
    }

    obj.style.width="0";
    obj.style.height="0";
    obj.style.width=largeimg_width+"px";
    obj.style.height=largeimg_height+"px";

}

function printlayer() { 
	var inlayer = document.getElementById('inner'); 
	var largeimg = document.getElementById('large'); 	
	//alert(largeimg.src); 
	if(listno == 1){
		inlayer.style.marginTop = 20 + "px";
	} else if(listno == 2){
		inlayer.style.marginTop = 150 + "px";
	} else if(listno == large_numberIni){
		inlayer.style.marginTop = listno * 206 - 75 - largeimg.height + "px";
	} else {	
		inlayer.style.marginTop = (listno-1) * 206 + 50 - (largeimg.height/2) + "px";
	}
	inlayer.style.width = largeimg.width + 50 + "px"; 
	inlayer.style.visibility = 'visible';
	
}
*/

var listno = ''; 

function largeview(limg, lino) {
	var layer = document.getElementById('largeview'); 
	var largeimg = document.getElementById('large'); 
	
	listno = lino; 
	largeimg.src = limg; 
	
		if (largeimg.addEventListener) { 
			largeimg.addEventListener("load", printlayer, false) 
		} else { 
			largeimg.attachEvent("onload", printlayer) 
		} 
	
	layer.style.visibility = 'visible'; 
	} 
	
function printlayer() { 
	
	var inlayer = document.getElementById('inner'); 
	var largeimg = document.getElementById('large'); 
	
	var largeimg_width = largeimg.width; 
	var largeimg_height = largeimg.height; 
	
	//alert(largeimg.src); 
		if (listno == 3) { 
			inlayer.style.marginTop = 550 - largeimg_height + "px"; 
		} 
		else if (listno > 3) { 
			inlayer.style.marginTop = (listno - 3) * 209 + 500 - largeimg_height + "px"; 
		} 
		else { 
			inlayer.style.marginTop = 20 + "px"; 
		} 
	inlayer.style.width = largeimg.width + 50 + "px"; 
	inlayer.style.visibility = 'visible'; 
	}


function largeviewclose(){
	var layer = document.getElementById('largeview');
	var inlayer = document.getElementById('inner'); 
	//layer.style.display = 'none';
	layer.style.visibility = 'hidden';
	inlayer.style.visibility = 'hidden';
	}	             
         
		
//]]>
// end of Integration DC Samsple Image Larger view 2010. 10. 15




// Integration news events Winner Popup 2010.11.09
	function popup_winner(url) {
		window.open(url, 'popName', 'width=500,height=500');
	};

/* Interation Featured Application Widgets Tab Menus */
function Widgets_ShowAndHide( num ) {
	if( num == '1' ) {
		document.getElementById("widgetTab1").style.display = "block"
		document.getElementById("widgetTab2").style.display = "none"
		var inhtml = "<li class='on'><span>What are Samsung Mobile Widgets?</span></li>";
		inhtml    += "<li class='none'><a href=\"#\" onclick=\"javascript:Widgets_ShowAndHide('2'); return false;\"><span>Tips for Developer for Samsung Mobile Widget</span></a></li>";
		document.getElementById("tabList").innerHTML = 	inhtml;
	} else {
		document.getElementById("widgetTab1").style.display = "none"
		document.getElementById("widgetTab2").style.display = "block"
		var inhtml = "<li class='none'><a href=\"#\" onclick=\"javascript:Widgets_ShowAndHide('1'); return false;\"><span>What are Samsung Mobile Widgets?</span></a></li>";
		inhtml    += "<li class='on'><span>Tips for Developer for Samsung Mobile Widget</span></li>";
		document.getElementById("tabList").innerHTML = 	inhtml;
	}
}

/* Add png24 */
// png24
function setPng24(obj) { 
 obj.width=obj.height=1; 
 obj.className=obj.className.replace(/\bpng24\b/i,''); 
 obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image'); "
 obj.src='/uk/scripts/p2control/blank.gif';
 return ''; 

}

