function init(){
	var chkLen = document.getElementsByName("chkQuick").length;				
	for(var i = 0; i < chkLen ; i++){
		document.getElementsByName("chkQuick")[i].disabled = true;
	}
	
	if(kind == "latest"){
		document.getElementById("sort").options[1].selected = true;
		funPhoneSort();
	}else{
		if(compGbn == "compare"){
			funCompareResult();
		}else if(compGbn == "popular"){
			document.getElementById("sort").options[2].selected = true;
			funPhoneSort();
		}else{
			if(serachGbn != ""){
				searchTabChange(serachGbn);
			}else{
				document.getElementById("sort").options[1].selected = true;
				funPhoneSort();
			}		
		}
	}
	
	if(document.getElementById("phoneSearchPage").style.display == ""){	
		new Selectbox('sort');
	}
}

var imageViewHtml="";
var detailViewHtml="";

function viewIconChange(iconGbn){	
	var inhtml = "";
	
	document.getElementById("viewGbn").value=iconGbn;

	tmpOrdering = new Array;
	tmpSeriesName = new Array;
	tmpStr = new Array;

	// Phone series gubun
	for(var j = 0; j < phoneData.length; j++){
		tmpOrdering[j] = phoneData[j].ordeRing;
		tmpSeriesName[j] = phoneData[j].seriesName;
		if(phoneData[j].seriesName == "Other"){
			tmpStr[j] = phoneData[j].seriesName+"</span>";
		} else {
			tmpStr[j] = phoneData[j].seriesName.replace(/Series/g, "</span><span id='type' name='type' class='s_type'>Séries");					
		}
	}	
	
	
	if(iconGbn == "T"){		
		inhtml += "Ver como";
		inhtml += "<img src=\"/image/products/ico_view01_on.gif\" alt=\"Thumbnail View\">";
		inhtml += "<a title=\"Imges View\" href=\"javascript:viewIconChange('I');\" class=\"rollover\"><img src=\"/image/products/ico_view02_off.gif\" alt=\"Imges View\"><img src=\"/image/products/ico_view02_on.gif\" alt=\"Imges View\" class=\"over\"></a>";
		inhtml += "<a title=\"Text View\" href=\"javascript:viewIconChange('D');\" class=\"rollover\"><img src=\"/image/products/ico_view03_off.gif\" alt=\"Text View\"><img src=\"/image/products/ico_view03_on.gif\" alt=\"Text View\" class=\"over\"></a>";
				
		document.getElementById("thumbnailView").style.display="";
		document.getElementById("imageView").style.display="none";
		document.getElementById("detailView").style.display="none";
	}else if(iconGbn == "D" && quick_count == 0){
		inhtml += "Ver como";
		inhtml += "<a title=\"\" href=\"javascript:viewIconChange('T');\" class=\"rollover\"><img src=\"/image/products/ico_view01_off.gif\" alt=\"Thumbnail View\"><img src=\"/image/products/ico_view01_on.gif\" alt=\"Imges View\" class=\"over\"></a>";
		inhtml += "<a title=\"Imges View\" href=\"javascript:viewIconChange('I');\" class=\"rollover\"><img src=\"/image/products/ico_view02_off.gif\" alt=\"Imges View\"><img src=\"/image/products/ico_view02_on.gif\" alt=\"Imges View\" class=\"over\"></a>";
		inhtml += "<img src=\"/image/products/ico_view03_on.gif\" alt=\"Text View\" class=\"over\">";
		
		document.getElementById("thumbnailView").style.display="none";
		document.getElementById("imageView").style.display="none";
		document.getElementById("detailView").style.display="";
	}else if(iconGbn == "I"){			
		inhtml += "Ver como";
		inhtml += "<a title=\"\" href=\"javascript:viewIconChange('T');\" class=\"rollover\"><img src=\"/image/products/ico_view01_off.gif\" alt=\"Thumbnail View\"><img src=\"/image/products/ico_view01_on.gif\" alt=\"Imges View\" class=\"over\"></a>";
		inhtml += "<img src=\"/image/products/ico_view02_on.gif\" alt=\"Imges View\" class=\"over\">";
		inhtml += "<a title=\"Text View\" href=\"javascript:viewIconChange('D');\" class=\"rollover\"><img src=\"/image/products/ico_view03_off.gif\" alt=\"Text View\"><img src=\"/image/products/ico_view03_on.gif\" alt=\"Text View\" class=\"over\"></a>";
		
		if(imageViewHtml == ""){
			var phoneModelLength = phoneData.length;

			if(document.getElementById("sort").value == "series"){
				imageViewHtml += "<ul class=\"phone_type mt20\"><span id=\"type\" name=\"type\" class=\"p_type\">"+tmpStr[0]+"</span></ul>\n";
			}
			

			imageViewHtml += "<ul class=\"prdListi\">"
			for(var i=0; i< phoneModelLength; i++){
				imageViewHtml += "<li>\n";
				imageViewHtml += "	<div class=\"prd180\">\n";
				if(phoneData[i].stateInfo == "0900001"){
					
					if(phoneData[i].quickViewImage.substring(0,4) != 'http'){
						imageViewHtml += "		<img src=\""+phoneData[i].quickViewImage+"\" width=\"180\" height=\"180\" alt=\""+phoneData[i].phoneName+"\">\n";
					}
					if(phoneData[i].quickViewImage.substring(0,4) == 'http'){
						imageViewHtml += "		<img src=\""+phoneData[i].quickViewImage+"\" width=\"180\" height=\"180\" alt=\""+phoneData[i].phoneName+"\">\n";
					}
				}else{
					var phone_url = "samsung-"+phoneData[i].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
					if(phoneData[i].quickViewImage.substring(0,4) != 'http'){
						imageViewHtml += "		<a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneData[i].quickViewImage+"\" width=\"180\" height=\"180\" alt=\""+phoneData[i].phoneName+"\"></a>\n";
					}
					if(phoneData[i].quickViewImage.substring(0,4) == 'http'){
						imageViewHtml += "		<a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneData[i].quickViewImage+"\" width=\"180\" height=\"180\" alt=\""+phoneData[i].phoneName+"\"></a>\n";
					}				
				}
				
				var phone_url = "samsung-"+phoneData[i].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
				if(phoneData[i].newgbn == "new"){
					if(phoneData[i].stateInfo == "0900001"){
 						imageViewHtml += "		<p class=\"prd_tit2\"><img src=\"/image/common/ico_new.gif\" alt=\"new\" class=\"bNew\">"+phoneData[i].phoneName+"</p>\n";
					} else {
 						imageViewHtml += "		<p class=\"prd_tit2\"><img src=\"/image/common/ico_new.gif\" alt=\"new\" class=\"bNew\"><a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\">"+phoneData[i].phoneName+"</a></p>\n";
					}
				}else{				
					if(phoneData[i].stateInfo == "0900001"){
						imageViewHtml += "		<p class=\"prd_tit2\">"+phoneData[i].phoneName+"</p>\n";
					} else {
						imageViewHtml += "		<p class=\"prd_tit2\"><a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\">"+phoneData[i].phoneName+"</a></p>\n";
					}
				}
				
				if(phoneData[i].stateInfo == "0900001"){
					imageViewHtml += "			<div class=\"prdLinkBox2\">\n";
				}else{
					imageViewHtml += "			<div class=\"prdLinkBox3\">\n";
				}
				
				imageViewHtml += "			<ul>\n";
				imageViewHtml += "				<li><a title=\"Mais\" href=\""+THIS_PAGE_URL+"#quick_view\" onclick=\"javascript:quickview_view(event,'quickview',"+(i+1)+",'"+phoneData[i].phoneModel+"');\">Mais</a></li>\n";
				if(phoneData[i].stateInfo != "0900001"){
					imageViewHtml += "				<li id=\""+phoneData[i].phoneModel+"_i\"><a title=\"Comparar\" href=\"javascript:setCookie('"+phoneData[i].phoneModel+"','"+phoneData[i].miniName+"','"+phoneData[i].xsmallImage2+"');\">Comparar </a></li>\n";
				}
				imageViewHtml += "			</ul>\n";
				imageViewHtml += "		</div>\n";
				imageViewHtml += "	</div>\n";
				imageViewHtml += "</li>\n";
			
				if(document.getElementById("sort").value == "series"){
					if(phoneData[i].ordeRing != tmpOrdering[i+1]){
						if(tmpSeriesName[i+1] == "undefined" || tmpSeriesName[i+1] == null || tmpSeriesName[i+1] == ""){
							imageViewHtml += "</ul>\n";
						} else {

							imageViewHtml += "</ul>\n";

							imageViewHtml += "<ul class=\"phone_type mt20\"><span id=\"type\" name=\"type\" class=\"p_type\">"+tmpStr[i+1]+"</span></ul>\n";

							imageViewHtml += "<ul class=\"prdListi\">"

						}
					}
				}
			}
			imageViewHtml += "</ul>"
			
			if(phoneModelLength == 0){
				imageViewHtml = "<div class=\"box_result\">";
				imageViewHtml+= "	<strong>Lamentamos, </strong> mas não foi encontrado nenhum produto";
				imageViewHtml+= "</div>";
			}
			document.getElementById("imageView").innerHTML = imageViewHtml;
		}
				
		document.getElementById("thumbnailView").style.display="none";
		document.getElementById("imageView").style.display="";
		document.getElementById("detailView").style.display="none";
	}else if(iconGbn == "D"){
		inhtml += "Ver como";
		inhtml += "<a title=\"\" href=\"javascript:viewIconChange('T');\" class=\"rollover\"><img src=\"/image/products/ico_view01_off.gif\" alt=\"Thumbnail View\"><img src=\"/image/products/ico_view01_on.gif\" alt=\"Imges View\" class=\"over\"></a>";
		inhtml += "<a title=\"Imges View\" href=\"javascript:viewIconChange('I');\" class=\"rollover\"><img src=\"/image/products/ico_view02_off.gif\" alt=\"Imges View\"><img src=\"/image/products/ico_view02_on.gif\" alt=\"Imges View\" class=\"over\"></a>";
		inhtml += "<img src=\"/image/products/ico_view03_on.gif\" alt=\"Text View\" class=\"over\">";

		if( detailViewHtml == "" ){

			if(document.getElementById("sort").value == "series"){
				detailViewHtml += "<ul class=\"phone_type mt20\"><span id=\"type\" name=\"type\" class=\"p_type\">"+tmpStr[0]+"</span></ul>\n";
			}
		
		
			var phoneModelLength = phoneData.length;
			detailViewHtml += "<ul class=\"prdList_Row\">\n";
			for(var i=0; i< phoneModelLength; i++){
				detailViewHtml += "<li class=\"row\">\n";
				detailViewHtml += "		<div class=\"prd120\">\n";
				if(phoneData[i].stateInfo == "0900001"){
					
					if(phoneData[i].smallImage.substring(0,4) != 'http'){
						detailViewHtml += "			<img src=\""+phoneData[i].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneData[i].phoneName+"\">\n";
					}
					if(phoneData[i].smallImage.substring(0,4) == 'http'){
						detailViewHtml += "			<img src=\""+phoneData[i].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneData[i].phoneName+"\">\n";
					}				
				}else{
					var phone_url = "samsung-"+phoneData[i].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
					if(phoneData[i].smallImage.substring(0,4) != 'http'){
						detailViewHtml += "			<a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneData[i].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneData[i].phoneName+"\"></a>\n";
					}
					if(phoneData[i].smallImage.substring(0,4) == 'http'){
						detailViewHtml += "			<a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneData[i].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneData[i].phoneName+"\"></a>\n";
					}					
				}
				
				var phone_url = "samsung-"+phoneData[i].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
				if(phoneData[i].newgbn == "new"){
					if(phoneData[i].stateInfo == "0900001"){
						detailViewHtml += "			<p class=\"prd_tit2\"><img src=\"/image/common/ico_new.gif\" alt=\"new\" class=\"bNew\">"+phoneData[i].phoneName+"</p>\n";

					} else {
						detailViewHtml += "			<p class=\"prd_tit2\"><img src=\"/image/common/ico_new.gif\" alt=\"new\" class=\"bNew\"> <a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\">"+phoneData[i].phoneName+"</a></p>\n";
					}
				}else{
					if(phoneData[i].stateInfo == "0900001"){
						detailViewHtml += "			<p class=\"prd_tit2\">"+phoneData[i].phoneName+"</p>\n";
					} else {
						detailViewHtml += "			<p class=\"prd_tit2\"> <a title=\""+phoneData[i].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\">"+phoneData[i].phoneName+"</a></p>\n";
					}
				}

				
				if(phoneData[i].stateInfo == "0900001"){
					detailViewHtml += "			<div class=\"prdLinkBox2\">\n";
				}else{
					detailViewHtml += "			<div class=\"prdLinkBox3\">\n";
				}
				detailViewHtml += "				<ul>\n";
				detailViewHtml += "					<li><a title=\"Mais\" href=\""+THIS_PAGE_URL+"#quick_view\" onclick=\"javascript:quickview_view(event,'quickview',"+(i+1)+",'"+phoneData[i].phoneModel+"');\">Mais</a></li>\n";
				if(phoneData[i].stateInfo != "0900001"){
					detailViewHtml += "				<li id=\""+phoneData[i].phoneModel+"_d\"><a title=\"Comparar\" href=\"javascript:setCookie('"+phoneData[i].phoneModel+"','"+phoneData[i].miniName+"','"+phoneData[i].xsmallImage2+"');\">Comparar </a></li>\n";
				}
				detailViewHtml += "				</ul>\n";
				detailViewHtml += "			</div>\n";
				detailViewHtml += "		</div>\n";
				detailViewHtml += "		<div class=\"prdQspec\">\n";
				detailViewHtml += "			<h4>Pesquisa Rápida</h4>\n";
				detailViewHtml += "			<ul>\n";
				for(var k=1; k<11; k++){
				if(eval("phoneData["+i+"].quickSpecImage"+k) != " "){
					detailViewHtml += "				<li>\n";
					detailViewHtml += "					<div class=\"spec_icon\"><a onMouseOver=\"spec_balloon("+k+",'"+phoneData[i].phoneModel+"')\" onMouseOut=\"selectHide('"+phoneData[i].phoneModel+"_"+k+"')\">\n";
	
						if((eval("phoneData["+i+"].quickSpecImage"+k)).substring(0,4) == 'http') {
							detailViewHtml += "						<img src=\""+eval("phoneData["+i+"].quickSpecImage"+k)+"\" alt=\"\"></a>\n";
						} else {
							detailViewHtml += "						<img src=\""+PUB_LOCAL+""+QUICKSPEC_SAVE_PATH+""+eval("phoneData["+i+"].quickSpecImage"+k)+"\" alt=\"\"></a>\n";
						}							
														
					detailViewHtml += "					</div>\n";
					detailViewHtml += "					<div class=\"spec_balloon_h1 spec_balloon\" id=\""+phoneData[i].phoneModel+"_"+k+"\">\n";
					
						detailViewHtml += "						<div class=\"spec_balloon_con\">"+eval("phoneData["+i+"].quickSpecDesc"+k)+"</div>\n";
										
					detailViewHtml += "					</div>\n";
					detailViewHtml += "				</li>\n";
				}
				}						
				
				detailViewHtml += "			</ul>\n";
				detailViewHtml += "		</div>\n";					
				detailViewHtml += "		<div class=\"prdKeyFeat\">\n";
				detailViewHtml += "			<h4>Funcionalidades principais</h4>\n";
				detailViewHtml += "			<ul class=\"dotList\">\n";
				if(phoneData[i].features1 != " "){
					detailViewHtml += "				<li>"+phoneData[i].features1+"</li>\n";
				}
				if(phoneData[i].features2 != " "){
					detailViewHtml += "				<li>"+phoneData[i].features2+"</li>\n";
				}
				if(phoneData[i].features3 != " "){
					detailViewHtml += "				<li>"+phoneData[i].features3+"</li>\n";
				} 
				if(phoneData[i].features4 != " "){
					detailViewHtml += "				<li>"+phoneData[i].features4+"</li>\n";
				}
				if(phoneData[i].features5 != " "){
					detailViewHtml += "				<li>"+phoneData[i].features5+"</li>\n";
				} 
				if(phoneData[i].features6 != " "){
					detailViewHtml += "				<li>"+phoneData[i].features6+"</li>\n";
				}
				detailViewHtml += "			</ul>\n";
				detailViewHtml += "		</div>\n";
				detailViewHtml += "	</li>\n";

			
				if(document.getElementById("sort").value == "series"){
					if(phoneData[i].ordeRing != tmpOrdering[i+1]){
						if(tmpSeriesName[i+1] == "undefined" || tmpSeriesName[i+1] == null || tmpSeriesName[i+1] == ""){
							detailViewHtml += "</ul>\n";
						} else {

							detailViewHtml += "</ul>\n";

							detailViewHtml += "<ul class=\"phone_type mt20\"><span id=\"type\" name=\"type\" class=\"p_type\">"+tmpStr[i+1]+"</span></ul>\n";

							detailViewHtml += "<ul class=\"prdList_Row\">\n";

						}
					}
				}			
			
			
			}
			detailViewHtml += "</ul>\n";
			
			if(phoneModelLength == 0){
				detailViewHtml = "<div class=\"box_result\">";
				detailViewHtml+= "	<strong>Lamentamos, </strong> mas não foi encontrado nenhum produto";
				detailViewHtml+= "</div>";
			}
						
			document.getElementById("detailView").innerHTML = detailViewHtml;
		}
		
		document.getElementById("thumbnailView").style.display="none";
		document.getElementById("imageView").style.display="none";
		document.getElementById("detailView").style.display="";
	}		
	document.getElementById("viewIcon").innerHTML = inhtml;	
	compareSetting();	
}

