/* 
 * SemiCommon engine
 * @purpose:
 * this basic libary is reponsible for initialzing and SEMS communication and default error service handler
 * @module Id (CRM_M01,EDT_M01,  etc )
 * @url ajax url ( action url)
 * @post object [{param1:value1},.... ]
 * @returnType: html(default), XML, JSON
 * @data : post param:value
 * @tp : third party flag <default>false : todo
 *
 * *** Dependency*****
 * @jquery-1.4.2.min.js
 * @semi.common.ui.js
 * @semi.error.js
 * 
 *
 */
document.domain ="samsung.com";
/*forum plug in*/
var auth="sdf";
var SEMI_PREFIX='SEMI_';
var SEMI_ERROR='SEMI_ERROR_';
var ERROR='ERROR_';
var debugMode =true;
var modules =[];
var videoPlayer=[];
(function($) {

$.fn.SemiCommon = function(options)
{
  //plugin Def.
  var defaults = {
    url: '',  //Ajax posting url
    data: {},  //Ajax posting data
    init:false, //true: return UI in html if false: other data communication
    moduleId:'', //module id
    moduleOptions:{},//module meta data
    dataType:'html', //return data type
    success:$.fn.SemiCommon.onSuccess, //on success
    error:$.fn.SemiCommon.onError, // on error
    complete:$.fn.SemiCommon.onComplete, // on complete
    target:'' // target container
  };

  //Id semi module and post required value to backend

 /************************************************
  * Find SEMI_ target
  ***********************************************/
  $("[id^='"+SEMI_PREFIX+"']").each(function(){
    //get target by class attribute
	
	
	
    if($(this).find('.module_set').attr('id')!='SEMI_MSG' && $(this).attr('id')!='SEMI_STATUS')
    {
      console.log($(this).attr('id'));
      var semi_target = $(this);
      //set Module
      //see function setModule( target , Obj )
      var moduleid = $(this).find('.module_set').attr('id');
      //modules.push(moduleid);
      modules[modules.length] = moduleid;
      setModule(semi_target,$(this));
    }
        
  });

 /************************************************
  * add detect SEMI_ERROR_
  ***********************************************/
  
			
	

 /************************************************
  * Extend Options
  ***********************************************/

  var opts = $.extend({},defaults, options);
}

/************************************************
* Private function callSems( option ) ajax
***********************************************/

  function callSems(o)
  {
   // $.fn.SemiCommon.debug("calling ajax " + o.url + " return type" + o.dataType);
   if(o!=null)
   {
   	$.ajax({
            url: o.url,
            global: o.global,
            type: o.type,
            data: o.data,
            dataType: o.dataType,
            success: function(data){
             o.success(data);
			      $.fn.SemiCommon.onSuccess(data)
            },
            error: function(e){
              o.error(e);
            },
            complete:function(complete){
             o.complete(complete);
            }
         });
   }
  }

/***************************************************************
*
* Private setModule init( ModuleID:String, Object:DOM object )
* <div id="SEMI_PRO_M11" class="PRO_M11" >
*  <div id="SEMI_MSG" style="display:none;">DEFAULT</div>
*  <div id="productId"  style="display:none;">CN23045</div>  
*  <div id="SEMI_STATUS" style="display:none;">0</div>
* </div>
*
******************************************************************/

function setModule(moduleID,object)
{
  var semiStatus =$(object).find('#SEMI_STATUS').text();
  var isDefault =$(object).find('#SEMI_MSG').text();
  var cross=false;
  if(semiStatus == 0 && isDefault=='DEFAULT')
  {
    $.fn.SemiCommon.defaultAction(moduleID,object);
   // alert('defualt')
  }else
  {
   // alert('NOTdefualt')
    switch(moduleID)
    {
      //example case:
      case 'CRM_M01':
        //create jquery plug in
        object.SWaitable();
        //get module specific options
        var options = object.SWaitable.getOptions(0);
        //set status
        semiStatus = $.fn.SWaitable.status;
      break;

      // continue add your module case

        case 'APP_M01':
        object.ModAPPM01();
        options = object.ModAPPM01.getOptions(0);
        //semiStatus = $.fn.ModAPPM01.status;
        break;

        case 'EDT_M10':
        object.ModEDTM10();
        options = object.ModEDTM10.getOptions(0);
        semiStatus = $.fn.ModEDTM10.status;
        break;

        case 'BV_QUESTION':
         // alert('BV_QUESTION')
          object.SEMIModBv();
          options = object.SEMIModBv.getOptions(0);
          semiStatus = $.fn.SEMIModBv.status;
          cross=true;
        break;
      default:
        break;
    }
    //callSems(options);
    //alert( 'tag'+ moduleID)
    $('#'+$(object).attr('id') +' a').live('click',function(event){
    //event.preventDefault();

        var instanceStr = String($(object).attr('id')).split('_');
        var instanceID =instanceStr[instanceStr.length-1];
        var omnThisText = $(this).text();
        var moduleID = 	$(object).find('.module_set').attr('id') + "_"+instanceID;
        var targetSection = ($(this).attr('title').length>0)?$(this).attr('title'):omnThisText;
        var thisHref = $(this).attr('href'); 
        	var str = thisHref.split('/');
		var modelCd = "";
		if(str.length == 6){
			modelCd = str[4] + '/' + str[5] ;
		}else{
			modelCd = str[str.length-1];
		}
		
		modelCd = modelCd.replace("-buy","");
		var category = str[3];
		category = category.replace("-accessories","");
        if (omnThisText.indexOf("See All") != -1) {
    		var h3value = $(this).prev().text();
    		var link_loc = h3value + ' ' + 'module';
    		ss_link_click_track_2('','event18','','',link_loc,'o','see all');
    	}
		else if (omnThisText.indexOf("Shop") != -1 && thisHref.indexOf("cell-phones-accessories") != -1) {
    		ss_link_click_track_2('','event38','','','module ' + moduleID,'o','shop');
    	}
    	else if (omnThisText.indexOf("Shop") != -1) {
    	
    		ss_link_click_track_2('','event20',category+';'+modelCd,'',moduleID,'o','shop');
    	}
    	else if(omnThisText.indexOf("Learn More") != -1){
    		ss_link_click_track_2('','event54',category+';'+modelCd,'',moduleID,'o','learn more');
    	}
    	else if (omnThisText.indexOf("Vote") != -1) {
			var pollTitle = $('#poll .title h3').text();
    		ss_link_click_track_2('eVar33','event45','',pollTitle,moduleID,'o','vote');
    	}
    	else if (omnThisText.indexOf("Quick View") != -1) {
    		ss_link_click_track_2('','event79','','',moduleID,'o','quickview');
    	}
	else if (omnThisText.indexOf("Register this Product") != -1) {
    		ss_link_click_track_2('', 'event47', '', '', moduleID, 'o', 'register product');
    	}
    	else {
    		callTrack(s.pageName,moduleID,omnThisText);
    	}
        
        console.log(s.pageName+ " "+moduleID + omnThisText +" " +targetSection);
    });
  }
}

//var quickviewIsAccessory = false;

//omniture tag Quickview shop, close, and learn more
$(document).ready(function(){

		$('.quick-view-content a').each(function (index) {
		//	if ($(this).attr('href').indexOf('accessories') != -1) {
			//	quickviewIsAccessory = true;
			//}	
			if ($(this).text().indexOf("Learn More") != -1) {
				if ($(this).attr('href').indexOf('accessories') != -1) {
					$(this).click(function() {
						ss_link_click_track_2('','event54','','','accessory quickview','o','learn more');
					});
				}
				else {
					$(this).click(function() {
						ss_link_click_track_2('','event54','','','product quickview','o','learn more');
					});
				}
			}
			else if ($(this).text().indexOf("Shop") != -1) {
				if ($(this).attr('href').indexOf("cell-phones-accessories") != -1) {
					$(this).click(function() {
						ss_link_click_track_2('','event38','','','cellphone accessory quickview','o','shop');
					});
				}
				else if ($(this).attr('href').indexOf('accessories') != -1){
					$(this).click(function() {
						ss_link_click_track_2('','event20','','','accessory quickview','o','shop');
					});
				}
				else {
					$(this).click(function() {
						ss_link_click_track_2('','event20','','','product quickview','o','shop');
					});
				}
			}
		});	
		
		$('.quick-view-close').each(function (index) {
			if ($(this).next().find('a').eq(0).attr('href').indexOf('accessories') != -1) {
				$(this).click(function() {
					ss_link_click_track_2('','','','','accessory quickview','o','quickview close');
				});
			}
			else {
				$(this).click(function() {
					ss_link_click_track_2('','','','','product quickview','o','quickview close');
				});
			}
		});	
		
				
});

function callTrack(pagename, moduleID, linkName)
{
     var ssLink= ss_link_click_track('prop15,prop16,prop17,eVar9,eVar10,eVar11','','',linkName+',' + s.pageName + '>'+linkName+',' + s.pageName + '>'+moduleID+'>'+linkName+','+linkName+',' + s.pageName + '>'+linkName+',' + s.pageName + '>'+moduleID+'>'+linkName,'o',linkName);
}

/***************************************************************
* ==============================================================
*
* Do not edit below:
*
* ==============================================================
****************************************************************/
/***************************************************************
* public get semiCommon.default
****************************************************************/
$.fn.SemiCommon.defaults = {
  url: '',
  global:false,
  data: {},
  dataType:'html',
  success:$.fn.SemiCommon.onSuccess,
  error:$.fn.SemiCommon.onError,
  complete:$.fn.SemiCommon.onComplete
};

/***************************************************************
* public callSems(option) : when you need to access
* this from outside of semi.common
****************************************************************/
$.fn.SemiCommon.call=function(options)
{
  callSems(options);
};

/***************************************************************
* public default on Success function
****************************************************************/

$.fn.SemiCommon.onSuccess= function(data)
{ 
 $("#output").html(data);
 
 $("[id^='"+SEMI_ERROR+"']").each(function(){	
	//Set new options
	//Pass module id to plugin
	var mymodID = modules[0];	
	//Here you can customize error message
	var errorMessage = "NO LONGER AVAILABLE";
	var errorOptions = {modID: mymodID,message: errorMessage};
	//Call SemiError and pass new options
	//If no new options are needed just call SemiERROR() and default message will be displayed
	$(this).find("div").SemiERROR(errorOptions);
 });
};

/***************************************************************
* public default on Error function
****************************************************************/

$.fn.SemiCommon.defaultAction= function(id, target)
{
	var defaultOption = {modID: id,  target:target };
	//Call SemiError and pass new options
	//If no defaultOption are needed just call SemiERROR() and default message will be displayed
	$(target).SemiERROR(defaultOption);
  if(debugMode==true)
  {
    $(target).css({'border-color':'green'})
  }
}

/***************************************************************
* public default on Error function
****************************************************************/
$.fn.SemiCommon.onError= function()
{
  return "Error"
};
/***************************************************************
* public default on complete function
****************************************************************/
$.fn.SemiCommon.onComplete = function()
{
  return "Complete";
};
/***************************************************************
* public default on complete function
****************************************************************/
$.fn.SemiCommon.debug = function(debugStr)
{
  return (debugMode==true)?alert("debug" +debugStr):false;
};
})(jQuery);


