function loadframe(frameId){
	 try{
	  frame = $('#'+frameId);
	  frame.attr('height',window.frames[frameId].document.body.scrollHeight+40);
	}
	 catch(err){
	 }
}

$(document).ready(function() {
	   var modelOnUrl = false;
		setLocalePath(wep.locale)
		setModelPath(model_used);
		showPage();							 
									 });
var modelPath;
var localePath;
var modelQuery;


//Modified by becocchl.		

function setLocalePath(locale){	
	if (locale == 'fr_FR' || locale == 'fr_LU' || locale == 'fr_BE' || locale == 'fr_CH' || locale == 'fr_MC') {
		localePath = 'FR';
	}
	else if (locale == 'de_DE' || locale == 'de_LU' || locale == 'de_AT' || locale == 'de_CH') {
		localePath = 'DE';
	}
	else if (locale == 'it_IT') {
		localePath = 'IT';
	}
	else if (locale == 'nl_BE' || locale == 'nl_NL') {
		localePath = 'NL';
	}
	else if (locale == 'pl_PL') {
		localePath = 'PL';
	}
	else if (locale == 'ru_RU' && (model_used == 'SMP-N100'  || model_used == 'SMP-N200')) {
		localePath = 'RU';
	}	
	else if (locale == 'es_ES') {
		localePath = 'ES';
	}
				
	else {
		localePath = 'EN';
	}
}

function setModelPath(model){
	if (model == 'BDP-S560' || model == 'BDP-S760') {
		modelPath = "BDPSX60";	
		prodPath = "BRD";
		modelOnUrl =false;
	}
	else if (model == 'BDV-E370' || model == 'BDV-E870') {
		modelPath = "BDVEX70";	
		prodPath = "BRD";
		modelOnUrl =false;
	}
	else if (model =='BDP-S370') {
		modelPath = "BDPS370";
		prodPath = "BRD";
		modelOnUrl =false;
	}
	else if (model == 'BDP-S570'){
		modelPath = "BDPS570";
		prodPath = "BRD";
		modelOnUrl =false;
	}
	else if (model == 'SMP-N100'){
		modelPath = "SMPN100";
		prodPath = "BRD";
		modelOnUrl =false;
	}
	else if (model == 'SMP-N200'){
		modelPath = "SMPN200";
		prodPath = "BRD";
		modelOnUrl =false;
	}	
	else if (model == 'BDP-S280' || model == 'BDP-S380' || model == 'BDP-S383'  || model == 'BDP-S480'){
		modelPath = "BDP6G_usb";
		prodPath = "BRD";
		modelQuery="BDP6G";
		modelOnUrl =true;
	}
		else if (model == 'BDP-S580' || model == 'BDP-S780'){
		modelPath = "BDP6G_built";
		prodPath = "BRD";
		modelQuery="BDP6G";
		modelOnUrl =true;
	}
	else if (model == 'BDV-E280' || model == 'BDV-E880' || model == 'BDV-L600' || model == 'BDV-E380' || model == 'BDV-EF200'){
		modelPath = "BDV4G_usb";
		prodPath = "BRD";
		modelOnUrl =false;
	}	
	else if (model == 'BDV-E190' || model == 'BDV-E290' || model == 'BDV-E490' || model == 'BDV-E690' || model == 'BDV-EF220' || model == 'BDV-EF420' || model == 'BDV-NF620'){
		modelPath = "BDV5G_usb";
		prodPath = "BRD";
		modelQuery="BDV5G_EX"; 
		modelOnUrl =true;
	}
	else if (model == 'BDV-NF620'){
		modelPath = "BDV5G_usb";
		prodPath = "BRD";
		modelQuery="BDV5G_NX"; 
		modelOnUrl =true;
	}
	else if (model == 'BDV-N590' || model == 'BDV-N790W' || model == 'BDV-N890W' || model == 'BDV-N990W' || model == 'BDV-NF720'){
		modelPath = "BDV5G_built";
		prodPath = "BRD";
		modelQuery="BDV5G_NX"; 
		modelOnUrl =true;
	}
	else if (model == 'BDP-S490' || model == 'BDP-S495'){
		modelPath = "BDP7G_usb";
		prodPath = "BRD";
		modelQuery="BDP7G";
		modelOnUrl =true;
	}
	else if (model == 'BDP-S390' || model == 'BDP-S590' || model == 'BDP-S790'){
		modelPath = "BDP7G_built";
		prodPath = "BRD";
		modelQuery= "BDP7G";
		modelOnUrl =true;
	}
	else if (model == 'BDV-E780W' || model == 'BDV-E980W' || model == 'BDV-L800' || model == 'BDV-L800M'){
		modelPath = "BDV4G_built";
		prodPath = "BRD";
		modelOnUrl =false;
	}	
	else if (model == 'CMT-MX700NI' || model =='CMT-MX750NI'){
		modelPath = "CMTMX7X0NI";
		prodPath = "NTW";
		modelOnUrl =false;
	}
	else if (model == 'NAS-SV20I' || model == 'NAS-SV20DI'){
		modelPath = "NASSV20I";
		prodPath = "NTW";
		modelOnUrl =false;
	}	
	else if (model == 'RMN-U1'){
		modelPath = "RMNU1";
		prodPath = "NTW";
		modelOnUrl =false;
	}		
}

function showPage() {
	
	if (prodPath == "NTW"){localePath = 'EN'; };
	url = "/support/data/blu-ray-connect/"+prodPath+"/" + modelPath + "/" + localePath + "/Default.html"; 
	
	if (modelOnUrl){
		if (modelQuery != ''){ url+='?Model='+modelQuery; }
		else{url+='?Model='+model_used;};
	}

theBox = $( '#connectwifi' );
	theBox.attr('src', url);
	theBox.css('display','block');
}