function spec_balloon(n, objNm) {
	for(var i = 1; i <= 10; i++) {		
		obj_d = document.getElementById(objNm+'_'+i);
		
		if ( n == i ) {
				obj_d.style.display = "block";
		} 
	}
}

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ns4||ns6) document.captureEvents(Event.MOUSEMOVE);

function quickview_view(e,id,objCount,phoneModel) {
	/*
	ProductsDwrAction.selectPhoneColor({				 
			phoneModel:phoneModel		
		},
		function funColorSearch(data){
			var colorHtml = "";
			
			for(var i = 0; i < data.length; i++){
				colorHtml += "<li><span style=\"background-color:#"+data[i].colorValue+";\"></span></li>\n";
			}
			
			for(var j = data.length; j< 10; j++){
				colorHtml += "<li></li>\n";
			}
			
			document.getElementById("colorList").innerHTML = colorHtml;
		}
	);
	*/
	var varLeft;
	var varTop;
		
	if(ns4||ns6){		
		varLeft = (e.clientX+window.pageXOffset);
		varTop = (e.clientY+window.pageYOffset+100);		
	}else{
		varLeft = (event.clientX+document.documentElement.scrollLeft);
		varTop = (event.clientY+document.documentElement.scrollTop+100);
	}
	
	
	if(document.documentElement.clientWidth > 980){
		if(varLeft > 650){
			varLeft = (varLeft-((document.documentElement.clientWidth-980)/2))-180;
		}else{
			varLeft = (varLeft-((document.documentElement.clientWidth-980)/2))+200; 
		}
	}else{
		varLeft += 200; 
	}
	
	if(ns4||ns6){	
		document.getElementById(id).style.left=varLeft+"px";
		document.getElementById(id).style.top=varTop+"px";
	}else{
		document.getElementById(id).style.left=varLeft;
		document.getElementById(id).style.top=varTop;
	}
	
	if(phoneData != null){		
		var arrNum = objCount - 1;	
		
		if(phoneData[arrNum].stateInfo == "0900001"){

			document.getElementById("detail_bt").style.display="none";
			
			if(phoneData[arrNum].quickViewImage.substring(0,4) != 'http'){
	
				document.getElementById("phoneQuickImage").innerHTML = "<img src=\""+phoneData[arrNum].quickViewImage+"\" id=\"quick_phone_image\" width=\"180\" height=\"180\" alt=\""+phoneData[arrNum].phoneName+"\">";
			}
			if(phoneData[arrNum].quickViewImage.substring(0,4) == 'http'){
				document.getElementById("phoneQuickImage").innerHTML = "<img src=\""+phoneData[arrNum].quickViewImage+"\" id=\"quick_phone_image\" width=\"180\" height=\"180\" alt=\""+phoneData[arrNum].phoneName+"\">";
			}
			
		}else{
			var phone_url = "samsung-"+phoneData[arrNum].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
			if(phoneData[arrNum].quickViewImage.substring(0,4) != 'http'){
				document.getElementById("phoneQuickImage").innerHTML = "<a title=\""+phoneData[arrNum].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\" class=\"leftA mt3\"><img src=\""+phoneData[arrNum].quickViewImage+"\" id=\"quick_phone_image\" width=\"180\" height=\"180\" alt=\""+phoneData[arrNum].phoneName+"\"></a>";
			}
			if(phoneData[arrNum].quickViewImage.substring(0,4) == 'http'){
				document.getElementById("phoneQuickImage").innerHTML = "<a title=\""+phoneData[arrNum].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\" class=\"leftA mt3\"><img src=\""+phoneData[arrNum].quickViewImage+"\" id=\"quick_phone_image\" width=\"180\" height=\"180\" alt=\""+phoneData[arrNum].phoneName+"\"></a>";
			}		

			document.getElementById("detail_bt").style.display="block";

			document.getElementById("detail_bt").innerHTML = "<a title=\""+phoneData[arrNum].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\" class=\"leftA mt3\"><img src=\"/image/products/bt_detail.gif\" id=\"detail_bt_image\" alt=\""+phoneData[arrNum].phoneName+"\"></a>";

		}
		document.getElementById("quick_phone_name").innerHTML = phoneData[arrNum].phoneName;
		
		var inFeature = "";
		
		if(phoneData[arrNum].features1 != " "){
			inFeature += "<li>"+FFStrCutByteString(phoneData[arrNum].features1,22)+"</li>";
		}
		if(phoneData[arrNum].features2 != " "){
			inFeature += "<li>"+FFStrCutByteString(phoneData[arrNum].features2,22)+"</li>";
		}
		if(phoneData[arrNum].features3!= " "){
			inFeature += "<li>"+FFStrCutByteString(phoneData[arrNum].features3,22)+"</li>";
		}
		if(phoneData[arrNum].features4 != " "){
			inFeature += "<li>"+FFStrCutByteString(phoneData[arrNum].features4,22)+"</li>";
		}
		if(phoneData[arrNum].features5 != " "){
			inFeature += "<li>"+FFStrCutByteString(phoneData[arrNum].features5,22)+"</li>";
		}
		if(phoneData[arrNum].features6 != " "){
			inFeature += "<li>"+FFStrCutByteString(phoneData[arrNum].features6,22)+"</li>";
		}
		
		document.getElementById("qFeaturesList").innerHTML = "<ul class=\"dotList mt5\">"+inFeature+"</ul>";
		
		document.getElementById("slogon").innerHTML = phoneData[arrNum].slogon;
		var detailViewHtml = "";
		for(j = 1 ; j < 11 ; j++){
			if(eval("phoneData["+arrNum+"].quickSpecImage"+j) != " "){
				detailViewHtml += "				<li>\n";
				if((eval("phoneData["+arrNum+"].quickSpecImage"+j)).substring(0,4) == 'http') {
					detailViewHtml += "				<div class=\"spec_icon\"><a onMouseOver=\"spec_balloon("+j+",'spec_balloon')\" onMouseOut=\"selectHide('spec_balloon_"+j+"')\"><img src=\""+eval("phoneData["+arrNum+"].quickSpecImage"+j)+"\" id=\"quick_view_spec_image"+j+"\" alt=\"\" ></a></div>\n";
				} else { 
					detailViewHtml += "				<div class=\"spec_icon\"><a onMouseOver=\"spec_balloon("+j+",'spec_balloon')\" onMouseOut=\"selectHide('spec_balloon_"+j+"')\"><img src=\""+PUB_LOCAL+""+QUICKSPEC_SAVE_PATH+""+eval("phoneData["+arrNum+"].quickSpecImage"+j)+"\" id=\"quick_view_spec_image"+j+"\" alt=\"\" ></a></div>\n";
				}	
				detailViewHtml += "				<div class=\"spec_balloon_h"+j+" spec_balloon\" id=\"spec_balloon_"+j+"\"><div class=\"spec_balloon_con\" id=\"spec_balloon_con_"+j+"\">"+eval("phoneData["+arrNum+"].quickSpecDesc"+j)+"</div></div>\n";
				detailViewHtml += "				</li>\n";
			}
		}
		document.getElementById("qSpecList").innerHTML = "<ul>"+detailViewHtml+"</ul>";
	}else{
		
		alert("Carregando....");
		return;
	}
	document.getElementById(id).style.visibility='visible';
}

