// JavaScript Document
var xmlHttp;
var imageId = 0;
var LMode = "add";
var invoice = 0;
var iNum = 0;
var iMax = 100;
function slide_show() 
{
var form = document.slide_show_form;
document.getElementById("slide_show_image").src = file_path_array[iNum];
iNum++;
if (iNum < form.total_file_numb.value ) 
{
setTimeout(slide_show, form.timeout.value);
}
else
{
iNum = 0;
setTimeout(slide_show, form.timeout.value);
}
};
function createXMLHttpRequest() 
{
if (window.ActiveXObject) 
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) 
{
xmlHttp = new XMLHttpRequest();
}
};
function create_license_change(sel)
{
};
function handleStateChange() 
{
if(xmlHttp.readyState == 4) 
{
if(xmlHttp.status == 200) 
{
if ( xmlHttp.responseText == "MAXEXCEED" )
{
alert("You have reached the maximum number of images allowed for your lightbox");
}
else
{
if (LMode == 'add')
{
document.getElementById("vss_lightbox_image" + imageId).innerHTML = "<a href='javascript:lightbox(" + imageId + ", \"rem\")'><img src='./images/rem_lightbox.gif' border='0' title='Remove from Lightbox' alt='' valign='bottom' /></a>";					
}
else
{
document.getElementById("vss_lightbox_image" + imageId).innerHTML = "<a href='javascript:lightbox(" + imageId + ", \"add\")'><img src='./images/add_lightbox.gif' border='0' title='Add to Lightbox' alt='' valign='bottom' /></a>";
}
}
}
}
};
function global_media_type_change(sel)
{
var form = document.global_update;

if ( sel.value == "media_type" )
{
form.new_value.value = "2";
form.new_value.disabled = true;
}
else if ( sel.value == "rf" )
{
form.new_value.value = "1";
form.new_value.disabled = true;
}
else
{
form.new_value.value = "";
form.new_value.disabled = false;
}
};
function check_product_type(sel)
{
var form = document.add_cart;
id = form.id.value;

createXMLHttpRequest();
xmlHttp.onreadystatechange = handleCheckProducType;
xmlHttp.open("GET", "check_product_type.php?id=" + id + "&dbname=" + sel.value, true);
xmlHttp.send(null);
};
function handleCheckProducType()
{
if(xmlHttp.readyState == 4) 
{
if(xmlHttp.status == 200) 
{
document.getElementById("product_type_quantity").innerHTML = xmlHttp.responseText;				
}
}
};
function check_paypal_input()
{
var form = document.order_form;
if ( form.first_name.value == "" )
{
alert("Please enter first name");
return false;
}
if ( form.last_name.value == "" )
{
alert("Please enter last name");
return false;
}
if ( form.address.value == "" )
{
alert("Please enter address");
return false;
}
if ( form.city.value == "" )
{
alert("Please enter city");
return false;
}	
if ( form.state.value == "" )
{
alert("Please select state");
return false;
}
if ( form.zip.value == "" )
{
alert("Please enter zip code");
return false;
}
if ( form.country.value == "" )
{
alert("Please select country");
return false;
}
if ( form.phone.value == "" )
{
alert("Please enter phone number");
return false;
}
if ( form.email.value == "" )
{
alert("Please enter your email address");
return false;
}
if ( form.credit_number.value == "" )
{
alert("Please enter credit card number");
return false;
}
if ( form.ex_month.value == "" )
{
alert("Please enter credit card expiration month");
return false;
}
if ( form.ex_year.value == "" )
{
alert("Please enter credit card expiration year");
return false;
}
if ( form.card_code.value == "" )
{
alert("Please enter the card code");
return false;
}
if ( form.shipping_name.value == "" )
{
alert("Please enter the shipping name");
return false;
}
if ( form.shipping_address1.value == "")
{
alert("Please enter shipping address");
return false;
}
if ( form.shipping_city.value == "" )
{
alert("Please enter shipping city");
return false;
}
if ( form.shipping_state.value == "" )
{
alert("Please enter shipping state");
return false;
}
if ( form.shipping_zip.value == "" )
{
alert("Please enter shipping zip code");
return false;
}
if ( form.shipping_country.value == "" )
{
alert("Please enter shipping country");
return false;
}
if ( form.shipping_phone.value == "" )
{
alert("Please enter shipping phone" );
return false;
}
if ( form.shipping_email.value == "" )
{
alert("Please enter the shipping email" );
return false;
}
form.submit_button.disabled = true;
form.reset_button.disabled = true;
return true;
};
function check_all_boxes(value, checkbox)
{
var form = document.iptc_config;
var length = value.length;
for (var i = 0; i < form.elements.length; i++) 
{
if ( form.elements[i].type == 'checkbox' )
{
if ( form.elements[i].id.substring(0,length) == value )
{
if ( checkbox.checked == true )
{
form.elements[i].checked = true;
}
else
{
form.elements[i].checked = false;
}
}
}
}
};