/***************************************************************
* DOM READY
****************************************************************/
$(function() {
  $.fn.SemiCommon();
  /*if($('#EDT_M04')!=null)
  {
   var opt = { target :"SEMI_EDT_M04_appContainer", object:"SEMI_EDT_M04_appContainer"};
             $("a.SEMI_EDT_M04_SEMI_CLICKABLE").clickable(opt);
  }
  if($('#EDT_M37'))
  {
   var opt2 = { target :"SEMI_EDT_M37_appContainer", object:"SEMI_EDT_M37_appContainer"};
             $("a.SEMI_EDT_M37_SEMI_CLICKABLE").clickable(opt2);
  }*/

  if ($('#CRM_M01').length != 0 || $('[id^="CRM_B2B"]').length != 0 || $('[id^="CRM_O02"]').length !=0) 
  //if($('#CRM_M01') || $('#CRM_M02'))
  {
	 
     var CRM_STATUS =readCookie('CRM_THANK_YOU');
     if(CRM_STATUS ==1 )//CRM_M01
     {
       setTimeout("openpopCRM_M01()",1000);
     }else if(CRM_STATUS ==2)
     {        
    	var targetCRMDIV = readCookie('CRM_SUMITTARGET');
        setTimeout(function(){openpopCRM_B2B(targetCRMDIV);},500);
        console.log('target div id'+targetCRMDIV)
     }
  }
  
  if ($('#RAT_M05').length != 0 || $('#RAT_M06').length != 0) {
	  //RAT_M05

	 		$('div[id^=RAT_M0] span[class^=star]').each(function() {
	 			if ($(this).hasClass('starsOverall')){
	 				var starSize = 22;
	 			//	alert('big star');
	 			}else{
	 				var starSize = 15.5;
	 			//	alert('small star');
	 			}
	 			
	 			$(this).stars(starSize);
	 			
	 		} );
	   }
  
  
  if ($('#APP_M02').length != 0){
  //if ($('#APP_M02') != null) { 
	
	if ($('.weeks_picks').length > 0) {
  		$('.picks_list .list_detail').append('<div class="indicator"><span>&#160;</span></div>');
  		/*if ($('#picksListInfo_1 .pic li').length > 1) {
  			$('#picksListInfo_1 .gallery').append('<div class="indexing"></div>');
  			$('#picksListInfo_1 .gallery .indexing').append('<a class="arrow_left"></a>');
  			$('#picksListInfo_1 .gallery .indexing').append('<a class="arrow_right"></a>');
  			$('#picksListInfo_1 .pic li').each(function(){
  				$('#picksListInfo_1 .indexing').prepend('<span></span>');
  			});
  			$('#picksListInfo_1 .indexing').find('span').eq(0).addClass('on');
  		}*/
  		function sumSlide(layerID){
  			$(layerID + " .gallery").jCarouselLite({
  				btnNext: layerID + ' .indexing .arrow_right',
  				btnPrev: layerID + ' .indexing .arrow_left',
  				scroll: 1,
  				visible: 1,
  				circular: false,
  				afterEnd: function(){
  					if ($(this).css('left') == '0px') {
  						$(layerID + " .indexing span").removeClass('on');
  						$(layerID + " .indexing span").eq(0).addClass('on');
  					}
  					if ($(this).css('left') == '-149px') {
  						$(layerID + " .indexing span").removeClass('on');
  						$(layerID + " .indexing span").eq(1).addClass('on');
  					}
  					if ($(this).css('left') == '-298px') {
  						$(layerID + " .indexing span").removeClass('on');
  						$(layerID + " .indexing span").eq(2).addClass('on');
  					}
  					if ($(this).css('left') == '-447px') {
  						$(layerID + " .indexing span").removeClass('on');
  						$(layerID + " .indexing span").eq(3).addClass('on');
  					}
  				}
  			});
  		}
  		sumSlide('#picksListInfo_1');
		
  		$('.item_list a').mouseover(function(){
  			var layerID = $(this).attr('href');
  			$('.list_detail').hide();
  			$(layerID).show();
  			$('.item_list li').removeClass('on');
  			$(this).parent().addClass('on');
  			if ($(layerID + ' .pic li').length > 1) {
  				if ($(layerID + ' .gallery .indexing').length > 0) {
  					return;
  				}
  				else {
  					$(layerID + ' .gallery').append('<div class="indexing"></div>');
  					$(layerID + ' .indexing').append('<a class="arrow_left"></a>');
  					$(layerID + ' .indexing').append('<a class="arrow_right"></a>');
  					$(layerID + ' .pic li').each(function(){
  						$(layerID + ' .indexing').prepend('<span></span>');
  					});
  					$(layerID + ' .indexing').find('span').eq(0).addClass('on');
  				}
  			}
  			
  			
  			sumSlide(layerID);
  			
  		})
  		$('.item_list a').click(function(){
  			this.blur();
  			return false
  		});
  	}
  	
  	if ($('.acc_filter').length > 0) {
  		$('.acc_filter li').prepend('<img src="/us/images/common/blank.gif" alt="" class="blank" />');
  	}
  }
          
 /*All Questions*/
  
  if($('#RAT_M03').length>0)
  {
	 $(this).find('.set_title').find('.search').find('form').find('.link_btn_st1').click(function(e){
		 e.preventDefault();
		 var searchTerms = $('#RAT_M03').find('.set_title').find('.search').find('form').find('.input').find('input').val();
		 var curr = $(this).attr('href')+'&search='+searchTerms;
		 window.location =curr;
		 
	 });
	 
  }
  
  
  if($('#BV_AllQUESTION_CONTAINER').length >0)
  {
	  var parentDoc =$('#BV_AllQUESTION_CONTAINER').attr('src');
		 var hst = parentDoc.substring(0,(parentDoc).indexOf('/sems/'));
		 
	     var frameUrl = (parentDoc).substring((parentDoc).indexOf('?')+1,(parentDoc).length) ;
		 var params =frameUrl.split('&');
		 
		 var modelname =(params[0]).substring((params[0]).indexOf('=')+1,(params[0]).length );
		 var profileID =(params[1]!=null)?(params[1]).substring((params[1]).indexOf('=')+1,(params[1]).length ):'';
		 var search =(params[2]!=null)?(params[2]).substring((params[2]).indexOf('=')+1,(params[2]).length ):'';

		 for (var i=0; i<params.length; i++)
		 {
			switch((params[i]).substring(0,(params[i]).indexOf('=')))
			{
			case "modelname":
				modelname = (params[i]).substring((params[i]).indexOf('=')+1,(params[i]).length );
			break;

			case "userid":
				profileID = (params[i]).substring((params[i]).indexOf('=')+1,(params[i]).length );
			break;

			case "search":
				search = (params[i]).substring((params[i]).indexOf('=')+1,(params[i]).length );
			break;

			default:
				break;
			}
		 }
		 $('#BV_AllQUESTION_CONTAINER').css('display','none');
		 $('#BV_AllQUESTION_CONTAINER').attr('src', hst+'/sems/BvXmlService.action?instanceId=90011&moduleId=10060&modelCode='+modelname+'&xslFile=/us/data/RAT_M03_all.xsl').load(function(){
		    var BVSEMS_QAContent =$('#BV_AllQUESTION_CONTAINER').contents().find('html body').html();
		   $('#content').html(BVSEMS_QAContent);
			
		 });
		
		
			

		
   }

 });

