function openInNewWindow(url){
    if(url.indexOf(".pdf") > -1 || url.indexOf(".PDF") > -1){
    	window.open(url,target='newwindow','resizable=1,width=700,height=500');
    }
}

function openInNewWindow1(url,root){
    if(url.indexOf(".pdf") > -1 || url.indexOf(".PDF") > -1){
    	window.open(url,target='newwindow','resizable=1,width=700,height=500');
    }else{
    	//var link =root+ "/jsps/includes/araccessories_largeimage.jsp?ImgName="+url;
    	var link =root+"/largeimage?ImgName="+url;
	window.open(link,target='newwindow','width=550','height=550', 'resizable=false');
	}
}
function openVideoInNewWindow(url){
	window.open(url,target="newwindow" ,'width=350,height=310');
}
function openbluetoothVideoInNewWindow(url){
	 window.open(url,target="newwindow",'width=450,height=248');
	
}
function openwirelessVideoInNewWindow(url){
	window.open(url,target="newwindow",'width=600,height=540');
}
function openInExternalWindow(url){
	window.open(url,target="newwindow");
}
function openInExternalWindowsmallpopup(url){
	window.open(url,target='newwindow','width=800,height=600');
}
function openInSameWindow(url){
	window.open(url,target="_self");
}




function validate_search(search){
	if(search == null || trim(search) == ""  || search == ""   || search == "Find a Product"){
		alert("Please Enter a valid keyword !");
		
		
		return false;
	} else{
		return true;
	}
	
}
function validate_manual(manual){
	if(manual == null ||  trim(manual) == "" ||manual == "" || manual=="Find A Manual"){
		alert("Enter Valid Model number");
		
		
		return false;
	} else{
		return true;
	}
	
}
		function remName(a, b){
		if(a.value==b){
		a.value='';
		}else if(a.value==''){
		a.value=b;
		}else{
		a.value=a.value;
		}
		}
		 
		function chkName(a, b){
		if(a.value==''){
		a.value=b;
		}else{
		a.value=a.value;
		}
		}

function change_img(path){
alert("method called");
myImage = new Image() ;
myImage.src =path;
alert(document["main"]);
alert(myImage.src);
document.getElementById("main").src=myImage.src;
//document["main"].src=path;
pngfix();
}

function remName(a) {
var b = document.getElementById('searchbox').value;
	if (a.value == b) {
		a.value = "";
	} else {
		if (a.value == "") {
			a.value = b;
		} else {
			a.value = a.value;
		}
	}
}
function chkName(a) {
var b = document.getElementById('searchbox').value;
	if (a.value == "") {
		a.value = b;
	} else {
		a.value = a.value;
	}
}
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function pngfix()
{
//alert("pngfix called");
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version <= 7) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
        
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
        
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
        
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML;
         i = i-1
      }
   }
}
}
function fillimage(image,path)
{
var newimage = "<img src='"+path+"' style='border:none'  width='300' height='300' />";
	document.getElementById("main").innerHTML = newimage;
	pngfix();
}