function disable_credit(sel)
{
var form = document.offline_form;

if ( sel.checked )
{
form.credit_number.disabled = true;
form.ex_month.disabled = true;
form.ex_year.disabled = true;
form.card_code.disabled = true;
}
else
{
form.credit_number.disabled = false;
form.ex_month.disabled = false;
form.ex_year.disabled = false;
form.card_code.disabled = false;
}
};
function lightbox(id, mode)
{
createXMLHttpRequest();
imageId = id;
LMode = mode;
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "gen_lightbox.php?id=" + id, true);
xmlHttp.send(null);
};
function license_selection( sel )
{
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleLicenseChange;
xmlHttp.open("GET", "get_license_option_data.php?parent_id=" + sel.value, true);
xmlHttp.send(null);
};
function cal_price()
{
var form = document.price_cal;
var input = "";

for (var i = 0; i < form.elements.length; i++) 
{
if(form.elements[i].type == 'select-one' && form.elements[i].name.value != "")
{
input = input + form.elements[i].name + "=" + form.elements[i].value + "&"
}
};
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleLicensePrice;
xmlHttp.open("GET", "get_license_price.php?" + input, true);
xmlHttp.send(null);
};
function handleLicensePrice()
{
if(xmlHttp.readyState == 4) 
{
if(xmlHttp.status == 200) 
{
document.getElementById("price").innerHTML = xmlHttp.responseText;
}
}
};
function handleLicenseChange()
{
if(xmlHttp.readyState == 4) 
{
if(xmlHttp.status == 200) 
{
//get the next level id first
var level_array = new Array();
var i, j, selection, label_res, id_res;
var level_res = xmlHttp.responseXML.getElementsByTagName("value");
var clean_res = xmlHttp.responseXML.getElementsByTagName("clean");
for ( i = 0; i < clean_res.length; i++ )
{
selection = document.getElementById("level_" + clean_res[i].firstChild.nodeValue);
selection.options.length = 0;
selection.options[0] = new Option("N/A", "", false, false );
}
for ( i = 0; i < level_res.length; i++ )
{
level_array[i] = level_res[i].firstChild.nodeValue;
}
for ( i = 0; i < level_array.length; i++ )
{
selection = document.getElementById("level_" + level_array[i]);
selection.options.length = 0;
label_res = xmlHttp.responseXML.getElementsByTagName("label_" + level_array[i]);
id_res = xmlHttp.responseXML.getElementsByTagName("id_" + level_array[i]);
selection.options[0] = new Option(" - - - SELECT - - - ", "", false, false );
for( j = 0; j < label_res.length; j++) 
{
selection.options[j+1] = new Option(label_res[j].firstChild.nodeValue, id_res[j].firstChild.nodeValue, false, false);
}
}
}
}
};
function check_license_fields()
{
var form = document.price_cal;
var input = "";
var flag = true;
for (var i = 0; i < form.elements.length; i++) 
{
if(form.elements[i].type == 'select-one' && form.elements[i].value == ""  )
{
flag = false;
break;
}
};

if ( !flag )
{
alert("Please select all license options.")
};
return flag;
};
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
};
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
};
function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
};
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
};
//fill in the shipping info
function fill_shipping_info(me)
{
var form = document.offline_form;
if (me.checked)
{
form.shipping_name.value = form.name.value;
form.shipping_address1.value = form.address1.value;
form.shipping_address2.value = form.address2.value;
form.shipping_city.value = form.city.value;
form.shipping_state.value = form.state.value;
form.shipping_zip.value = form.zip.value;
form.shipping_country.value = form.country.value;
form.shipping_phone.value = form.phone.value;
}
else
{
form.shipping_name.value = "";
form.shipping_address1.value = "";
form.shipping_address2.value = "";
form.shipping_city.value = "";
form.shipping_state.value = "";
form.shipping_zip.value = "";
form.shipping_country.value = "";
form.shipping_phone.value = "";
}
};
function mail_server_change(me)
{
var form = document.config;
if ( me.value == "SMTP" )
{
form.mail_server.disabled = false;
form.mail_auth.disabled = false;
form.mail_username.disabled = false;
form.mail_password.disabled = false;
form.mail_word_wrap.disabled = false;
}
else
{
form.mail_server.disabled = true;
form.mail_auth.disabled = true;
form.mail_username.disabled = true;
form.mail_password.disabled = true;
form.mail_word_wrap.disabled = true;
}
};
function fill_shipping_concord(me)
{
var form = document.order_form;
if (me.checked)
{
form.shipping_name.value = form.first_name.value + " " + form.last_name.value;
form.shipping_address1.value = form.address.value;
form.shipping_address2.value = form.address1.value;
form.shipping_city.value = form.city.value;
form.shipping_state.value = form.state.value;
form.shipping_zip.value = form.zip.value;
form.shipping_country.value = form.country.value;
form.shipping_phone.value = form.phone.value;
form.shipping_email.value = form.email.value;
}
else
{
form.shipping_name.value = "";
form.shipping_address1.value = "";
form.shipping_address2.value = "";
form.shipping_city.value = "";
form.shipping_state.value = "";
form.shipping_zip.value = "";
form.shipping_country.value = "";
form.shipping_phone.value = "";
form.shipping_country.value = "";
form.shipping_phone.value = "";
form.shipping_email.value = "";
}
};
function update_basket(product_name, id)
{
alert(id);
}
function view_invoice()
{
var form = document.invoice_form;
Item = form.username.selectedIndex;


var file = "view_invoice.php?username=" + form.username.value + "&order_id=" +form.username.options[Item].text;
var hnwd = launchCenter(file, "VIEWREPORT", 600, 700, true, true );
};
function check_smtp()
{
var form = document.config;
if ( form.mail_type.value == "SMTP" )
{			
var file = "check_smtp.php?mail_server=" + form.mail_server.value + "&mail_auth=" + form.mail_auth.value;
file = file + "&mail_username=" + form.mail_username.value + "&mail_password=" + form.mail_password.value;
var hnwd = launchCenter(file, "VIEWREPORT", 150, 350, true, true );
}
else
{
alert("Please select SMTP Server in the Outgoing Mail Server" );
}
};
function delete_help_confirm(url)
{
var ans = confirm("Do you want to delete this help pageId?");
if ( ans )
{
window.open(url, "_top");
}
};
function print_invoice(invoice)
{
var file = "print_invoice.php?order_id=" + invoice;
var hnwd = launchCenter(file, "VIEWREPORT", 600, 700, true, true );
};
function print_admin_invoice(invoice, username)
{
var file = "view_invoice.php?order_id=" + invoice + "&username=" + username;
var hnwd = launchCenter(file, "VIEWREPORT", 600, 700, true, true );
};
function include_subcategory(me)
{
var form = document.pricing;
if ( me.checked )
{
form.start_from.value = "";
form.rows.value = "";
form.start_from.disabled = true;
form.rows.disabled = true;
}
else
{
form.start_from.disabled = false;
form.rows.disabled = false;
}
};
function view_report(print_option)
{
var form = document.report_form;
if ( print_option != 2 )
{
var file = "view_report.php?status=" + form.status.value + "&from="+form.from.value+"&to="+
form.to.value+"&print="+print_option+"&report_name="+form.report_name.value;
var hnwd = launchCenter(file, "VIEWREPORT", 600, 700, true, true );
}
else
{
var file = "export.php?status=" + form.status.value + "&from="+form.from.value+"&to="+ form.to.value +"&report_name="+form.report_name.value;
document.location.href = file;
}		
};
function send_to_friend(id)
{
var file = "refer_to_friend.php?media_id=" + id;
var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 550, false, false );
};
function send_to_friend_from_private_gallery(id)
{
var file = "refer_to_friend.php?media_id=" + id + "&private_gallery=1";
var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 550, false, false );
};
function send_lightbox(sesion)
{
var file = "send_lightbox.php?session=" + sesion;
var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 550, false, false );
};
function send_hidden_lightbox(hidden_code)
{		
var file = "send_hidden_lightbox.php?hidden_code=" + hidden_code;		
var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 550, false, false );
};
function send_private_lightbox(session)
{
var file = "send_lightbox.php?session=" + session + "&private_gallery=1";		
var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 550, false, false );
};
function send_hidden_friend(hidden_code)
{
var file = "send_hidden_gallery.php?hidden_code=" + hidden_code;
var hnwd = launchCenter(file, "SENDHIDDEN", 400, 550, false, false );
};
function close_window()
{						
window.opener.document.location.reload();
window.close();
};
function open_iptc(id)
{
var file = "iptc.php?id=" + id;
var hnwd = launchCenter(file, "IPTC", 650, 550, true, true );
};
function open_photographer_iptc(id)
{
var file = "../iptc.php?id=" + id;
var hnwd = launchCenter(file, "IPTC", 650, 450, true, true );
};
function empty_lightbox(message, url)
{
var answer = confirm(message);
if ( answer == true)
{
if ( url != "" )
{
url = url + "?pageId=2000";
window.open(url, '_top');
}
else
{
url = "index.php?pageId=2000";
window.open(url, '_top');
}
}		
};
function popup_agreement()
{
var browse = "agreement.php";
var hnwd = launchCenter(browse, "AGREEMENT", 450, 450, true, false );	
};
function photographer_agreement()
{
var browse = "photog_agreement.html";

var hnwd = launchCenter(browse, "AGREEMENT", 450, 450, true, false );
};
function get_link(category)
{
var url = "get_link.php?category="+category;
var hnwd = launchCenter(url, "POPUP", 100,400, false, false);
};
function onhelp()
{
var browse = "help.htm";
window.open(browse,'popup', 'resizable=yes,status=no,toolbar=no,scrollbars=yes,location=no,menu=no,width=900,height=700');  
};
function ccv2()
{
var browse = "card_info_pop.htm";
var hnwd = launchCenter(browse, 'popup', 620, 500, true, false);  
};
function upload_new_watermark()
{
var browse = "upload_logo.php";
var hnwd = launchCenter(browse, "LOGO", 120, 510, false );	
};
function popupBrowsewin( )
{	
var browse = "download_browse.php";
var hnwd = launchCenter(browse, "DownloadBrowse", 400, 300, false );	
};
function license_download_popup(id)
{
};
function delete_lightbox_confirm(url, name)
{
var ans = false;

ans = confirm("Do you want to delete this lightbox name and its contents from the database?");

if ( ans )
{
window.open(url,"_self");
}
};
function other_lightbox(which_dir)
{
if ( which_dir == 2 ) {		// R.W.  7-8-06  calling page is in WNP_files
var file = "../other_lightbox.php";
} else {
var file = "other_lightbox.php";
}
var opener = launchCenter(file, "OTHERLIGHTBOX", 410, 440, true, true );
};
function switch_view()
{
var form = document.other_lb;
if ( form.lightbox_name.value != "" )
{
form.mode.value = 1; //1 is view mode
form.submit();
}
};
function delete_lightbox()
{
var form = document.other_lb;
if ( form.lightbox_name.value != "" )
{
var message = "Do you want to delete lightbox '" + form.lightbox_name.value + "' and its contents?";
var answer = confirm(message);
if ( answer == true )
{
form.mode.value = 2; //2 is delete mode
form.submit();
}
}
};
function confirm_delete_seach(pageId)
{
var answer = confirm("Do you want to delete all search logs?");
if ( answer )
{
var url = "admin.php?pageId=" + pageId;
window.open(url, '_parent');
}
};
function empty_all_lightbox(pageId)
{
var answer = confirm("Do you want to delete all users' lightboxes?");
if ( answer )
{
var url = "admin.php?pageId=" + pageId;
window.open(url, '_parent');
}
};
function delete_users_shopping_cart(pageId)
{
var answer = confirm("Do you want to delete all users' shopping cart?");
if ( answer )
{
var url = "admin.php?pageId=" + pageId;
window.open(url, "_parent");
}
};
function rename_lightbox()
{
var form = document.other_lb;
if ( form.new_name.value != "" )
{
form.mode.value = 3; //3 is rename 
form.submit();
}
};
function show_icon(sel)
{
var form = document.category;
form.showIcon.src = sel.options[sel.selectedIndex].value;
};
function upload_download_image(id, name, check)
{
var file;
if ( check.checked )
{
file = "upload.php?id="+id+"&name="+name+"&act=rem";
}
else
{
file = "upload.php?id="+id+"&name="+name+"&act=add";
}
var opener = launchCenter(file, "LOGO", 120, 500, false);
};
function ftp_check()
{
var form = document.ftp_config;
var url = "ftp_check.php?hostname=" + form.hostname.value;
url = url + "&username=" + encodeURIComponent(form.username.value);
url = url + "&password=" + encodeURIComponent(form.password.value);
if ( form.ssl_server.checked )
{
url = url + "&ssl_server=1";
}
url = url + "&port_numb=" + encodeURIComponent(form.port_numb.value);
url = url + "&category_directory=" + encodeURIComponent(form.category_directory.value);
var opener = launchCenter(url, "FTP", 300, 300, true, true);
};
function ssl_click()
{
var form = document.ftp_config;
if ( form.ssl_server.checked )
{
form.port_numb.value = 991;
}
else
{
form.port_numb.value = 21;
}
};
function popup_help(pageId)
{
var url = "help.php?pageId=" + pageId;
var w = launchCenter(url, "HELP", 500, 500, false, true) 
w.focus();
};
function photographer_info()
{
var file = "photographer_info.php";
var w = launchCenter(file, "INFO", 500, 500, false, true) 
w.focus();
};
function photographer_help(pageId)
{
var url = "../help.php?section=photographer&pageId=" + pageId;
var w = launchCenter(url, "HELP", 400, 500, false, true) 
w.focus();
};
function order_status(file,mode)
{
var ans = false;
if ( mode )
{
ans = confirm("Do you want to change this order status from PENDING to COMPLETE status?");
}
else
{
ans = confirm("Do you want to change this order status from COMPLETE to PENDING status?");
}
if ( ans )
{
window.open(file, "_parent");
}
};
function send_invoice(file)
{
var asn = false;
ans = confirm("Do you want to send the invoice to the customer?");
if ( ans )
{
window.open(file, "_parent");
}
};
function reset_registration_form()
{
var form = document.registration;
form.reset();
return true;
};
function quick_view_invoice()
{		
var form = document.search_invoice;
invoice = form.invoice_number.value;
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleInvoiceSearch;
xmlHttp.open("GET", "search_invoice.php?invoice=" + invoice, true);
xmlHttp.send(null);
return false;
};
function handleInvoiceSearch()
{
if(xmlHttp.readyState == 4) 
{
if(xmlHttp.status == 200)
{
var results = xmlHttp.responseXML.getElementsByTagName("result");
var username = xmlHttp.responseXML.getElementsByTagName("username");
if ( results[0].firstChild.nodeValue == "FOUND" )
{
print_admin_invoice(invoice,username[0].firstChild.nodeValue);
}
else
{
alert(username[0].firstChild.nodeValue);
}
}
}
};
function launchCenter(url, name, height, width, resize, scrollbar) 
{
var str = "height=" + height + ",innerHeight=" + height;
if ( resize )
{
str += ",width=" + width + ",innerWidth=" + width + ",resizable=yes";
}
else
{
str += ",width=" + width + ",innerWidth=" + width;
}
if ( scrollbar )
{
str += ",scrollbars=yes";
}
if (window.screen) 
{
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = (aw - width) / 2;
var yc = (ah - height) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
}
return window.open(url, name, str);
};
function openW(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
};
function pp_image_popup(image,width,height,title) {

	image_popup = window.open("","","height=" + height + ",width=" + width + ",toolbar=no,menubar=no,scrollbars=no,resizable=no");

	var tmp = image_popup.document;
	
tmp.write("<html><head><title>" + title + "</title>");
	
tmp.write("<style type='text/css' media='screen'>");
	
tmp.write("body{ margin: 0; padding: 0; }");
	
tmp.write("p.centered { text-align: center; font-size: small; margin: 0; padding: 0; }");
tmp.write("a img { border: 0; }");
	
tmp.write("img.centered { display: block; margin-left: auto; margin-right: auto; padding: 0;}");

tmp.write("</style>");
	tmp.write("</head><body>");

tmp.write("<a href='javascript:self.close()'>");
	
tmp.write("<img class='centered' src='" + image + "' width='" + width + "' height='" + height + "' />");
	
tmp.write("</a>");
	tmp.write("</body></html>");
	
tmp.close();
	
image_popup.focus();
	
return false;
};
var ids=new Array('PurchaseBlock','ShowHide2','ShowHide3');
var PurchaseBlockFlag = 'Hide';
var PurchaseBlockExists = "True";
function hidediv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
if (document.getElementById(id) != null) {
document.getElementById(id).style.display = 'none';
}
}
else {
if (document.layers) {
document.id.display = 'none';
}
else {
document.all.id.style.display = 'none';
}
}
};
function showdiv(id) {
if (document.getElementById) {
document.getElementById(id).style.display = 'block';
}
else {
if (document.layers) {
document.id.display = 'block';
}
else {
document.all.id.style.display = 'block';
}
}
};
function showPurchaseBlock() {
PurchaseBlockFlag = 'Show';
displayPurchaseBlock();
};
function displayPurchaseBlock() {
if ((PurchaseBlockExists == 'True') && (PurchaseBlockFlag == 'Show')) {
movePurchaseBlock();
showdiv("PurchaseBlock")
}
else {
hidediv("PurchaseBlock")	
}
};
function movePurchaseBlock() {
var theTable = document.getElementById("TheImageTable");
var theBlock = document.getElementById("PurchaseBlock");
var theFooter = document.getElementById("footer");
var theWidth = theTable.offsetWidth;
var theHeight = theTable.offsetHeight;
if (theWidth > 450) {
changeClass(theBlock, "purchaseBlockPositionBelow");		
changeClass(theFooter, "footerPositionBelowPurchaseBlock");
}
else {
changeClass(theBlock, "purchaseBlockPositionRight");
changeClass(theFooter, "footerPositionNormal");
}
};
function changeClass(target, classValue) {
var pattern = new RegExp("(^| )" + classValue + "( |$)");
if (!pattern.test(target.className)) {
target.className = classValue;
}
return true;
};
function writeCookie(sName, sValue, oExpires, sPath, sDomain, bSecure) {
var sCookie = sName + "=" + encodeURIComponent(sValue);
if (oExpires) {
sCookie += "; expires=" + oExpires.toGMTString();
}
if (sPath) {
sCookie += "; path=" + sPath;
}
if (sDomain) {
sCookie += "; domain=" + sDomain;
}
if (bSecure) {
sCookie += "; secure";
}
document.cookie = sCookie;
};
function getCookie(sName) {
var sRE = "(?:; )?" + sName + "=([^;]*);?";
var oRE = new RegExp(sRE);

if (oRE.test(document.cookie)) {
return decodeURIComponent(RegExp["$1"]);
} else {
return null;
}
};
function my_send_lightbox(urlflag, session) {
if (urlflag == "WNP_files") {
var file = "../send_lightbox.php?session=" + session;
}
else {
var file = "send_lightbox.php?session=" + session;	
}
var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 500, false, false );
};

