function yreviews ()	{
	setTimeout (yreviews1, 5000);
}
function yreviews1()	{
	if (document.getElementById('ys_relatedItems')) {
		var yrev = document.getElementById('ys_relatedItems').offsetHeight;
		if (yrev < 30) {
			document.getElementById('alsoviewed').style.display = 'none';
			document.getElementById('ys_relatedItems').style.display = 'none';
		}
	}
}


function imagewindow(imageurl)	{
	window.open(imageurl,'jav','width=600,height=600,resizable=yes');
}


function testedDaily ()	{
	var m_names = new Array("JAN", "FEB", "MAR", "APR", "MAY", "JUNE", "JULY", "AUG", "SEPT", "OCT", "NOV", "DEC");
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	document.write("TESTED DAILY <span style='color: #000000;'>"+curr_date+"-"+m_names[curr_month]+"</span>");
}

function eyacc(n){
var mc="SubSection-"+n;

if (document.getElementById(mc).style.display == "block") {
$("#SubSection-"+n).slideUp("slow");
$("#Arrow"+n).attr("src","http://lib.store.yahoo.net/lib/madisonartshop/ey-rightarrow.jpg");

} 
else {
$("#SubSection-"+n).slideDown("slow");
$("#Arrow"+n).attr("src","http://lib.store.yahoo.net/lib/madisonartshop/ey-downarrow.jpg");
document.getElementById(mc).style.width = '188px';
}
}


var kwm_rating = 5;

function showThankyou(name){
	if(navigator.appName.indexOf("Microsoft")!=-1){
		window_width = document.documentElement.clientWidth;
		window_height = document.documentElement.clientHeight;
	}else{
		window_width = window.innerWidth;
		window_height = window.innerHeight;
	}
	
	w_left = (window_width/2) - 200;
	w_top = (window_height/2) - 200;
	
	window.open(name+".html", null, "height=400,width=400,left="+w_left+",top="+w_top);
	
}

function setValue(option, rating){

	switch(rating)
	{
	case 1:
	  rating_str = 'one'
	  break;    
	case 2:
	  rating_str = 'two'
	  break;
	case 3:
	  rating_str = 'three'
	  break;    
	case 4:
	  rating_str = 'four'
	  break;
	case 5:
	  rating_str = 'five'
	  break;
	}
	
	if(option == 'kwm_rating'){
		kwm_rating = rating;
		document.getElementById('kwm_rating').className = 'rating '+rating_str+'star';
	}
	
}

var pPath = window.location.pathname;
var pPage = pPath.substring(pPath.lastIndexOf('/') + 1)
var http_request = false;
var loadingStr = '<img src="http://www.kingwebtools.com/madison_art_shop/feedback_system/images/ajax-loader.gif" />'

function SubmitReview() {
	var jsel = document.createElement('SCRIPT');
	var rating = kwm_rating;
	jsel.type = 'text/javascript';
	jsel.src = 'http://www.kingwebtools.com/madison_art_shop/feedback_system/submit_review.php?item_id=' + encodeURI( document.getElementById("kwm_item_id").value ) + '&kwm_comment=' + encodeURI( document.getElementById("kwm_comment").value ) + '&your_name=' + encodeURI( document.getElementById("your_name").value ) + '&your_location=' + encodeURI( document.getElementById("your_location").value ) + '&item_name=' + encodeURI( document.getElementById("item_name").value ) + '&rating=' + encodeURI( rating ) + '&your_location=' + encodeURI( document.getElementById("your_location").value );
	
	document.getElementById('submit_review_form').innerHTML = loadingStr;
	document.getElementById('submit_review_form').appendChild (jsel);
	
	showThankyou('reviewconfirm');
	
	document.getElementById('submit_review_form').style.display = 'none';
}