function searchBV(obj)
{
	 var parentDoc =String(window.location);
	 
	 var hst = parentDoc.substring(0,(parentDoc).indexOf('/sems/'));
	 var search = $('input[name="search_for"]').val();
	 var modelname = $('input[name="modelCode"]').val();
     
     window.location= hst+'/sems/BvXmlService.action?instanceId=90011&moduleId=10060&modelCode='+modelname+'&xslFile=/us/data/RAT_M03_all.xsl&search='+search;
    
}

function bvAnswerThis(url)
{
	var parentDoc =String(window.parent.location);
	var hst = parentDoc.substring(0,(parentDoc).indexOf('/u/'));
	
	window.parent.location = hst+url;
}

function load_iframe(target) {
	site = document.getElementById(target).value;
	document.getElementById("frame").src = site;

}

function iframe_loaded() {
	//src = document.getElementById("BVSRC").src;
	src = $('#BV_AllQUESTION_CONTAINER').attr('src');
	
	if (src == "")
		console.log('iframeInit');
	else
		{
		var myIFrame = document.getElementById('BV_AllQUESTION_CONTAINER');
		var content = myIFrame.contentWindow.document.body.innerHTML;

		$('#container').html(content);
		$('#BVSRC').css('display','none');
		}
}
/*
function onload(){
	var myIFrame = document.getElementById('BV_AllQUESTION_CONTAINER');
	var content = myIFrame.contentWindow.document.body.innerHTML;

	$('#container').html(content);
	$('#BVSRC').css('display','none');
};*/
 /*************************************************************
  * Module specific
  * Common functions
  *0
  **************************************************************/
 /********************
  *GotoSpec - PRO_M11
  */
 function modulegotoSpec()
 {
   var curr = location.href;

   if(curr.indexOf('#')>-1)
      curr = curr.substring(0,curr.indexOf('#') );
   if(curr.indexOf('-features')==-1)
   {
     if(curr.indexOf('?')>-1)
     {
       curr = curr.substring(0,curr.indexOf('?') )
     }
     curr += "-features";
   }
      
   $("#PRO_M11_GOTO_FEATURES a").attr('href',curr);
 }

 function gotoFeature()
 {
  var curr = location.href;
   if(curr.indexOf('#')>-1)
      curr = curr.substring(0,curr.indexOf('#') );
   if(curr.indexOf('-features')==-1)
   {
     if(curr.indexOf('?')>-1)
     {
       curr = curr.substring(0,curr.indexOf('?') )
        
     }
     curr += "-features";
   }
   
   $("#PRO_FEATURES a").attr('href',curr);
   
    window.location =curr;
 }
 
 function gotoReviews()
 {
   var curr = location.href;
   if(curr.indexOf('#')>-1)
      curr = curr.substring(0,curr.indexOf('#') );
   if(curr.indexOf('-reviews')==-1)
   {
     if(curr.indexOf('?')>-1)
     {
       curr = curr.substring(0,curr.indexOf('?') )
        
     }
   }
     curr += "-reviews";
   $('#RAT_M05 a.arr_link').attr('href',curr);
 }
 
 function gotoReviewSubmit()
 {
	 var curr = location.href;
	   if(curr.indexOf('#')>-1)
	      curr = curr.substring(0,curr.indexOf('#') );
	   if(curr.indexOf('-reviews')==-1)
	   {
	     if(curr.indexOf('?')>-1)
	     {
	       curr = curr.substring(0,curr.indexOf('?') )
	        
	     }
	   }
	     curr += "-reviews?bvaction=writereview";
	   $('#RAT_M05 a.link_btn_st1').attr('href',curr);
 }