var crossobj;

function drag_drop(e){	
	if (ie4&&dragapproved){
		crossobj.style.left=tempx+event.clientX-offsetx
		crossobj.style.top=tempy+event.clientY-offsety
		return false
	} else if (ns6&&dragapproved) {
		crossobj.style.left=tempx+e.clientX-offsetx+"px"
		crossobj.style.top=tempy+e.clientY-offsety+"px"
		return false
	}
}

function initializedrag(e, id){
	crossobj=ns6? document.getElementById(id) : document.all[id]	
	var firedobj=ns6? e.target : event.srcElement
	var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
	while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!=id){
		firedobj=ns6? firedobj.parentNode : firedobj.parentElement
	}

	if (firedobj.id==id){
		offsetx=ie4? event.clientX : e.clientX
		offsety=ie4? event.clientY : e.clientY
		
		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)
		
		dragapproved=true
		document.onmousemove=drag_drop
	}
}

document.onmouseup=new Function("dragapproved=false")

function hidebox(id){
	crossobj=ns6? document.getElementById(id) : document.all[id]
	if (ie4||ns6)
		crossobj.style.visibility="hidden"
	else if (ns4)
		document.quickview.visibility="hide"
}

function setCookie(phoneModel, phoneName, img){	
	var name="phoneCompare";
	var todayDate = new Date();
	var expiredays = 1;
  	todayDate.setDate( todayDate.getDate() + expiredays );
  	
  	var cookieVal = getCookie(name);  	
  	var value = phoneModel+"|"+phoneName+"|"+img;

	if(cookieVal != null){
		if( cookieVal.indexOf(value) < 0 ){
			if(cookieVal == ""){
				value = value;	
			}else{
				value = cookieVal+"^"+value;
			}					
		}else{
			alert(P01);
			return;
		}
		
		if(cookieVal.split("^").length > 2){
			alert(P02);
			//alert("Maximum 3 Phones");
			return;
		}
	}
	
  	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
  	
  	addCompare(phoneModel, phoneName, img);
  	compareTxtSetting(value);
  	//laypopCompareView2(value);  
  	laypopCompareView();	
}

function getCookie(name) {
	var arg = name + "="; 
	var alen = arg.length;
	var clen = document.cookie.length;		
	var i = 0;

	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
    		return getCookieVal (j);
    	i = document.cookie.indexOf(" ", i) + 1;
    	if (i == 0)
    		break;
	}
	return null;
}

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;

	return unescape(document.cookie.substring(offset, endstr));
}

function delCookie(phoneModel, phoneName, img){
	var name = "phoneCompare";
	var value = "";
	
	var todayDate = new Date();
	var expiredays = 1;
  	todayDate.setDate( todayDate.getDate() + expiredays );
  	
	var cookieVal = getCookie(name);
	
	if(cookieVal != null){	
		var rowCookie = cookieVal.split("^");
	
		var j = 0;
		for(var i = 0 ; i < rowCookie.length; i++){
			if(rowCookie[i].indexOf(phoneModel) == -1){
				j++;
				
				if(j == 1){
					value += rowCookie[i];
				}else{
					value += "^"+rowCookie[i];
				}
			}
		}
		
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
	}
	
	removeCompare(phoneModel, phoneName, img);
	compareTxtSetting(value);
	//laypopCompareView2(value);
	laypopCompareView();
	
}

function delPhoneModelCookie(phoneModel){
	var name = "phoneCompare";
	var value = "";
	
	var todayDate = new Date();
	var expiredays = 1;
  	todayDate.setDate( todayDate.getDate() + expiredays );
  	
  	var textCookieVal = phoneModel.split("|");
	var cookieVal = getCookie(name);
	
	if(cookieVal != null){	
		var rowCookie = cookieVal.split("^");
	
		var j = 0;
		for(var k = 0; k < textCookieVal.length; k++){
			for(var i = 0 ; i < rowCookie.length; i++){	
				var colCookie = rowCookie[i].split("|");		
				if(textCookieVal[k] == colCookie[0]){
					j++;
					
					if(j == 1){
						value += rowCookie[i];
					}else{
						value += "^"+rowCookie[i];
					}					
				}
			}
		}
		
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
	}
	
	compareTxtSetting(value);
}