function SubmitQuestion() {
	if(document.getElementById("your_question").value != ""){
		if(checkEmail(document.getElementById("q_email").value)){
			var jsel = document.createElement('SCRIPT');
			jsel.type = 'text/javascript';
			jsel.src = 'http://www.kingwebtools.com/madison_art_shop/feedback_system/submit_question.php?item_id=' + encodeURI( document.getElementById("kwm_qitem_id").value ) + '&your_question=' + encodeURI( document.getElementById("your_question").value ) + '&q_email=' + encodeURI( document.getElementById("q_email").value );
		
			document.getElementById('submit_question_form').innerHTML = '<img src="http://lib.store.yahoo.net/lib/gamesusainc/ajax-loader.gif" />';
			document.getElementById('submit_question_form').appendChild (jsel);
		}else{
			alert("You need to type in correct email address!");
			document.getElementById("q_email").focus();			
		}
    }else{
		alert("You need to type in the question!");
		document.getElementById("your_question").focus();
	}
}

function checkEmail(e){
   
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
     
	if (e.search(emailRegEx) == -1) {
         return false;
    }else{
         return true;
    }

}


//display hide reviews
function dhReviews(eId){
	it = document.getElementById(eId);
	
	if(document.getElementById('more_reviews').style.display == 'none'){
		it.innerHTML = 'Hide Reviews';
		document.getElementById('more_reviews').style.display = '';
	}else{
		it.innerHTML = 'View All Reviews ...';
		document.getElementById('more_reviews').style.display = 'none';	
	}
}

//display hide questions and answers
function dhQuestions(eId){
	it = document.getElementById(eId);
	
	if(document.getElementById('more_qa').style.display == 'none'){
		it.innerHTML = 'Hide Q & A';
		document.getElementById('more_qa').style.display = '';
	}else{
		it.innerHTML = 'View All Q & A ...';
		document.getElementById('more_qa').style.display = 'none';	
	}
}

function showrev()	{
	document.getElementById('addrev').style.display = 'block';
	document.getElementById('viewall').style.display = 'none';
	document.getElementById('hideall').style.display = 'block';
}

function hiderev()	{
	document.getElementById('addrev').style.display = 'none';
	document.getElementById('viewall').style.display = 'block';
	document.getElementById('hideall').style.display = 'none';
}


var dlg = null;

function CaricaFoto(img, name, imgname, wid, hi){
  foto1= new Image();
  foto1.src=(img);
  foto2= new Image();
  foto2.src=(imgname);
  viewFotos(img, name, imgname, wid, hi);
}

function viewFotos(img, name, imgname, wid, hi){

 features = 
    "toolbar=no,location=no,directories=no,status=no,menubar=no," +
    "scrollbars=no,resizable=no,width=" + wid + ",height=" + hi;
 if (dlg && dlg.open) {
    dlg.close();
 }
 dlg = window.open ("","Details",features);
 dlg.document.write("<html><head><ti");
 dlg.document.write("tle>" + name + " Zoom</title></head>");
 dlg.document.write("<body bgcolor=white><center>");
 dlg.document.write("<table width=100% height=100%>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<img src=" + imgname + ">");
 dlg.document.write("</td></tr><tr><td align=center valign=middle>");
 dlg.document.write("<img src=" + img + ">");
 dlg.document.write("</td></tr>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<a href=# onClick=window.close();>");
 dlg.document.write("<font size=1 face=Arial>Click to close</font></a>");
 dlg.document.write("</td></tr>");
 dlg.document.write("</table></body></html>");
}

////////////////////////////////////////////////
function tellafriendwindow(url) {
  window.open (url,'','width=700,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}
function homeFlash ()	{
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '529',
			'height', '376',
			'src', '/lib/madisonartshop/madisonflashfinal8',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', 'ff',
			'bgcolor', '#ffffff',
			'name', 'madisonflashfinal8',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','always',
			'movie', '/lib/madisonartshop/ff',
			'salign', ''
			); //end AC code
	}
}