/********************
 * Dropdown form
 */
 function makeDropBox()
 {
   	$('div.dropdown').hover(function() {

		$(this).children('dl').addClass('on');
		var lilength = $(this).find('li').length;
		if (lilength > 8) {
			$(this).find('ul').addClass('scroll');
		}
		$(this).css('position','relative');
		$('div.dropdown label').hover(function() {
			$(this).css('text-decoration','underline');
		}, function() {
			$(this).css('text-decoration','none');
		});
		$('div.dropdown label').click(function() {
			var labelText = $(this).text();
			var dtText = $(this).parent().parent().parent().parent().parent().children('dt');
			dtText.text(labelText);
			$(this).parent().parent().parent().parent().parent().removeClass('on');
		});
	}, function() {
		$(this).children('dl').removeClass('on');
		var lilength = $(this).find('li').length;
		if (lilength > 8) {
			$(this).find('ul').removeClass('scroll');
		}
		$(this).css('position','static');
	});
 }

/********************
 * CRM_M01 open popup
 */
function openpopCRM_M01()
{
  var options =
  {
    type:"popup",
    target:"CRM_O01",
    mode:'id'

  }
  $.fn.SemiCommonUI(options);
  if(readCookie('CRM_THANK_YOU')=='1')
  {
      $('#layer_title').toggle();
      $('#CRM_TEXT').toggle();
      $('#CRM-B2C').toggle();
      $('#CRM_CONFIRM').toggle('slow');
      $.cookie('CRM_THANK_YOU', null);

  }else
  {
  var returnAddress = location.href ;
  $(":hidden[name=redirectURL]").val(returnAddress);
  $.validator.setDefaults({
        submitHandler: function() {
          document.forms['CRM-B2C'].submit(); 
          //$('#layer_title').toggle();
          //$('#CRM_TEXT').toggle();
         // $('#CRM-B2C').toggle();
          //$('#CRM_CONFIRM').toggle('slow');
          writeSemiCookie('CRM_THANK_YOU', '1');

        }
      });
     $('#CRM_submit').click(function(){$('#CRM-B2C').submit()});

     $('#CRM-B2C').validate({
      rules: {
        first_name: "required",
        last_name: "required",
        zip: {
				required: true,
				minlength: 5,
				number: true
        },
        email: {
				required: true,
				email: true
        }
      },
      messages: {
        first_name: "Please enter your first name",
        last_name: "Please enter your last name",
        email: "Please enter a valid email address",
        zip: {
          required: "Please enter your zipcode",
          minlength: "Zip code should be at least 5 numbers long"
        }
      }
    });
  }
}
/********************
 * CRM_M02, CRM_M03 open popup
 */
function openpopCRM_B2B(divId)
{
  setTimeout(function(){openPopupCRM_B2BDelay(divId)},500);
  console.log('open popup '+divId);
}

