





function popupWindow(url) {
	window.open(url,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=100,height=20,screenX=50,screenY=50,top=50,left=50')
}
function popupSuggestion(url) {
	window.open(url,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=450,height=400,screenX=50,screenY=50,top=50,left=50')
}
//var arrImages = new Array();

function select(strFile){
	if(document.getElementById('chk' + strFile).checked == false){
		document.getElementById('chk' + strFile).checked = true;
	}else{
		document.getElementById('chk' + strFile).checked = false;
	}
	/*
	var strOutput = "<table cellpadding='3' cellspacing='2' class='lblList'>";
	for ( var key in arrImages ) {
		if(arrImages[key] != null){
			strOutput += "<tr><td style='background-Color:#99CCFF'>" + key + " <b>Added</b> <a href=\\\"javascript:select('" + key + "');\\\">[Remove]</a></td></tr>";
		}
	}
	strOutput += "</table>";
	document.getElementById("lblList").innerHTML = strOutput;
	*/
}
var strLastLink = "";
function exportVotePage(){
	
	var strKeyList = "files=";
	var j = 0;
	var arrCheckbox = document.getElementsByTagName("input");
	for (var i = 0 ; i < arrCheckbox.length ; i++){
		var objCheckbox = arrCheckbox[i];
		if(objCheckbox.type == "checkbox" && objCheckbox.id.substring(0,3) == "chk"){
			if(objCheckbox.checked == true){
				strKeyList += objCheckbox.id.substring(3,objCheckbox.id.length) + ",";
				j++;
			}
		}		
	}
	/*
	for ( var key in arrImages ) {
		if(arrImages[key] == "selected"){
			strKeyList += key + ",";
			i++;
		}
	}
	*/
	strKeyList = strKeyList.substring(0,strKeyList.length - 1);
	if(j > 1){
		new Ajax.Request("php/compare_script.php?mode=fromtemplate&" + strKeyList,
		{
			method:'get',
			onSuccess: function(transport){
				objXML = transport.responseXML;

				window.open(objXML.getElementsByTagName("key").item(0).firstChild.data);
			},
			onFailure: function(){
				alert('Something went wrong...')
			}
		});
		
	}else{
		alert('minimum of 2 images needed');
	}
}
function deleteExport(){
	if(confirm("you sure to remove the selected photo?")){
		var strKeyList = "files=";
		var arrCheckbox = document.getElementsByTagName("input");
		var j = 0;
		for (var i = 0 ; i < arrCheckbox.length ; i++){
			var objCheckbox = arrCheckbox[i];
			if(objCheckbox.type == "checkbox" && objCheckbox.id.substring(0,3) == "chk"){
				if(objCheckbox.checked == true){
					j++
					strKeyList += objCheckbox.id.substring(3,objCheckbox.id.length) + ",";
					objCheckbox.parentNode.style.display = 'none';
				}
			}		
		}
		strKeyList = strKeyList.substring(0,strKeyList.length - 1);
		if(j > 0){
			new Ajax.Request("php/compare_script.php?mode=delete_export&" + strKeyList,
			{
				method:'get',
				onSuccess: function(transport){
					objXML = transport.responseXML;
				},
				onFailure: function(){
					alert('Something went wrong...')
				}
			});
		}
	}


}
function selectAll(){
	var arrCheckbox = document.getElementsByTagName("input");
	for (var i = 0 ; i < arrCheckbox.length ; i++){
		var objCheckbox = arrCheckbox[i];
		if(objCheckbox.type == "checkbox" && objCheckbox.id.substring(0,3) == "chk"){
			objCheckbox.checked = true;
		}		
	}
}
function unselectAll(){
	var arrCheckbox = document.getElementsByTagName("input");
	for (var i = 0 ; i < arrCheckbox.length ; i++){
		var objCheckbox = arrCheckbox[i];
		if(objCheckbox.type == "checkbox" && objCheckbox.id.substring(0,3) == "chk"){
			objCheckbox.checked = false;
		}		
	}
}


