function addCompare(phoneModel, phoneName, img){
	if(document.getElementById(phoneModel+"_t") != null){
		document.getElementById(phoneModel+"_t").className = "on";
		document.getElementById(phoneModel+"_t").innerHTML = "<a title=\"Remover\" href=\"javascript:delCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Remover</a>";
	}
	
	if(document.getElementById(phoneModel+"_i") != null){
		document.getElementById(phoneModel+"_i").className = "on";
		document.getElementById(phoneModel+"_i").innerHTML = "<a title=\"Remover\" href=\"javascript:delCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Remover</a>";
	}
	
	if(document.getElementById(phoneModel+"_d") != null){
		document.getElementById(phoneModel+"_d").className = "on";
		document.getElementById(phoneModel+"_d").innerHTML = "<a title=\"Remover\" href=\"javascript:delCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Remover</a>";
	}
	
	if(document.getElementById(phoneModel+"_compare") != null){
		document.getElementById(phoneModel+"_compare").className = "on";
		document.getElementById(phoneModel+"_compare").innerHTML = "<a title=\"Remover\" href=\"javascript:delCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Remover</a>";
	}
}

function removeCompare(phoneModel, phoneName, img){
	if(document.getElementById(phoneModel+"_t") != null){
		document.getElementById(phoneModel+"_t").className = "";
		document.getElementById(phoneModel+"_t").innerHTML = "<a title=\"Comparar\" href=\"javascript:setCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Comparar </a>";
	}
	
	if(document.getElementById(phoneModel+"_i") != null){
		document.getElementById(phoneModel+"_i").className = "";
		document.getElementById(phoneModel+"_i").innerHTML = "<a title=\"Comparar\" href=\"javascript:setCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Comparar </a>";
	}
	
	if(document.getElementById(phoneModel+"_d") != null){
		document.getElementById(phoneModel+"_d").className = "";
		document.getElementById(phoneModel+"_d").innerHTML = "<a title=\"Comparar\" href=\"javascript:setCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Comparar </a>";
	}
	
	if(document.getElementById(phoneModel+"_compare") != null){
		document.getElementById(phoneModel+"_compare").className = "";
		document.getElementById(phoneModel+"_compare").innerHTML = "<a title=\"Comparar\" href=\"javascript:setCookie('"+phoneModel+"','"+phoneName+"','"+img+"');\">Comparar </a>";
	}
}

function compareTxtSetting(value){
	var txtArr = value.split("^");	
	var modelArr;
	for(var i=0; i < 3; i++){
		if( txtArr == ""){
			//document.getElementById("compare"+(i+1)).value="---";
			document.getElementById("compareWidth"+(i+1)).style.width= "";
			document.getElementById("compare"+(i+1)).innerHTML = "<img src='"+IMG_ROOT+"products/temp.gif' alt='' />";
		}else{				
			if( txtArr[i] != null ){										
				modelArr = txtArr[i].split("|");
				//document.getElementById("compare"+(i+1)).value = replace(modelArr[1],"Samsung ","");
				//document.getElementById("compare"+(i+1)).value = modelArr[1];
				document.getElementById("compareWidth"+(i+1)).style.width= (modelArr[1].length*8.5)+"px";
				document.getElementById("compare"+(i+1)).innerHTML = changeTxt(null,modelArr[1]);
			}else{
				//document.getElementById("compare"+(i+1)).value = "---";
				document.getElementById("compareWidth"+(i+1)).style.width= "";
				document.getElementById("compare"+(i+1)).innerHTML = "<img src='"+IMG_ROOT+"products/temp.gif' alt='' />";
			}
		}
	}
}

function laypopCompareView(){
	var comparePhoneText = "0 Telemóveis";
	var comparePhoneInfoHtml = "";
	var rowCookie = "";
	
	if(getCookie("phoneCompare") != null && getCookie("phoneCompare") != ""){						
		rowCookie = getCookie("phoneCompare").split("^");			
		var colCookie;
		
		comparePhoneText = rowCookie.length+" Telemóveis";
		
		for(var i=0; i < rowCookie.length; i++){
			colCookie = rowCookie[i].split("|");
			
			comparePhoneInfoHtml += "<li class=\"on\">\n";
			comparePhoneInfoHtml += "	<input type=\"checkbox\" id=\"comparePhoneModelChk\" name=\"comparePhoneModelChk\" value=\""+colCookie[0]+"|"+colCookie[1]+"|"+colCookie[2]+"\" class=\"chk\">\n";
			if((colCookie[2]).substring(0,4) == 'http') {
				comparePhoneInfoHtml += "	<img src=\""+colCookie[2]+"\" alt=\"\">\n";
			} else {
				comparePhoneInfoHtml += "	<img src=\""+colCookie[2]+"\" alt=\"\">\n";
			}	
			comparePhoneInfoHtml += "	<p class=\"p_tit\">"+changeTxt(null, colCookie[1])+"</p>\n";
			comparePhoneInfoHtml += "</li>\n";
		}
		
		for(var j=0; j < (3 - rowCookie.length); j++){
			comparePhoneInfoHtml += "<li>\n";
			comparePhoneInfoHtml += "	<input type=\"checkbox\" id=\"comparePhoneModelChk\" name=\"comparePhoneModelChk\" class=\"chk\" disabled>\n";
			comparePhoneInfoHtml += "	<p class=\"p_tit\">---</p>\n";
			comparePhoneInfoHtml += "</li>\n";
		}
	}else{
		for(var k=0; k < 3; k++){
			comparePhoneInfoHtml += "<li>\n";
			comparePhoneInfoHtml += "	<input type=\"checkbox\" id=\"comparePhoneModelChk\" name=\"comparePhoneModelChk\" class=\"chk\" disabled>\n";
			comparePhoneInfoHtml += "	<p class=\"p_tit\">---</p>\n";
			comparePhoneInfoHtml += "</li>\n";
		}
	}
		
	document.getElementById("comparePhone").innerHTML = comparePhoneText;
	document.getElementById("comparePhoneInfo").innerHTML = comparePhoneInfoHtml;
	
	if(rowCookie.length == 0){
		document.getElementById("compId1").innerHTML = "Comparar<BR>Agora!";
		document.getElementById("compId2").innerHTML = "Apagar";
	}else{
		document.getElementById("compId1").innerHTML = "<a title=\"Compare Agora!\" href=\"javascript:;\" OnClick=\"funCompareResult();selectHide2('laypop_compare')\">Compare<BR>Agora!</a>";
		document.getElementById("compId2").innerHTML = "<a title=\"Apagar\" href=\""+THIS_PAGE_URL+"#delete\" OnClick=\"javascript:delCompare();\">Apagar</a>";		
	}
	
	document.getElementById("laypop_compare").style.display='block';
	funDisplayNone();
}

var setTime;
function funDisplayNone(){
	if (document.getElementById("laypop_compare").style.display == "block"){ 
		setTime = setTimeout("selectHide2('laypop_compare')", 15000);
	}else{
		setTime = setTimeout("funDisplayNone()",50);		
	}
}

function laypopCompareView2(cookieValue){
	var comparePhoneText = "0 Telefone";
	var comparePhoneInfoHtml = "";
	var rowCookie = "";
	
	if(cookieValue != null && cookieValue != ""){						
		rowCookie = cookieValue.split("^");			
		var colCookie;
		
		comparePhoneText = rowCookie.length+" Telemóveis";
		
		for(var i=0; i < rowCookie.length; i++){
			colCookie = rowCookie[i].split("|");
			
			comparePhoneInfoHtml += "<li class=\"on\">\n";
			comparePhoneInfoHtml += "	<input type=\"checkbox\" id=\"comparePhoneModelChk\" name=\"comparePhoneModelChk\" value=\""+colCookie[0]+"|"+colCookie[1]+"|"+colCookie[2]+"\" class=\"chk\">\n";
			if((colCookie[2]).substring(0,4) == 'http') {
				comparePhoneInfoHtml += "	<img src=\""+colCookie[2]+"\" alt=\"\">\n";
			} else {
				comparePhoneInfoHtml += "	<img src=\""+colCookie[2]+"\" alt=\"\">\n";
			}	
			comparePhoneInfoHtml += "	<p class=\"p_tit\">"+changeTxt(null,colCookie[1])+"</p>\n";
			comparePhoneInfoHtml += "</li>\n";
		}
		
		for(var j=0; j < (3 - rowCookie.length); j++){
			comparePhoneInfoHtml += "<li>\n";
			comparePhoneInfoHtml += "	<input type=\"checkbox\" id=\"comparePhoneModelChk\" name=\"comparePhoneModelChk\" class=\"chk\" disabled>\n";
			comparePhoneInfoHtml += "	<p class=\"p_tit\">---</p>\n";
			comparePhoneInfoHtml += "</li>\n";
		}
	}else{
		for(var k=0; k < 3; k++){
			comparePhoneInfoHtml += "<li>\n";
			comparePhoneInfoHtml += "	<input type=\"checkbox\" id=\"comparePhoneModelChk\" name=\"comparePhoneModelChk\" class=\"chk\" disabled>\n";
			comparePhoneInfoHtml += "	<p class=\"p_tit\">---</p>\n";
			comparePhoneInfoHtml += "</li>\n";
		}
	}
		
	document.getElementById("comparePhone").innerHTML = comparePhoneText;
	document.getElementById("comparePhoneInfo").innerHTML = comparePhoneInfoHtml;
	
	if(rowCookie.length == 0){
		document.getElementById("compId1").innerHTML = "Compare<BR>Agora!";
		document.getElementById("compId2").innerHTML = "Apagar";
	}else{
		document.getElementById("compId1").innerHTML = "<a title=\"Compare Agora!\" href=\"javascript:;\" OnClick=\"funCompareResult();selectHide('laypop_compare')\">Compare<BR>Agora!</a>";
		document.getElementById("compId2").innerHTML = "<a title=\"Apagar\" href=\""+THIS_PAGE_URL+"#delete\" OnClick=\"javascript:delCompare();\">Apagar</a>";		
	}
	
	if(document.getElementById("laypop_compare").style.display == "block"){
		document.getElementById("laypop_compare").style.display='block';
	}else if(document.getElementById("laypop_compare").style.display == "none"){
		document.getElementById("laypop_compare").style.display="none";
	}
}