function openPopupCRM_B2BDelay(divId)
{
  makeDropBox();
  console.log('cookie '+readCookie('CRM_SUMITTARGET'));
  console.log('cookie '+readCookie('CRM_FORM_TARGET'));
  console.log('CRM_THANK_YOU '+readCookie('CRM_THANK_YOU'));
  var options =
  {
    type:"popup",
    target:divId,
    mode:'id'
  }
  $.fn.SemiCommonUI(options);
  
   if(readCookie('CRM_THANK_YOU')==2)
  {
	   if(readCookie('CRM_SUMITTARGET')!='CRM_O02_Newsletter')
		   $('#CRM_O02_Newsletter').css('display','none');
	   
	   if(readCookie('CRM_SUMITTARGET')!='CRM_B2B_GBN')
		   $('#CRM_B2B_GBN').css('display','none');
	   
	   console.log('CRM_THANK_YOU '+readCookie('CRM_THANK_YOU'));
	  $.cookie('CRM_THANK_YOU', null);
	  $('#'+divId).find('.layer_contents').find('#layer_title').toggle();
	  $('#'+divId).find('.layer_contents').find('#CRM_TEXT').toggle();
	  $('#'+divId).find('.layer_contents').find('form').toggle();
	  $('#'+divId).find('.layer_contents').find('#CRM_CONFIRM').toggle();
      //$('#'+divId+' #layer_title').toggle();
      //$('#'+divId+' #CRM_TEXT').toggle();
      //$('#'+divId+' #'+readCookie('CRM_FORM_TARGET')).toggle();
      //$('#'+divId+' #CRM_CONFIRM').toggle('slow');
      

  }else
  {
  var returnAddress = location.href ;
  $(":hidden[name=retURL]").val(returnAddress);
   var targetFormId = $('#'+divId).find('form').attr('id');
   console.log('targetFormId '+targetFormId);
      $.validator.setDefaults({
        submitHandler: function() {
    	  document.forms[targetFormId].submit(); 
    	  console.log('submit form '+targetFormId);
    	  writeSemiCookie('CRM_SUMITTARGET', divId );
    	  writeSemiCookie('CRM_FORM_TARGET', targetFormId );
       
          writeSemiCookie('CRM_THANK_YOU', '2');
        }
      });
            
      $('#'+divId).find('form').find('.button').find('#CRM_submit').click(function(e){
    	 $('#'+divId).find('form').submit();
         console.log($('#'+divId).find('form').attr('id')); 
     });
     $('#'+divId).find('form').validate({
      rules: {
        first_name: "required",
        last_name: "required",
        country:"required",
        zip: {
				required: true,
				number: true,
				minlength: 5
				
        },
        email: {
				required: true,
				email: true
        },
        phone:"required"
      },
      messages: {
        first_name: "Please enter your first name",
        last_name: "Please enter your last name",
        email: "Please enter a valid email address",
        country:"Please enter a valid country",
        zip: {
          required: "Please enter your zipcode",
          minlength: "Zip code should be at least 5 numbers long",
          number:"Please enter valid zipcode"
        }
      }
    });
  }
}


/******
 *
 * set debugging console.log only works in FF this will disable debug in IE
 */
var debugging = true; // or false
if (typeof console == "undefined") var console = { log: function() {} };
else if (!debugging || typeof console.log == "undefined") console.log = function() {};

/**
 * Set Global SAMSUNG Namespace and attach video player object
 */

var player;

var vidObj = {};
	vidObj.t_T = 0;
	vidObj.c_T = 0;
	vidObj.a = 'NULL';
	vidObj.n = '';

//begin code for omniture tagging video player

//player is ready. call listeners
var m04Player;

function playerReady(obj) {
	if(obj.id.indexOf("EDTM04") != -1) m04Player = obj.id;
	if(obj.id.indexOf("EDTM03") != -1 && m04Player.length > 0) obj.id = m04Player;
	player = document.getElementById(obj.id);
	addListeners(obj);
}

function addListeners(obj){
	player.addModelListener("TIME", "timeListener");
	player.addModelListener("TIME", "currentTimeListener");
	player.addModelListener("STATE", "stateListener");

}

function removeListeners(obj){
	player.removeModelListener("TIME", "timeListener");
	player.removeModelListener("TIME", "currentTimeListener");
	player.removeModelListener("STATE", "stateListener");
}

//time listener - duration
function timeListener(obj) {
	vidObj.t_T = obj.duration;
}

var startFlag = true;

//time listener - current time
function currentTimeListener(obj) {
	vidObj.c_T = obj.position;
	var a = vidObj.a;
	var c_T = vidObj.c_T;
	var t_T = vidObj.t_T;
	var n = vidObj.n;
	var urlValue = String(window.location.href);
	var urlValueSplit = urlValue.split('/');
	var c = urlValueSplit[5];
	if(obj.position  > 3 && startFlag) { 
	    ss_trackVideo(a,n,c_T,t_T,c);	    
	    if (typeof(Badgeville) != 'undefined') {
       	 	giveBadgevilleCredit('watchvideo');
		}		
	    startFlag = false;
	}
}


