function openInNewWindow(url){
    if(url.indexOf(".pdf") > -1 || url.indexOf(".PDF") > -1){
    	window.open(url,target='newwindow','resizable=1,width=700,height=500');
    }else{
    	var link = "/araccessories/jsps/includes/araccessories_largeimage.jsp?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 LTrim( value ) {
   	
    	var re = /\s*((\S+\s*)*)/;
     	return value.replace(re, "$1");
     	
     }
     
   // Removes ending whitespaces
   function RTrim( value ) {
    	
    	var re = /((\s*\S+)*)\s*/;
    	return value.replace(re, "$1");
    	
    }
    
    // Removes leading and ending whitespaces
   function trim( value ) {
    	
    	return LTrim(RTrim(value));
    	
    }
function validate_search(search){
	search=trim(search);
	if(search == null || search == ""){
		alert("Enter a SKU/Model number...");
		
		
		return false;
	} else{
		return true;
	}
	
}

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 pngfix()
{
//alert("pngfix called");
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (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();
}