var URLPREFIX='http://www.skyhgc.com/';
var URLPREFIXIMAGE='http://www.skyhgc.com/img/';
var URLPREFIXCART='https://www.skyhgc.com/';
/*function tabHoverChange(tab, bg_color, font_color){
	
	document.getElementById(tab).style.background = bg_color;
	document.getElementById(tab).style.color = font_color;
}*/

function test(imageObj){
	//alert(imageObj);
}

var xmlhttp= getHTTPObject();

//Create xmlHttpRequest object
function getHTTPObject() 
{ 		
	if (typeof XMLHttpRequest != 'undefined') 
    { 
	    //alert("undefined");
    	return new XMLHttpRequest();     	    	
    }
         
    try 
    { 
	    //alert("Msxml2");
    	return new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    catch (e) 
    { 
    	try 
    	{ 
	    	//alert("Microsoft");
        	return new ActiveXObject("Microsoft.XMLHTTP"); 
    	} catch (e) {} 
 	}
    //alert("No xml Http object");
    return false; 
    
}

/**
*Display the Image in Hovering Div (Order History page)
*/
function getDisplayImage(imageObj, type){
	var indexAry = new Array();
	var changeCaption = "caption";
	indexAry = imageObj.name.split('n');
	
	if(type == 1){
		var itemId = document.getElementById("item"+indexAry[1]).value;
	}else{
		var itemId = document.getElementById("PTitem"+indexAry[1]).value;
		changeCaption = "PTcaption";
	}
	
	document.getElementById('imageDisplay').src= URLPREFIXCART+'view.orderimage.'+itemId;

	changeDisplayStyle("show", document.getElementById(changeCaption+indexAry[1]));
}


var origCaptionBG = "";
function changeDisplayStyle(type, itemCaption){
	var tbAlt = document.getElementById('displayDiv');	
	
	if(type == "show"){
		tbAlt.style.visibility = "visible";
		tbAlt.style.display = "inline";
		tbAlt.style.left = document.body.scrollLeft+(document.body.clientWidth/6);
		tbAlt.style.top = document.body.scrollTop+(document.body.clientHeight/6);	
		if(itemCaption != " " && itemCaption != null){			
			itemCaption.style.color = "333333";
			itemCaption.style.fontWeight = "bold";
			itemCaption.style.cursor = "hand";	
		}
	}else{		
		tbAlt.style.visibility = "hidden";
		tbAlt.style.display = "none";				
		document.getElementById('imageDisplay').src= defaultImage;	
		if(itemCaption != " "){
	 		document.getElementById(itemCaption).style.color = "666666";
	 		//document.getElementById(itemCaption).style.fontWeight = "normal";
	 		document.getElementById(itemCaption).style.cursor = "pointer";
 		}
		
	}		
}

function changeXY(intLargeHeight){
	var adjustHeight =0;
	
	var cellWidth;


	if (IE){
		cellWidth = 135;
		document.getElementById('photoDiv').style.left = (document.body.clientWidth-770)/2+cellWidth;	

		if (document.body.clientHeight-(currentY- document.body.scrollTop)<intLargeHeight){
			adjustHeight= document.body.scrollTop+(document.body.clientHeight-intLargeHeight)-10;
		}
		else if (currentY-document.body.scrollTop<(intLargeHeight/2)){
//			document.getElementById('currentLargeImage').innerHTML='X:'+currentX+' Y:'+(currentY-document.body.scrollTop);
			adjustHeight= document.body.scrollTop + 10;
		}
		else{
			adjustHeight= currentY;
		}
			
		document.getElementById('photoDiv').style.top = adjustHeight;
	
	}
	else{
		cellWidth = 130;
		document.getElementById('photoDiv').style.left = (window.innerWidth -770)/2+cellWidth;
	//	document.getElementById('currentLargeImage').innerHTML='inner:'+window.innerHeight+' current:'+currentY+' Yoffset:'+window.pageYOffset;
		if (window.innerHeight-(currentY- window.pageYOffset)<intLargeHeight){
			adjustHeight= document.body.scrollTop+(window.innerHeight-intLargeHeight)-10;
		}
		else if (currentY-window.pageYOffset<(intLargeHeight/2)){
//			document.getElementById('currentLargeImage').innerHTML='X:'+currentX+' Y:'+(currentY-document.body.scrollTop);
			adjustHeight= document.body.scrollTop + 10;
		}		
		else{
			adjustHeight= currentY;
		}
		
		document.getElementById('photoDiv').style.top = adjustHeight;
		
	}

//	document.getElementById('currentLargeImage').innerHTML='X:'+currentX+' Y:'+currentY;


}

function funHideLargeImage(){
	document.getElementById('photoDiv').style.cursor='default';
	document.getElementById('photoDiv').style.display='none';
}


var currentX,currentY;
var IE = document.all?true:false;
if (!IE) {
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = getMouseXY;



function getMouseXY(e){

	
	
  if (IE) { 
    currentX = event.clientX + document.body.scrollLeft;
    currentY = event.clientY + document.body.scrollTop;

  } else {  
    currentX = e.pageX;
    currentY = e.pageY;
  }
	(currentX<0)?0:currentX;
    (currentY<0)?0:currentY;

}