//listen for the player state - playing, paused, buffereing, complete, idle
function stateListener(obj) {
	vidObj.a = obj.newstate;
	var a = vidObj.a;
	var c_T = vidObj.c_T;
	var t_T = vidObj.t_T;
	var n = vidObj.n;
	var urlValue = String(window.location.href);
	var urlValueSplit = urlValue.split('/');
	var c = urlValueSplit[5];
	if(obj.newstate == 'COMPLETED') { 
	    ss_trackVideo(a,n,c_T,t_T,c);
	
	} else if (obj.newstate == 'PAUSED') {
	    ss_trackVideo(a,n,c_T,t_T,c);
	
	} else if (obj.oldstate == 'PAUSED' && obj.newstate == 'PLAYING') {
	    ss_trackVideo(a,n,c_T,t_T,c);
	
	}
}
var pattern=/http:/;
if (typeof(SEMS) == 'undefined') SEMS = {};
if (typeof(SEMS.setVideoPlayer) == 'undefined') {
	
	SEMS.setVideoPlayer = function(moduleID){
		var module = moduleID;
		var noCopy = true;
		var isReady = false;
		var isBuilt = false;
		var defaultTitle = 'Samsung: Videoplayer > ';
		var swfVersionStr = "10.0.0";
		var xiSwfUrlStr = "playerProductInstall.swf";
		var flashvars = {};
		var params = {};
		var attributes = {};
		var currentFLV = '';
		var currentvideoObj={};
		//var player;	
		return {
			showModuleID: function(){
				console.log('Module ID = '+module+ ' VidObjID = '+attributes.name+ ' Current flv = '+currentFLV);
			},
			
			buildPlayer: function(videoOjbID, swfFile, flvPath, image_path, title,width, height,align){
				params.quality = "high";
				params.bgcolor = "#ffffff";
				params.allowscriptaccess = "sameDomain";
				params.allowfullscreen = "true";
				params.wmode = "transparent";
				var randomNumber = Math.floor(Math.random()*1001);
				attributes.align = align;
				
				if(module=='EDT_M04'||module=='EDT_M03'){
									 
					if (pattern.test(flvPath) == false ){
							flvPath = "http://www.youtube.com/watch?v="+flvPath;
						}
					/*Shanth added new skin*/
					console.log('EDT Modules');
					attributes.id = videoOjbID+randomNumber;
					attributes.name = videoOjbID+randomNumber;
					
					flashvars.file=flvPath;
					flashvars.image=image_path;
					flashvars.skin="/us/samsung_videoplayer/samsung/samsung.xml";
					flashvars.controlbar="over";
                    flashvars.controlbar.idlehide="true";
                    vidObj.n = flvPath;
					/*End*/
				}else{
					attributes.id = videoOjbID;
					attributes.name = videoOjbID;
					flashvars.video_id=flvPath;
					flashvars.preview_url =image_path;
				}
				flashvars.useExternalInterface = "true";
				currentFLV = flvPath;
				currentvideoObj.index =1;
				currentvideoObj.flv =flvPath;
				currentvideoObj.preview=image_path;
				currentvideoObj.videoID = videoOjbID;
				callback= function(){
					if(module=='EDT_M04' || module=='EDT_M37')
					{
						$('#'+module+' .title').text($('#'+module+' #title_copy' + currentvideoObj.index).text());
						$('#'+module+' .sumlist').find('#videoList'+currentvideoObj.index).hide();
					}
					if(module=='UGC_M02')
						videoPlayer.push([videoOjbID]);
					
					if(module=='UGC_M06')
						videoPlayer.push([videoOjbID]);
					
					if(module=='UGC_M07')
						videoPlayer.push([videoOjbID]);
					};
				swfobject.embedSWF(swfFile,title, width, height, swfVersionStr, xiSwfUrlStr, flashvars, params, attributes,callback);
				isReady = true;
				isBuilt = true;
				
				if($('#'+module+'_selectedtitle').length>0)
					currentvideoObj.title=$('#'+module+'_selectedtitle').text();
				
				if($('#'+module+'_selectedtext').length>0)
					currentvideoObj.text =$('#'+module+'_selectedtext').text();
				
				if($('#'+module+'_selectedprehead').length>0)
					currentvideoObj.prehead=$('#'+module+'_selectedprehead').text();
				
				if($('#'+module+'_selectedthumbnail').length>0)
					currentvideoObj.thumbnail=$('#'+module+'_selectedthumbnail').text();
					
				if($('#'+module+'_selectedthumbnailalt').length>0)
					currentvideoObj.thumbnailAlt=$('#'+module+'_selectedthumbnailalt').text();
				
				if($('#'+module+'_selectedvideolength').length>0)
					currentvideoObj.videolength=$('#'+module+'_selectedvideolength').text();
				
				
			},
			setVideoPlayerSource: function(videoOjbID, flvPath, imagePath, copyid){
				
				if (isReady){
					console.log('Switching video to videoID '+videoOjbID+' and path '+flvPath);
					if (imagePath.length > 0 || imagePath != '') 
					{
						if(module=='EDT_M04'||module=='EDT_M03'){
							console.log('In the EDT Modules setting the video source');
							flashvars.file=flvPath;
							flashvars.image=imagePath;
							this.setVideoPlayerSourceImg(flvPath,imagePath, copyid);
						}else{
							flashvars.video_id = flvPath;
							flashvars.preview_url = imagePath;
							this.setVideoPlayerPreview(videoOjbID, imagePath);
							this.setVideoPlayerData(videoOjbID, flvPath);
						}
						
						currentFLV = flvPath;
												
							$('#'+module+'_selectedflv').text(currentvideoObj.flv);
							$('#'+module+'_selectedpreview').text(currentvideoObj.preview);
						
						currentvideoObj.flv =flvPath;
						currentvideoObj.preview = imagePath;
					}
					
					if (noCopy) {
						console.log('In the copy section');
						console.log($('#'+module+' #title_copy' + copyid).text() + currentvideoObj.title);
						$('#'+module+' .title').text($('#'+module+' #title_copy' + copyid).text());
						$('#'+module+' #detailbody').text($('#'+module+' #thumb_copy' + copyid).text());
						$('#'+module+' #prehead').html('<strong>' + $('#'+module+' #prehead_copy' + copyid).text() + '</strong>');
						
						$('#'+module+'_selectedtitle').text(currentvideoObj.title);
						$('#'+module+'_selectedtext').text(currentvideoObj.text);
						$('#'+module+'_selectedprehead').text(currentvideoObj.prehead);
						$('#'+module+'_selectedthumbnail').text(currentvideoObj.thumbnail);
						$('#'+module+'_selectedthumbnailalt').text(currentvideoObj.thumbnailAlt);
						$('#'+module+'_selectedvideolength').text(currentvideoObj.videolength);		
						
						currentvideoObj.title =$('#'+module+' #title_copy' + copyid).text();
						currentvideoObj.text =$('#'+module+' #thumb_copy' + copyid).text();
						currentvideoObj.prehead = $('#'+module+' #prehead_copy' + copyid).text();
						currentvideoObj.thumbnail = $('#'+module+' #videoID' + copyid).find('img').attr('src');
						currentvideoObj.thumbnailAlt = $('#'+module+' #videoID' + copyid).find('img').attr('alt');
						currentvideoObj.videolength = $('#'+module+' #videoLength' + copyid).find('span').text();
						
						$('#'+module+' .sumlist').find('#videoList'+copyid).hide();
						$('#'+module+' .sumlist').find('#videoList'+currentvideoObj.index).show();
						currentvideoObj.index = copyid;
					}else
					{
						console.log('no copy')
					}
				}
			},
			
			setVideoPlayerData: function(videoOjbID, videosource){
				//console.log(document[videoOjbID]);
				console.log('Render!');
				this.thisMovie(videoOjbID).setVideoPlayerSource(videosource);
			},
			
			setUGCDelay:function(videoOjbID, flvPath, imagePath){
				setTimeout(function(){this.setPlayerNoCopy(videoOjbID, flvPath, imagePath)},500)
			},
			
			setPlayerNoCopy: function(videoOjbID, flvPath, imagePath){
				console.log('Switching NOCOPY video to '+videoOjbID+' and images is '+imagePath);

				noCopy = false;

				this.setVideoPlayerData(videoOjbID, flvPath);
				if (typeof(imagePath) != 'undefined')
				//if (imagePath.length > 0 || imagePath != '') 
					this.setVideoPlayerPreview(videoOjbID, imagePath)
				
			},
			
			setVideoPlayerPreview: function(videoOjbID, imagePath){
				this.thisMovie(videoOjbID).setVideoPlayerPreview(imagePath);
			},
			
			thisMovie: function(movieName){
				if (navigator.appName.indexOf("Microsoft") != -1) {
					//console.log(window[movieName]);
					return window[movieName];
				}
				else {//console.log(document[movieName]);
					return document[movieName];
				}
			},
		    setVideoPlayerSourceImg: function(flvPath, imagePath, copyid){
				
				if(pattern.test(flvPath)==false){
					flvPath="http://www.youtube.com/watch?v="+flvPath;
				}
				var list1 = new Array({ file:flvPath, image: imagePath });
					player.sendEvent('load', list1);
          }
			
		};
		
	};
	
}