function trySendLightbox(urlflag) {
var theCookie = getCookie("PHP_VSS_SESSION");
if (theCookie != false) {
my_send_lightbox(urlflag, theCookie);
}
else {
alert("Your lightbox is empty!");
}
};
function browserCheck() {
var correctdepth=24
var correctwidth=1024
var correctheight=768
var numcolors="millions of"
if (screen.colorDepth<24) numcolors="thousands of"
if (screen.colorDepth<=8) numcolors="256"
if (screen.colorDepth<=4) numcolors="16"
if (screen.colorDepth<=2) numcolors="4"
if (screen.colorDepth<=1) numcolors="monochrome"
if (screen.width<correctwidth||screen.height<correctheight)
alert("This web site is best viewed with screen resolution of "+correctwidth+" x "+correctheight+" or above. Your current resolution is "+screen.width+" x "+screen.height+". If possible, please change the resolution of your display.")
if (screen.colorDepth<correctdepth)
alert("This web site is best viewed with a monitor that displays millions of colors. Your display is currently set to show "+numcolors+" colors. If possible, please change your display settings to millions of colors!")
var ua = navigator.userAgent.toLowerCase();
var ver = navigator.appVersion.toLowerCase();
var is_aol = ua.indexOf('aol') != -1;
var is_mac = (ua.indexOf('macintosh')!=-1 || ua.indexOf('mac_')!=-1);
var is_msie = ua.indexOf('msie');
var msie_ver = parseFloat(ver.substring(ver.indexOf('msie')+5));
if (is_aol && is_mac) {
alert("The Mac AOL browser is old and obsolete, and we no longer support it.  Please copy the URL (web address) of this page and paste it into a web page in Safari or FireFox to continue, or you will experience formatting problems.");
};
if (is_msie && msie_ver<6) {
alert("You are using an old version of Internet Explorer that we no longer support (less than Version 6), and the page formatting may look bad. You should upgrade your browser for a better experince on this site and many others. Go to www.microsoft.com/ie to update your browser, or contact your System Administrator.");
};
};
function addClass(target, classValue) {
var pattern = new RegExp("(^| )" + classValue + "( |$)");
if (!pattern.test(target.className)) {
if (target.className == "") {
target.className = classValue;
}
else {
target.className += " " + classValue;
}
}
return true;
};
function removeClass(target, classValue) {
var removedClass = target.className;
var pattern = new RegExp("(^| )" + classValue + "( |$)");

removedClass = removedClass.replace(pattern, "$1");
removedClass = removedClass.replace(/ $/, "");
target.className = removedClass;
return true;
};
function getImageSize() {
var theSize = document.getElementById("TheImageTable");
var theWidth = theSize.offsetWidth;
var theHeight = theSize.offsetHeight;
alert(pixelWidth, pixelHeight);
return [theWidth, theHeight];
};
function getPosition(theElement) {
var positionX = 0;
var positionY = 0;
while (theElement != null) {
positionX += theElement.offsetLeft;
positionY += theElement.offsetTop;
theElement = theElement.offsetParent;
}
return [positionX, positionY];
};