function delCompare(){
	var delCompareVar;	
	var name="phoneCompare";
	var value = "";
	var phoneVal;
	var cookieVal = getCookie(name);
	var rowCookie = "";
	var chkCount = 0;
	if(cookieVal !=null && cookieVal != ""){
		rowCookie = cookieVal.split("^");
	}
	
	var todayDate = new Date();
	var expiredays = 1;
  	todayDate.setDate( todayDate.getDate() + expiredays );
  	
	for(var i = 0 ; i < document.getElementsByName("comparePhoneModelChk").length; i++){		
		if(document.getElementsByName("comparePhoneModelChk")[i].checked){
			phoneVal = document.getElementsByName("comparePhoneModelChk")[i].value.split("|");
			
			if(cookieVal !=null && cookieVal != ""){
				for(var j = 0 ; j < rowCookie.length; j++){					
					if( rowCookie[j].indexOf(phoneVal[0]) == 0 ){
						rowCookie[j] = "";
						removeCompare(phoneVal[0], phoneVal[1], phoneVal[2]);
						
						chkCount++;
					}
				}		
			}
		}
	}
	
	if(chkCount == 0){
		return;
	}
	
	var l = 0;
	for(var k = 0; k < rowCookie.length ; k++){		
		if(rowCookie[k] != ""){
			l++;
			if(l == 1){
				value += rowCookie[k];
			}else{
				value += "^"+rowCookie[k];
			}
		}
	}
	
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";	
	
	compareTxtSetting(value);
	laypopCompareView2(value);
	
	if(document.getElementById("phoneComparePage").style.display == ""){
		funCompareResult();
	}
}

function delAllCompare(){
	var delCompareVar;	
	var name="phoneCompare";
	var value = "";
	
	var todayDate = new Date();
	var expiredays = 1;
  	todayDate.setDate( todayDate.getDate() + expiredays );
	
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";	
	
	compareTxtSetting(value);
	laypopCompareView2(value);
}

function funQuickSearch(){
	var searchSpecSeqNo="";
	var searchCnt=0;
	
	var advanceIsChoice = false;
	var advanceLen = document.getElementsByName("chkAdvance").length;
	for(var i = 0; i < advanceLen ; i++){
		if(document.getElementsByName("chkAdvance")[i] != null){
			if(document.getElementsByName("chkAdvance")[i].checked){
				searchSpecSeqNo += document.getElementsByName("chkAdvance")[i].value;
				advanceIsChoice = true;
				searchSpecSeqNo += ",";
			}
		}
	}
	if(advanceIsChoice)
		searchCnt++;

	var chkLen = document.getElementsByName("chkQuick").length;
	for(var i = 0; i < chkLen ; i++){
		if(document.getElementsByName("chkQuick")[i] != null){
			if(document.getElementsByName("chkQuick")[i].checked){
				searchSpecSeqNo += document.getElementsByName("chkQuick")[i].value;
				searchCnt++;
				searchSpecSeqNo += ",";
			}
		}
	}	
	
	funSearch(searchSpecSeqNo, searchCnt);
	
	if(feature_num !="" && quick_count == 1 ){
		var form = document.frm ;
		var chkCnt = 0;
		
		
		for(var j=0; j<form.chkAdvance.length; j++){
			if(chkCnt < 2){
				if(form.chkAdvance[j].checked == true){
					if(chkCnt == 0){
						form.chkDtl1.value = form.chkAdvance[j].value
					}else{
						form.chkDtl2.value = form.chkAdvance[j].value
					}
					chkCnt = chkCnt + 1;
				}
			}
			else
			{
				break;
			}
						
		}
		
		for(var j=0; j<form.chkQuick.length; j++){
			if(chkCnt < 2){
				if(form.chkQuick[j].checked == true){
					if(chkCnt == 0){
						form.chkDtl1.value = form.chkQuick[j].value
					}else{
						form.chkDtl2.value = form.chkQuick[j].value
					}
					chkCnt = chkCnt + 1;
				}
			}
			else
			{
				break;
			}
						
		}
		
		//alert("end");
		
		form.action = "/telemoveis/phone-search.do"; 
		form.submit(); 
	}
}
function funSearch(searchSpecSeqNo, searchCnt){//searchSpecSeqNo
	try {
		var chkAdvanceLen = document.getElementsByName("chkAdvance").length;	
					
		for(var i = 0; i < chkAdvanceLen ; i++){
			document.getElementsByName("chkAdvance")[i].disabled = true;
		}
		
		var chkLen = document.getElementsByName("chkQuick").length;	
		for(var i = 0; i < chkLen ; i++){
			document.getElementsByName("chkQuick")[i].disabled = true;
		}
		
		var kind=kindparam;
		
		document.getElementById("phoneSearchPage").style.display = "";
		document.getElementById("phoneComparePage").style.display = "none";
		document.getElementById("compPhone").style.display = "none";
		
		if(feature_num !="" || quick_count == 0){
		}else{
		document.getElementById("thumbnailView").innerHTML = "Carregando...";
		document.getElementById("imageView").innerHTML = "Carregando...";
		document.getElementById("detailView").innerHTML = "Carregando...";
		}
		
		var sort = document.getElementById("sort").value;
		document.getElementById("sort").disabled = true;
		
		ProductsDwrAction.selectGSfcPrdSearchDwrList({
				 searchSpecSeqNo:searchSpecSeqNo
				,searchCnt:searchCnt
				,kind:kind
				,order:document.getElementById("sort").value
				,phoneModel:""		
			},
			function funPhoneSearch(data){
				if(feature_num !="" || quick_count == 0){
				phoneData = data;
						
				var iconGbn = document.getElementById("viewGbn").value;	
				viewIconChange(iconGbn);
				
				var chkLen = document.getElementsByName("chkQuick").length;				
				for(var i = 0; i < chkLen ; i++){
					document.getElementsByName("chkQuick")[i].disabled = false;
				}
				var chkAdvanceLen = document.getElementsByName("chkAdvance").length;				
				for(var i = 0; i < chkAdvanceLen ; i++){
					document.getElementsByName("chkAdvance")[i].disabled = false;
				}
				
				document.getElementById("sort").disabled = false;
				compareSetting();
			    quick_count=1;
					
				}else{
				phoneData = data;				
				var inhtml = "";
				
				document.getElementById("totalPhone").innerHTML = data.length;

				tmpOrdering = new Array;
				tmpSeriesName = new Array;
				tmpStr = new Array;

				// Phone series gubun
				for(var j = 0; j < data.length; j++){
					tmpOrdering[j] = data[j].ordeRing;
					tmpSeriesName[j] = data[j].seriesName;
					if(data[j].seriesName == "Other"){
						tmpStr[j] = data[j].seriesName+"</span>";
					} else {
						tmpStr[j] = data[j].seriesName.replace(/Series/g, "</span><span id='type' name='type' class='s_type'>Séries");					
					}
				}

				if(document.getElementById("sort").value == "series"){
					inhtml += "<ul class=\"phone_type mt20\"><span id=\"type\" name=\"type\" class=\"p_type\">"+tmpStr[0]+"</span></ul>\n";
				}

				inhtml += "<ul class=\"prdList\">\n";
							
				for(var j = 0; j < data.length; j++){									
					
					inhtml += "	<li>\n";
					inhtml += "		<div class=\"prd120\">\n";
					
					if(kind == 'upcoming'){
						
						if(data[j].smallImage.substring(0,4) != 'http'){
							inhtml += "<img src=\""+data[j].smallImage+"\" width=\"120\" height=\"120\" alt=\""+data[j].phoneName+"\">\n";
						}
						if(data[j].smallImage.substring(0,4) == 'http'){
							inhtml += "<img src=\""+data[j].smallImage+"\" width=\"120\" height=\"120\" alt=\""+data[j].phoneName+"\">\n";
						}
					}else{
						var phone_url = "samsung-"+data[j].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
						if(data[j].smallImage.substring(0,4) != 'http'){
							inhtml += "<a title=\""+data[j].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+data[j].smallImage+"\" width=\"120\" height=\"120\" alt=\""+data[j].phoneName+"\"></a>\n";
						}
						if(data[j].smallImage.substring(0,4) == 'http'){
							inhtml += "<a title=\""+data[j].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+data[j].smallImage+"\" width=\"120\" height=\"120\" alt=\""+data[j].phoneName+"\"></a>\n";
						}					
					}
					
					var phone_url = "samsung-"+data[j].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
					if(data[j].newgbn == "new"){
						if(data[j].stateInfo == "0900001"){
							inhtml += "			<p class=\"prd_tit2\"><img src=\"/image/common/ico_new.gif\" alt=\"new\" class=\"bNew\">"+data[j].phoneName+"</p>\n";
						} else {
							inhtml += "			<p class=\"prd_tit2\"><img src=\"/image/common/ico_new.gif\" alt=\"new\" class=\"bNew\"> <a title=\""+data[j].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\">"+data[j].phoneName+"</a></p>\n";
						}
					}else{
						if(data[j].stateInfo == "0900001"){
							inhtml += "			<p class=\"prd_tit2\">"+data[j].phoneName+"</p>\n";
						} else {
							inhtml += "			<p class=\"prd_tit2\"><a title=\""+data[j].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\">"+data[j].phoneName+"</a></p>\n";
						}
					}
					
					if(data[j].stateInfo == "0900001"){
						inhtml += "					<div class=\"prdLinkBox2\">\n";
					}else{
						inhtml += "					<div class=\"prdLinkBox3\">\n";
					}
					inhtml += "				<ul>\n";
					inhtml += "					<li><a title=\"Mais\" href=\""+THIS_PAGE_URL+"#quick_view\" onclick=\"javascript:quickview_view(event,'quickview',"+(j+1)+",'"+data[j].phoneModel+"');\">Mais</a></li>\n";
					if(data[j].stateInfo != "0900001"){
						inhtml += "					<li id=\""+data[j].phoneModel+"_t\"><a title=\"Comparar\" href=\"javascript:setCookie('"+data[j].phoneModel+"','"+data[j].miniName+"','"+data[j].xsmallImage2+"');\">Comparar</a></li>\n";
					}
					inhtml += "				</ul>\n";
					inhtml += "			</div>\n";					
					inhtml += "		</div>\n";
					inhtml += "	</li>\n";
					
					if(document.getElementById(data[j].phoneModel+"_brief") != null){
						document.getElementById(data[j].phoneModel+"_brief").innerHTML = "<a title=\"Mais\" href=\""+THIS_PAGE_URL+"#quick_view\" onclick=\"javascript:quickview_view(event,'quickview',"+(j+1)+",'"+data[j].phoneModel+"');\">Mais</a>";
						document.getElementById(data[j].phoneModel+"_compare").innerHTML = "<a title=\"Comparar\" href=\"javascript:setCookie('"+data[j].phoneModel+"','"+data[j].miniName+"','"+data[j].xsmallImage2+"');\">Comparar</a>";
					}

					
					if(data[j].ordeRing != tmpOrdering[j+1]){
						if(tmpSeriesName[j+1] == "undefined" || tmpSeriesName[j+1] == null || tmpSeriesName[j+1] == ""){
							inhtml += "</ul>\n";
						} else {
	
							inhtml += "</ul>\n";

							inhtml += "<ul class=\"phone_type mt20\"><span id=\"type\" name=\"type\" class=\"p_type\">"+tmpStr[j+1]+"</span></ul>\n";

							inhtml += "<ul class=\"prdList\">\n";
						}
					}

				}
				inhtml += "</ul>\n";
				
				if(data.length == 0){
					inhtml = "<div class=\"box_result\">";
					inhtml+= "	<strong>Lamentamos, </strong> mas não foi encontrado nenhum produto";
					inhtml+= "</div>";
				}
				
				imageViewHtml="";
				detailViewHtml="";
				
				document.getElementById("thumbnailView").innerHTML = inhtml;
				document.getElementById("imageView").innerHTML = imageViewHtml;
				document.getElementById("detailView").innerHTML = detailViewHtml;			
				
				var iconGbn = document.getElementById("viewGbn").value;				
				viewIconChange(iconGbn);
				
				var chkLen = document.getElementsByName("chkQuick").length;				
				for(var i = 0; i < chkLen ; i++){
					document.getElementsByName("chkQuick")[i].disabled = false;
				}
				var chkAdvanceLen = document.getElementsByName("chkAdvance").length;				
				for(var i = 0; i < chkAdvanceLen ; i++){
					document.getElementsByName("chkAdvance")[i].disabled = false;
				}
				
				document.getElementById("sort").disabled = false;
				
				compareSetting();
			}
			}
		);
		
	}catch(e){
		alert(PPP);
	}	
}