/*********************************
 *
 * SEMI Cookie
 *
 *
 **********************************/
function readCookie(cookieName)
{
  var COOKIE_NAME = cookieName;
  return $.cookie(COOKIE_NAME);
}

function writeSemiCookie(cookieName, val)
{
  $.cookie(cookieName, val);
}



/* RAT_M03 */
function expandQnA(z) {
	// targetFrame =z;
	//$(z).parent().toggleClass('open');	
	$(z).toggleClass('open');
	//setTimeout(function(){resizeFrame(targetFrame)},100 );
	
}


/* Community QnA */

function expandCommunityQnA(z){
	 //targetFrame =z;	
	 $(z).parent().toggleClass('open');
}




function resizeFrame(z)
{

	var newHeight=$(z).parent().height()+$('#BV_AllQUESTION_CONTAINER', window.parent.document).height();	
	$('#BV_AllQUESTION_CONTAINER', window.parent.document).css('height',newHeight)
}

function resetQnA()
{
	$('#BV_AllQUESTION_CONTAINER', window.parent.document).css('height',400)
}

function openQnA() {
	 targetFrame =$('.question_list ul');
	$('.question_list ul').children().addClass('open');
	setTimeout(function(){resizeFrame(targetFrame)},200 );
}

function closeQnA() {
	$('.question_list ul').children().removeClass('open');
	setTimeout(function(){resetQnA()},100 );
}

function gotoAnswerthisQuestion(num)
{
	window.top.location.href = "/us/support/answerThisQuestion.do?qid="+num; 

}

/* ANA_M01 */

function yesterday(z) {
	var yesterday1 = $('#yesterday1').val();
	var yesterday2 = $('#yesterday2').val();
	var yesterday3 = $('#yesterday3').val();
	var yesterday4 = $('#yesterday4').val();
	var yesterday5 = $('#yesterday5').val();
	
	$('.prod_list ul li:eq(0) .views strong').text(yesterday1);
	$('.prod_list ul li:eq(1) .views strong').text(yesterday2);
	$('.prod_list ul li:eq(2) .views strong').text(yesterday3);
	$('.prod_list ul li:eq(3) .views strong').text(yesterday4);
	$('.prod_list ul li:eq(4) .views strong').text(yesterday5);
	
	$(z).parent().each(function(){
		($(this).find('a').removeClass('no_border sel'))
	})
	$(z).addClass('no_border sel');
}

function week(z) {
	var week1 = $('#week1').val();
	var week2 = $('#week2').val();
	var week3 = $('#week3').val();
	var week4 = $('#week4').val();
	var week5 = $('#week5').val();
	
	
	$('.prod_list ul li:eq(0) .views strong').text(week1);
	$('.prod_list ul li:eq(1) .views strong').text(week2);
	$('.prod_list ul li:eq(2) .views strong').text(week3);
	$('.prod_list ul li:eq(3) .views strong').text(week4);
	$('.prod_list ul li:eq(4) .views strong').text(week5);
	
	$(z).parent().each(function(){
		($(this).find('a').removeClass('no_border sel'))
	})
	$(z).addClass('no_border sel');
}

function month(z) {
	var month1 = $('#month1').val();
	var month2 = $('#month2').val();
	var month3 = $('#month3').val();
	var month4 = $('#month4').val();
	var month5 = $('#month5').val();
	
	$('.prod_list ul li:eq(0) .views strong').text(month1);
	$('.prod_list ul li:eq(1) .views strong').text(month2);
	$('.prod_list ul li:eq(2) .views strong').text(month3);
	$('.prod_list ul li:eq(3) .views strong').text(month4);
	$('.prod_list ul li:eq(4) .views strong').text(month5);	
	
	$(z).parent().each(function(){
		($(this).find('a').removeClass('no_border sel'))
	})
	$(z).addClass('no_border sel');
}


 function showDebugBV()
 {
   $('#debugBVLink').css('display','block')
 }
 
 /***************************************
 * 
 * Used for EDT_M17 
 * 
 * 
 ******************************************/
 function hover(){
 
 	$('#module_video').hover(function(){
 		$('#module_video .btn_play').css('display', 'block');
 	}, function(){
 		$('#module_video .btn_play').css('display', 'none');
 	});
 	
 }
/***************************************
 * 
 * Used in SUP_M05 to popup new window
 * 
 * 
 ******************************************/ 
function popOpen(uri,name,width,height,top,left,option) {
	window.open(uri,name,'width='+width+',height='+height+',top='+top+',left='+left+","+option+" , scrollbars=1");
}


/******************************************
 *   
 *   Used for video player SUP_M05, UGC_M02,UGC_M06,UGC_M07
 *   
 *********************************************/

function EDT_M17playVideoLayer(id)
{
	var options =
	  {
	    type:"popup",
	    target:id,
	    mode:'id'

	  }
	  $.fn.SemiCommonUI(options);
	$('.btn_close_layer').click(function(){$('.layer_wrap').hide();$('#semi_popup_layer').remove();return false;})
}

function playVideoLayer(videoNum, y) {
	
	SEMI_showLayerPopupBackground();
  //$('#wrap').before($('#EDT_O02.temp_video_layer_'+videoNum));
	$('.temp_video_layer_'+videoNum).show();
	display(y);
	return false;
}
function display(y){
	$('#visual1').hide();
	$('#visual2').hide();
	$('#visual3').hide();
	$('#visual4').hide();
	$('#visual5').hide();
	$('#visual6').hide();
	$('#visual7').hide();
	$('#visual8').hide();
	$(y).show();
}

