var view_enlarged_url;
var email_to_friend_url;
var add_to_favorites_url;

var view_enlarged_window;
var email_to_friend_window;
var add_to_favorites_window;

function openViewEnlargedWindow(zidProductId, intWidth500, intHeight500, blnPrivate)
{
	view_enlarged_url = strPopupDirUrl + 'view_enlarged.asp' + '?product_id=' + zidProductId + '&width=' + intWidth500 + '&height=' + (parseInt(intHeight500) + 43);
	view_enlarged_url = view_enlarged_url + '&side=' + 'front';
	if (blnPrivate) {
		view_enlarged_url = view_enlarged_url + '&private=' + 'true';
	}
	view_enlarged_window = window.open(view_enlarged_url,'view_enlarged_window', 'top='+((screen.availHeight - intHeight500 - 43) / 2)+',left='+((screen.availWidth - intWidth500) / 2)+'+,resizable=yes,status=no,scrollbars=no,location=no,toolbar=no,directories=no,menubar=no,width=' + intWidth500 + ',innerWidth=' + intWidth500 + ',height=' + (intHeight500 + 43) + ',innerHeight=' + (intHeight500 + 43));
	view_enlarged_window.focus();
}

function OpenEmailToFriendWindow(strType, zidProductId, uidDesignId, strSide, strStyle, strColor, strSize)
{
	email_to_friend_url = strRobotsPopupDirUrl + 'email_to_friend.asp' + '?type=' + strType + '&product_id=' + zidProductId;

	if (strType == 'design') {
		email_to_friend_url = email_to_friend_url + '&design_id=' + uidDesignId;
	}

	email_to_friend_url = email_to_friend_url + '&side=' + strSide;

	if ((strType == 'design') || (strType == 'realview')) {
		email_to_friend_url = email_to_friend_url + '&style=' + strStyle + '&color=' + strColor + '&size=' + strSize;
	}

	email_to_friend_window = window.open(email_to_friend_url,'email_to_friend_window', 'top='+((screen.availHeight - 550) / 2)+',left='+((screen.availWidth - 650) / 2)+'+,resizable=yes,status=no,scrollbars=no,location=no,toolbar=no,directories=no,menubar=no,width=650,innerWidth=650,height=550,innerHeight=550');
	email_to_friend_window.focus();
}

function OpenAddToFavoritesWindow(zidProductId, strStyle, strColor, strSize)
{
	add_to_favorites_url = strRobotsPopupDirUrl + 'add_to_favorites.asp';
	add_to_favorites_url = add_to_favorites_url + '?product_id=' + zidProductId;
	add_to_favorites_url = add_to_favorites_url + '&style=' + strStyle;
	add_to_favorites_url = add_to_favorites_url + '&color=' + strColor;
	add_to_favorites_url = add_to_favorites_url + '&size=' + strSize;

	add_to_favorites_window = window.open(add_to_favorites_url,'add_to_favorites_window', 'top='+((screen.availHeight - 200) / 2)+',left='+((screen.availWidth - 200) / 2)+'+,resizable=yes,status=no,scrollbars=no,location=no,toolbar=no,directories=no,menubar=no,width=200,innerWidth=200,height=200,innerHeight=200');
	add_to_favorites_window.focus();
}

function ChangePreviewImage(strImgUrl, zidProductId)
{
	if (strImgUrl != '') {
		document.getElementById(document.frmSelectImg.id.value).style.border = '2px #ffffff solid';
		if (document.images) document.preview_img.src = RlvAst(strImgUrl, 325, 'pre');
		document.getElementById(zidProductId).style.border = '2px #ff0000 solid';
		document.frmSelectImg.src.value = strImgUrl;
		document.frmSelectImg.id.value = zidProductId;
	} else {
		if (document.images) document.preview_img.src = RlvAst(document.frmSelectImg.src.value, 325, 'pre');
		document.getElementById(document.frmSelectImg.id.value).style.border = '2px #ff0000 solid';
	}
}

function GenerateGalleryProduct(zidProductId, strImgUrl)
{
	var strHtmlResult;
	var strMakeItLink;

	strMakeItLink = '/collections/robots/product.asp?product_id=' + zidProductId;

	strHtmlResult = '';
	
	strHtmlResult = strHtmlResult + '<A HREF=\"' + 'Javascript:ChangePreviewImage(\'' + strImgUrl + '\',\'' + zidProductId + '\')' + '\">';
	strHtmlResult = strHtmlResult + '<IMG SRC=\"' + RlvAst(strImgUrl, 90, 'pre') + '" WIDTH=\"77\" HEIGHT=\"90\" BORDER=\"0\" NAME=\"' + zidProductId + '\" ID=\"' + zidProductId + '\" STYLE=\"border:2px #ffffff solid;\">';
	strHtmlResult = strHtmlResult + '</A><BR>';
	
	if (document.frmSelectImg.src.value == '') {
		document.frmSelectImg.src.value = strImgUrl;
		document.frmSelectImg.id.value = zidProductId;
	}
	
	return strHtmlResult;
}