function funClear(){
	var chkLen = document.getElementsByName("chkQuick").length;				
	for(var i = 0; i < chkLen ; i++){
		document.getElementsByName("chkQuick")[i].disabled = true;
		document.getElementsByName("chkQuick")[i].checked = false;
	}
	
	funQuickSearch();	
}



function compareSetting(){	

	if(getCookie("phoneCompare") != null && getCookie("phoneCompare") != ""){			
		var rowCookie = getCookie("phoneCompare").split("^");						
		var colCookie;
		for(var i=0; i < rowCookie.length; i++){
			colCookie = rowCookie[i].split("|");				
			addCompare(colCookie[0],colCookie[1],colCookie[2]);
			
			//document.getElementById("compare"+(i+1)).value=replace(colCookie[1],"Samsung ","");
			//document.getElementById("compare"+(i+1)).value=colCookie[1];
			document.getElementById("compareWidth"+(i+1)).style.width = (colCookie[1].length*8.5)+"px";
			document.getElementById("compare"+(i+1)).innerHTML = changeTxt(null,colCookie[1]);
		}
	}
}

function funPhoneSort(){
	var sort = document.getElementById("sort").value;
	if(sort != ""){		
		funQuickSearch();
	}
}

function funPhoneCommonSearch(){	
	funQuickSearch();
}

var phoneComboHtml="";

function funCompareResult(){	
	funPhoneComboHtml();
	document.getElementById("phoneSearchPage").style.display = "none";
	document.getElementById("phoneComparePage").style.display = "";
	document.getElementById("compPhone").style.display = "";
	
	var spCompHead1 = "<select id=\"comparePhone1\" name=\"comparePhone1\" style=\"width:150px\" OnChange=\"javascript:funCompareOnChange(this)\">\n<option value=\"\">Comparar more</option>\n";
	var spCompHead2 = "<select id=\"comparePhone2\" name=\"comparePhone2\" style=\"width:150px\" OnChange=\"javascript:funCompareOnChange(this)\">\n<option value=\"\">Comparar more</option>\n";
	var spCompHead3 = "<select id=\"comparePhone3\" name=\"comparePhone3\" style=\"width:150px\" OnChange=\"javascript:funCompareOnChange(this)\">\n<option value=\"\">Comparar more</option>\n";
	var spCompTail = "</select>\n";
	
	document.getElementById("spComparePhone1").innerHTML = spCompHead1+phoneComboHtml+spCompTail;
	document.getElementById("spComparePhone2").innerHTML = spCompHead2+phoneComboHtml+spCompTail;
	document.getElementById("spComparePhone3").innerHTML = spCompHead3+phoneComboHtml+spCompTail;
	
	if(getCookie("phoneCompare") != null && getCookie("phoneCompare") != ""){						
		var rowCookie = getCookie("phoneCompare").split("^");			
		var colCookie;
		
		var comparePhoneText = rowCookie.length;
		document.getElementById("compareSize").innerHTML = comparePhoneText;
		
		for(var i = 0 ; i < rowCookie.length; i++){
			colCookie = rowCookie[i].split('|');
						
			document.getElementById("comparePhone"+(i+1)).value = colCookie[0];
		}
	}else{
		document.getElementById("compareSize").innerHTML = "0";
	}
	
	document.getElementById("nowPage").innerHTML = "Comparar";
	funSpecListSearch();
}

function funCompareOnChange(selectObj){	
	var selecObjId = selectObj.id;
		
	var j = 0;
	for(var i = 1; i< 4; i++){
		if(document.getElementById("comparePhone"+i).options[document.getElementById("comparePhone"+i).selectedIndex].value != ""){	
			j++;
		}
	}
	document.getElementById("compareSize").innerHTML = j;
	
	funSpecListSearch(selecObjId);
}