//SEMI_UGC_playVideoLayer('#visualPlayer','visual','4', 'UGCM06MAIN','http://serve.castfire.com/video/392726/392726_2010-08-13-163926.flv','');
function SEMI_UGC_playVideoLayer(y,name,videoTextNum, videoid, flvpath, imagepath) {
	
	SEMI_showLayerPopupBackground();
	$('.temp_video_layer').show();
	
	if(typeof(videoTextNum)!= 'undefined'){
		$('#visualPlayer .video_info').html($('#videoText'+videoTextNum).html());
	}
	
	SEMI_UGC_display(name,y);
	$('#UGC_SEMS_O06').appendTo($('#wrap'));
	
	if(videoid!='undefined')
	 setTimeout(function(){setPlayerSource(videoid,flvpath,imagepath)},500)
	
	return false;
}
function setPlayerSource(videoid,flvpath,imagepath)
{
    var player ;
    switch(videoid)
    {
    case 'UGCM06MAIN':
    	player = UGCM06MainPlayer;
    	break;
    
    case 'UGCM02MAIN':
    	player = UGCM02MainPlayer;
    	break;
    case 'UGCM07MAIN':
    	player = UGCM07MainPlayer;
    	break;
    };
	console.log(videoid)
	player.setPlayerNoCopy(videoid,flvpath,imagepath)
}

function SEMI_UGC_display(name,y){
	$("div[id^="+name+"]").hide();
	$(y).show();
}

function SEMI_showLayerPopupBackground() {
  $('body').append('<div id="layer_transparency"></div>');
  $('#layer_transparency').show();	
		
  $('.btn_close_layer').click(function(){$('.layer_wrap').hide(); $('#layer_transparency').remove(); return false;});
  $('.btn_close_layer2').click(function(){ $('.layer_wrap').hide(); $('#layer_transparency').remove(); return false;});
  $('#close_layer').click(function(){$('.layer_wrap').hide(); $('#layer_transparency').remove(); return false;});
  $('#wrap').before($('.layer_wrap temp_video_layer_2'));
  $('#wrap').before($('.layer_wrap temp_video_layer_1'));

}
//setTimeout('activateUGC()',500);
function activateUGC()
{

/* about module - ID : UGC_M02 */
	if($('#UGC_M02 .list_wrap li').length>5){

		$('#UGC_M02 .list_wrap').before('<span class="prev disabled">move previous</span>');
		$('#UGC_M02 .list_wrap').after('<em class="next">move next</em>');
		$('#UGC_M02 .list_wrap').css('position','relative');
		$('#UGC_M02 .list_wrap ul').css({position:'absolute', top:'0px', left:'0px'});
		$("#UGC_M02 .list_wrap").jCarouselLite({
			btnNext: '#UGC_M02 .next',
			btnPrev: '#UGC_M02 .prev',
			scroll:1,
			visible: 5,
			circular: false,
			afterEnd: function() {
				var a1 = eval($('#UGC_M02 .list_wrap ul').css('left').split('px')[0]);
				var a2 = eval($('#UGC_M02 .list_wrap ul li').css('width').split('px')[0])+5;
			}
		});
	}

	/* about module - ID : UGC_M06 */
	if($('#UGC_M06 .list li').length>4){
		$('#UGC_M06 .list').before('<span class="arrow_up">move up</span>');
		$('#UGC_M06 .list').after('<em class="arrow_down disabled">move down</em>');
		var bottomValue1 = eval($('#UGC_M06 .list ul li').css('height').split('px')[0])+4;
		var bottomValue2 = $('#UGC_M06 .list ul li').length;
		$('#UGC_M06 .list ul').css('bottom','-'+bottomValue1*bottomValue2+'px');
		$("#UGC_M06 .list").jCarouselLite({
			btnNext: '#UGC_M06 .arrow_up',
			btnPrev: '#UGC_M06 .arrow_down',
			vertical: true,
			scroll:1,
			visible: 4,
			circular: false,
			beforeStart: function(){
				$('#UGC_M06 .list').stop();
			},
			afterEnd: function() {
				var a1 = eval($('#UGC_M06 .list ul').css('top').split('px')[0]);
				var a2 = eval($('#UGC_M06 .list ul li').css('height').split('px')[0])+4;
				var a3 = $('#UGC_M06 .list ul').css('bottom').split('px')[0];
				var a4 = eval(a3) + a2;
				$('#UGC_M06 .list').css('left','0px');
			}
		});
	}

	/* about module - ID : UGC_M07 */
	if($('#UGC_M07 .list_wrap li').length>5){
		$('#UGC_M07 .list_wrap').before('<span class="prev disabled">move previous</span>');
		$('#UGC_M07 .list_wrap').after('<em class="next">move next</em>');
		$('#UGC_M07 .list_wrap').css('position','relative');
		$('#UGC_M07 .list_wrap ul').css({position:'absolute', top:'0px', left:'0px'});
		$("#UGC_M07 .list_wrap").jCarouselLite({

			btnNext: '#UGC_M07 .next',
			btnPrev: '#UGC_M07 .prev',
			scroll:1,
			visible: 5,
			circular: false,
			afterEnd: function() {
				var a1 = eval($('#UGC_M07 .list_wrap ul').css('left').split('px')[0]);
				var a2 = eval($('#UGC_M07 .list_wrap ul li').css('width').split('px')[0])+5;
			}
		});
	}
	
}

/******************************************
 *   
 *   Used for video player UGC_M02,UGC_M06,UGC_M07
 *   
 *********************************************/
function UGC_M02playVideoLayer(id)
{
var options =
{
type:"popup",
target:id,
mode:'id'

}
$.fn.SemiCommonUI(options);
$('.btn_close_layer').click(function(){$('.layer_wrap').hide();$('#semi_popup_layer').remove();return false;})
}


 function UGCplayVideoLayer(videoNum, flvPath, imagePath ) {
	  SEMI_showLayerPopupBackground();
	  $('.temp_video_layer_'+videoNum).show();
	  
	  setPlayerNoCopy(flvPath, imagePath)
	  return false;
}

function openB2bChatSUPM10()
{ 
var lpRandomNumber = new Date().getTime();
//$(this).attr('target','chat49151746');
var gen = window.open('https://sales.liveperson.net/hc/49151746/?cmd=file&file=visitorWantsToChat&site=49151746&SESSIONVAR!skill=SamsungBusinessSupport&waitTime=0&referrer='+escape(document.location)+'','chat49151746','width=472,height=320');
//s_control_click('events,eVar9', 'event13', 'event13,live chat', 'o', 'support search');
//return false;
} 


//Dynamic Stars used in for RAT modules
$.fn.stars = function(starSize) {
	$(this).each(function() {
		var x = starSize;
		var val = $(this).html();
		val = Math.round(val * 4) / 4;
		val = val > 5 ? 5 : (val < 0 ? 0 : val);

		var size = starSize * val;
		var stars = $('<span class="star0" ><span class="star5" style="margin-top:0px;width: '+size+'px"></span></span>');
		
		$(this).replaceWith(stars);
		
	});
}



function semidefault(c){};




