
function email_friend_url(directory)
{
var itemid = "";
var path = "../";

if (directory == 2) {path = ''}

//document.write (itemid);
// Create variable is_input to see if there is a ? in the url
var is_input = document.URL.indexOf('=');

// Check the position of the ? in the url
if (is_input != -1)
{ 
// Create variable from ? in the url to the end of the string
addr_str = document.URL.substring(is_input+1, document.URL.length);


// Loop through the url and write out values found
// or a line break to seperate values by the &
for (count = 0; count < addr_str.length; count++) 
{

if (addr_str.charAt(count) == "&") 
// Write a line break for each & found
{document.write ("<br>");}

else 
// Write the part of the url 
{
//document.write(addr_str.charAt(count));
itemid = itemid + (addr_str.charAt(count));

}

}}

// If there is no ? in the url state no values found
else
{

}
//var itemlen = itemid.length;
//if (itemlen != 0){

//alert(path);

var newwin = path + 'email_friend.cfm?item_id=' + document.URL;
window.open(newwin,'MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=680,height=410,left=50,top=0');
//}
//else
//alert('Please choose item to email!');


}