function funSpecListSearch(selecObjId){	
	var resetNum;
	
	if(selecObjId == "comparePhone1"){
		resetNum = 1;
	}else if(selecObjId == "comparePhone2"){
		resetNum = 2;
	}else if(selecObjId == "comparePhone3"){
		resetNum = 3;
	}
	
	var spCompTail = "</select>\n";
	
	var compTemp = "";
	
	for(var i = 1 ; i < 3; i++){
		compTemp = document.getElementById("comparePhone"+i).value
		
		if(compTemp == ""){
			continue;
		}
		
		for(var j = i+1; j<4; j++){
			if(compTemp == "" && document.getElementById("comparePhone"+j).value == ""){
				break;
			}
			
			if(compTemp == document.getElementById("comparePhone"+j).value){				
				document.getElementById("spComparePhone"+resetNum).innerHTML = "<select id=\"comparePhone"+resetNum+"\" name=\"comparePhone"+resetNum+"\" style=\"width:150px\" OnChange=\"javascript:funCompareOnChange(this)\">\n<option value=\"\">Comparar more</option>\n"+phoneComboHtml+spCompTail;								
				
				document.getElementById("compPhoneImg"+resetNum).innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
				document.getElementById("compPhoneModel"+resetNum).innerHTML = "";
				document.getElementById("compPhoneFeature"+resetNum).innerHTML = "";	
				document.getElementById("compPhoneQuickSpec"+resetNum).innerHTML = "";	
				
				new Selectbox('comparePhone'+resetNum);
				
				var strComp = "";
				
				switch(resetNum){
					case (1) :
						strComp = "A";
						break;				
					case (2) :
						strComp = "B";
						break;				
					case (3) :
						strComp = "C";
						break;								
				}
				
				for(var k = 0;; k++){					
					if(document.getElementById("compareCon"+strComp+k) == null){
						break;
					}
					document.getElementById("compareCon"+strComp+k).innerHTML = "";
				}
				
				var cookieVal="";
				for(var l = 1; l < 4; l++){
					if(cookieVal == ""){
						cookieVal += document.getElementById("comparePhone"+l).value;
					}else{
						cookieVal += "|"+document.getElementById("comparePhone"+l).value;
					}
				}
				
				delPhoneModelCookie(cookieVal);
				
				alert(P01);
				return;
			}
		}
	}
	
	var phoneModel1 = document.getElementById("comparePhone1").value;
	var phoneModel2 = document.getElementById("comparePhone2").value;
	var phoneModel3 = document.getElementById("comparePhone3").value;
	
	
	document.getElementById("expandViewWrap").innerHTML = "Carregando...";
	//document.getElementById("expandViewTab").innerHTML = "";
	
	ProductsDwrAction.selectGSfcSpecList({
				phoneModel1:phoneModel1
			   ,phoneModel2:phoneModel2
			   ,phoneModel3:phoneModel3
			},
			function funSpecSearch(data){
				var phone1 = data["phone1"];				
				var phone2 = data["phone2"];
				var phone3 = data["phone3"];
				
				var phoneSpec1 = data["phoneSpec1"];
				var phoneSpec2 = data["phoneSpec2"];
				var phoneSpec3 = data["phoneSpec3"];
				
				var copNum;
				
				if( phoneSpec1 != "" ){
					compNum = 1;
					var phone_url = "samsung-"+phoneSpec1[0].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
					
					if(phoneSpec1[0].smallImage == ""){
						if(phoneSpec1[0].stateInfo == "0900001"){
							document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
						}else{
							document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" /></a>";
						}
					}else{
						if(phoneSpec1[0].stateInfo == "0900001"){
							
							if(phoneSpec1[0].smallImage.substring(0,4) != 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\""+phoneSpec1[0].smallImage+"\" width=\"120\" height=\"120\" alt=\"\" />";
							}
							if(phoneSpec1[0].smallImage.substring(0,4) == 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\""+phoneSpec1[0].smallImage+"\" width=\"120\" height=\"120\" alt=\"\" />";
							}						
						}else{
							if(phoneSpec1[0].smallImage.substring(0,4) != 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\""+phoneSpec1[0].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneSpec1[0].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneSpec1[0].phoneName+"\" /></a>";
							}
							if(phoneSpec1[0].smallImage.substring(0,4) == 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\""+phoneSpec1[0].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneSpec1[0].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneSpec1[0].phoneName+"\" /></a>";
							}							
						}						
					}
					document.getElementById("compPhoneModel"+compNum).innerHTML = phoneSpec1[0].phoneName;
					
					var featureHtml = "";
					if(phoneSpec1[0].features1 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec1[0].features1,22)+"</li>\n";
					}
					
					if(phoneSpec1[0].features2 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec1[0].features2,22)+"</li>\n";
					}
					
					if(phoneSpec1[0].features3 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec1[0].features3,22)+"</li>\n";
					}
					
					if(phoneSpec1[0].features4 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec1[0].features4,22)+"</li>\n";
					}
					
					if(phoneSpec1[0].features5 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec1[0].features5,22)+"</li>\n";
					}
					
					if(phoneSpec1[0].features6 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec1[0].features6,22)+"</li>\n";
					}
					
					document.getElementById("compPhoneFeature"+compNum).innerHTML = featureHtml;
					
					var quickSpecHtml = "";
					
					for(var j=1 ;  j<11 ; j++){
						if(eval("phoneSpec1[0].quickSpecImage"+j) != " "){
						quickSpecHtml += "				<li>\n";
						
						quickSpecHtml += "					<div class=\"spec_icon\"><a onMouseOver=\"spec_balloon("+j+",'comp"+compNum+"_"+phoneSpec1[0].phoneModel+"')\" onMouseOut=\"selectHide('comp"+compNum+"_"+phoneSpec1[0].phoneModel+"_"+j+"')\">\n";

							if((eval("phoneSpec1[0].quickSpecImage"+j)).substring(0,4) == 'http') {
								quickSpecHtml += "						<img src=\""+eval("phoneSpec1[0].quickSpecImage"+j)+"\" alt=\"\"></a>\n";
							} else { 
								quickSpecHtml += "						<img src=\""+PUB_LOCAL+""+QUICKSPEC_SAVE_PATH+""+eval("phoneSpec1[0].quickSpecImage"+j)+"\" alt=\"\"></a>\n";
							}	
															
						quickSpecHtml += "					</div>\n";
						
						quickSpecHtml += "					<div class=\"spec_balloon_h"+j+" spec_balloon\" id=\"comp"+compNum+"_"+phoneSpec1[0].phoneModel+"_"+j+"\">\n";
						
							quickSpecHtml += "						<div class=\"spec_balloon_con\">"+eval("phoneSpec1[0].quickSpecDesc"+j)+"</div>\n";						
						
						quickSpecHtml += "					</div>\n";
						
						quickSpecHtml += "				</li>\n";
						}
					}	
		
					document.getElementById("compPhoneQuickSpec"+compNum).innerHTML = quickSpecHtml;
				}else{
					document.getElementById("compPhoneImg1").innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
					document.getElementById("compPhoneModel1").innerHTML = "";
					document.getElementById("compPhoneFeature1").innerHTML = "";
					document.getElementById("compPhoneQuickSpec1").innerHTML = "";
				}
				
				if( phoneSpec2 != "" ){
					compNum = 2;
					var phone_url = "samsung-"+phoneSpec2[0].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
					
					if(phoneSpec2[0].smallImage == ""){	
						if(phoneSpec2[0].stateInfo == "0900001"){	
							document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
						}else{
							document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" /></a>";
						}
					}else{
						if(phoneSpec2[0].stateInfo == "0900001"){
							if(phoneSpec2[0].smallImage.substring(0,4) != 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\""+phoneSpec2[0].smallImage+"\" width=\"120\" height=\"120\" alt=\"\" />";
							}
							if(phoneSpec2[0].smallImage.substring(0,4) == 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\""+phoneSpec2[0].smallImage+"\" width=\"120\" height=\"120\" alt=\"\" />";
							}						
						}else{
							if(phoneSpec2[0].smallImage.substring(0,4) != 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\""+phoneSpec2[0].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneSpec2[0].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneSpec2[0].phoneName+"\" /></a>";
							}
							if(phoneSpec2[0].smallImage.substring(0,4) == 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\""+phoneSpec2[0].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneSpec2[0].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneSpec2[0].phoneName+"\" /></a>";
							}
						}							
					}
					document.getElementById("compPhoneModel"+compNum).innerHTML = phoneSpec2[0].phoneName;
					
					var featureHtml = "";
					if(phoneSpec2[0].features1 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec2[0].features1,22)+"</li>\n";
					}
					
					if(phoneSpec2[0].features2 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec2[0].features2,22)+"</li>\n";
					}
					
					if(phoneSpec2[0].features3 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec2[0].features3,22)+"</li>\n";
					}
					
					if(phoneSpec2[0].features4 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec2[0].features4,22)+"</li>\n";
					}
					
					if(phoneSpec2[0].features5 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec2[0].features5,22)+"</li>\n";
					}
					
					if(phoneSpec2[0].features6 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec2[0].features6,22)+"</li>\n";
					}
					
					document.getElementById("compPhoneFeature"+compNum).innerHTML = featureHtml;
					
					var quickSpecHtml = "";
					for(var j=1 ;  j<11 ; j++){
						if(eval("phoneSpec2[0].quickSpecImage"+j) != " "){
						quickSpecHtml += "				<li>\n";
						
						quickSpecHtml += "					<div class=\"spec_icon\"><a onMouseOver=\"spec_balloon("+j+",'comp"+compNum+"_"+phoneSpec2[0].phoneModel+"')\" onMouseOut=\"selectHide('comp"+compNum+"_"+phoneSpec2[0].phoneModel+"_"+j+"')\">\n";
						
							if((eval("phoneSpec2[0].quickSpecImage"+j)).substring(0,4) == 'http') {
								quickSpecHtml += "						<img src=\""+eval("phoneSpec2[0].quickSpecImage"+j)+"\" alt=\"\"></a>\n";
							} else { 
								quickSpecHtml += "						<img src=\""+PUB_LOCAL+""+QUICKSPEC_SAVE_PATH+""+eval("phoneSpec2[0].quickSpecImage"+j)+"\" alt=\"\"></a>\n";
							}	
															
						quickSpecHtml += "					</div>\n";
						
						quickSpecHtml += "					<div class=\"spec_balloon_h"+j+" spec_balloon\" id=\"comp"+compNum+"_"+phoneSpec2[0].phoneModel+"_"+j+"\">\n";
						
							quickSpecHtml += "						<div class=\"spec_balloon_con\">"+eval("phoneSpec2[0].quickSpecDesc"+j)+"</div>\n";						
						
						quickSpecHtml += "					</div>\n";
						
						quickSpecHtml += "				</li>\n";
						}
					}
					
					document.getElementById("compPhoneQuickSpec"+compNum).innerHTML = quickSpecHtml;
				}else{
					document.getElementById("compPhoneImg2").innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
					document.getElementById("compPhoneModel2").innerHTML = "";
					document.getElementById("compPhoneFeature2").innerHTML = "";
					document.getElementById("compPhoneQuickSpec2").innerHTML = "";
				}
				
				if( phoneSpec3 != "" ){
					compNum = 3;
					var phone_url = "samsung-"+phoneSpec3[0].phoneName.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s/g,'-').replace(/samsung-|sgh-|sch-|gt-|sph-/g,'') + ((kindparam) ? "?kind=" + kindparam : "");
					
					if(phoneSpec3[0].smallImage == ""){	
						if(phoneSpec3[0].stateInfo == "0900001"){
							document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
						}else{
							document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" /></a>";
						}
					}else{
						if(phoneSpec3[0].stateInfo == "0900001"){
							if(phoneSpec3[0].smallImage.substring(0,4) != 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\""+phoneSpec3[0].smallImage+"\" width=\"120\" height=\"120\" alt=\"\" />";
							}
							if(phoneSpec3[0].smallImage.substring(0,4) == 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<img src=\""+phoneSpec3[0].smallImage+"\" width=\"120\" height=\"120\" alt=\"\" />";
							}						
						}else{
							if(phoneSpec3[0].smallImage.substring(0,4) != 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\""+phoneSpec3[0].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneSpec3[0].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneSpec3[0].phoneName+"\" /></a>";
							}
							if(phoneSpec3[0].smallImage.substring(0,4) == 'http'){
								document.getElementById("compPhoneImg"+compNum).innerHTML = "<a title=\""+phoneSpec3[0].phoneName+"\" href=\""+URL_ROOT+"telemoveis/"+phone_url+"\"><img src=\""+phoneSpec3[0].smallImage+"\" width=\"120\" height=\"120\" alt=\""+phoneSpec3[0].phoneName+"\" /></a>";
							}							
						}						
					}
					document.getElementById("compPhoneModel"+compNum).innerHTML = phoneSpec3[0].phoneName;
					
					var featureHtml = "";
					if(phoneSpec3[0].features1 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec3[0].features1,22)+"</li>\n";
					}
					
					if(phoneSpec3[0].features2 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec3[0].features2,22)+"</li>\n";
					}
					
					if(phoneSpec3[0].features3 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec3[0].features3,22)+"</li>\n";
					}
					
					if(phoneSpec3[0].features4 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec3[0].features4,22)+"</li>\n";
					}
					
					if(phoneSpec3[0].features5 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec3[0].features5,22)+"</li>\n";
					}
					
					if(phoneSpec3[0].features6 != " "){
						featureHtml += "<li>- "+FFStrCutByteString(phoneSpec3[0].features6,22)+"</li>\n";
					}
					
					document.getElementById("compPhoneFeature"+compNum).innerHTML = featureHtml;
					
					var quickSpecHtml = "";
					for(var j=1 ;  j<11 ; j++){
						if(eval("phoneSpec3[0].quickSpecImage"+j) != " "){
						quickSpecHtml += "				<li>\n";
						
						quickSpecHtml += "					<div class=\"spec_icon\"><a onMouseOver=\"spec_balloon("+j+",'comp"+compNum+"_"+phoneSpec3[0].phoneModel+"')\" onMouseOut=\"selectHide('comp"+compNum+"_"+phoneSpec3[0].phoneModel+"_"+j+"')\">\n";

							if((eval("phoneSpec3[0].quickSpecImage"+j)).substring(0,4) == 'http') {
								quickSpecHtml += "						<img src=\""+eval("phoneSpec3[0].quickSpecImage"+j)+"\" alt=\"\"></a>\n";
							} else {
								quickSpecHtml += "						<img src=\""+PUB_LOCAL+""+QUICKSPEC_SAVE_PATH+""+eval("phoneSpec3[0].quickSpecImage"+j)+"\" alt=\"\"></a>\n";
							}	
															
						quickSpecHtml += "					</div>\n";
						
						quickSpecHtml += "					<div class=\"spec_balloon_h"+j+" spec_balloon\" id=\"comp"+compNum+"_"+phoneSpec3[0].phoneModel+"_"+j+"\">\n";
						
							quickSpecHtml += "						<div class=\"spec_balloon_con\">"+eval("phoneSpec3[0].quickSpecDesc"+j)+"</div>\n";						
						
						quickSpecHtml += "					</div>\n";
						
						quickSpecHtml += "				</li>\n";
						}
					}
					
					document.getElementById("compPhoneQuickSpec"+compNum).innerHTML = quickSpecHtml;
				}else{
					document.getElementById("compPhoneImg3").innerHTML = "<img src=\"/image/products/images_blank.gif\" width=\"120\" height=\"120\" alt=\"\" />";
					document.getElementById("compPhoneModel3").innerHTML = "";
					document.getElementById("compPhoneFeature3").innerHTML = "";
					document.getElementById("compPhoneQuickSpec3").innerHTML = "";
				}
				 
				// start -----------------------2008.05.02--------------------------- 
				
				var inhtml = "";
				var inhtml2 = "";
				var j = 0;
				var k = 0;
				var t = 0;
				var totalCnt = phone1.length;
				var isSpecDisplay
				
				for(var i = 0; i < phone1.length ; i++){
					//mits=15,Car Solution - Classification=16, Car Solution - Brand=17
					if(phone1[i].specSeqNo!="15"&&phone1[i].specSeqNo!="16"&&phone1[i].specSeqNo!="17"){
					
						if(phone1[i].specLevel == 1){
							isSpecDisplay = false;
							j++;					
							inhtml += "<dt>\n";
							inhtml += "	<span class=\"leftA\"><a title=\"\" href=javascript:expandView('expandView_"+j+"','btnView_"+j+"');><img src=\""+NAS_ROOT_PUB_MASTER+""+PHONESPEC_SAVE_PATH+""+phone1[i].imagePath+"\" alt=\"\" class=\"ico\" width=\"28\" height=\"28\">"+phone1[i].specName+"</a></span>\n";
							inhtml += "	<img src=\"/image/common/btn_conOpen.gif\" alt=\"\" id=\"btnView_"+j+"\" class=\"rightA hand\" onClick=\"expandView('expandView_"+j+"',this.getAttribute('id'));\">\n";
							inhtml += "</dt>\n";
							inhtml += "<dd id=\"expandView_"+j+"\">\n";
						}
							
						if(phone1[i].specLevel == 2){	
							if(phone1[i].specCaption!="" || phone2[i].specCaption!="" || phone3[i].specCaption){
								if(phone1[i].specYn=="true"){
									isSpecDisplay = true;
									inhtml += "	<ul class=\"dotList\">\n";
									inhtml += "		<li>\n";
									inhtml += "		<p class=\"compareTit\">"+phone1[i].specName+"</p>\n";
									inhtml += "		<p id=\"compareConA"+k+"\" class=\"compareConA\">"+phone1[i].specCaption+"</p>\n";
									inhtml += "		<p id=\"compareConB"+k+"\" class=\"compareConB\">"+phone2[i].specCaption+"</p>\n";							
									inhtml += "		<p id=\"compareConC"+k+"\" class=\"compareConC\">"+phone3[i].specCaption+"</p>\n";
									inhtml += "		</li>\n";
									inhtml += "	</ul>\n";	
								}
							}
						}
						
						if(i+1 < totalCnt && phone1[i+1].specLevel==1){
							inhtml += "</dd>\n";
							if(isSpecDisplay){
								inhtml2 = inhtml2 + inhtml;
							}
							inhtml = "";
						}							
					}
				}
				
				// end -----------------------2008.05.02---------------------------
				
				document.getElementById("expandViewWrap").innerHTML = inhtml2;
				//document.getElementById("expandViewTab").innerHTML = "<img src=\"/image/common/btn_allExpand.gif\" alt=\"Expandir todos\" id=\"btn_Expand\" class=\"hand\" onClick=\"expandAll(this.getAttribute('alt'))\">";
				
				for(var i = 1 ; i < 4; i++){
					document.getElementById("comparePhone"+i).disabled = false;
				}
				
				var chkLen = document.getElementsByName("chkQuick").length;				
				for(var i = 0; i < chkLen ; i++){
					document.getElementsByName("chkQuick")[i].disabled = false;
				}
				
				delAllCompare();
				
				if( phoneSpec1 != "" ){
					setCookie(phoneSpec1[0].phoneModel,phoneSpec1[0].miniName,phoneSpec1[0].xsmallImage2);
				}
				
				if( phoneSpec2 != "" ){
					setCookie(phoneSpec2[0].phoneModel,phoneSpec2[0].miniName,phoneSpec2[0].xsmallImage2);
				}
				
				if( phoneSpec3 != "" ){
					setCookie(phoneSpec3[0].phoneModel,phoneSpec3[0].miniName,phoneSpec3[0].xsmallImage2);
				}
				
				expandAll(document.getElementById("expandGbn").value);
				selectHide('laypop_compare');				
			}
	);
}

function funPhoneComboHtml(){
	var xmlhttp;	
	xmlhttp=null;
	
	strURL = "/ajax/ajaxcombolist.do";
	if (window.XMLHttpRequest)
	  {// code for IE7, Firefox, Opera, etc.
	  xmlhttp=new XMLHttpRequest();
	  }
	else if (window.ActiveXObject)
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	if (xmlhttp!=null)
	  {
	  xmlhttp.open("GET",strURL,false);
	  xmlhttp.send(null);
	  phoneComboHtml = xmlhttp.responseText;
	  }
	else
	  {
	  alert("Your browser does not support XMLHTTP.");
	  }
}

//phone search combo
function selectSeries() {
	var siteCd = LANG;
	var langCd = LANG_CD;
	var seriesSeqNo = document.getElementById("seriesSeqNo");
	var selectSeriesSeqNo = seriesSeqNo.value;
	var seriesPhoneModel = document.getElementById("seriesPhoneModel");

	var gSfcPrdSeries;
	gSfcPrdSeries = {siteCd:siteCd, langCd:langCd, seriesSeqNo:selectSeriesSeqNo};
	SeriesPrdActionDWR.selectGSfcPrdSeriesListDWR(
			gSfcPrdSeries,
			function selectPhoneModelSelect(data){    
		        
		        var phoneModelSelect = "<select id=\"seriesPhoneModel\" name=\"seriesPhoneModel\" style=\"width:163px\" onchange=\"javascript:selectSeriesPhoneModel();\">";
			        phoneModelSelect += "<option value=\"\">Phone Names</option>";
				
				for(var i=0; i < data.length; i++) {					
			        phoneModelSelect += "<option value=\""+data[i].phoneName+"\">"+data[i].phoneName+"</option>";
				}
			
					phoneModelSelect += "</select>";
					
				document.getElementById("selectPhoneModel").innerHTML = phoneModelSelect;
				
				new Selectbox('seriesPhoneModel');
			}			 
		);
}

function selectPhoneList(){
	if(document.getElementById("seriesPhoneModel").value == '1' || document.getElementById("seriesPhoneModel").value == ''){
		return;
	} else {
		selectSeriesPhoneModel();
	}
}

function selectHide2(Name){
	self.clearTimeout(setTime);
	
	selectObj = document.getElementById(Name);
	selectObj.style.display='none';
}