//***************************************************************//
// Filename: makewebsitenow.js
// Written By: Yasir Zaka Bhatti
// Creation Date: 14-02-2007
//***************************************************************//
function submitpage(mypage) {
	document.profile.action=mypage;
	document.profile.submit();
	return true;	
}

function submit_form(myfield) {
	document.profile.categoryid.value= 0; // category needs to be selected otherwise automatically submitted with wrong details
	document.profile.savedate.value="no";
	document.profile.submit();
	return true;
}

function set_homepage(myfield) {
	var mylinksubmissionurl = document.profile.linksubmissionurl.value;;
	var myhomepage = new Array();
	if (mylinksubmissionurl.substring(0,7) == 'http://') {
		//alert(mylinksubmissionurl.substring(0,mylinksubmissionurl.indexOf('/',7)));
		document.profile.homepage.value= mylinksubmissionurl.substring(0,mylinksubmissionurl.indexOf('/',7));
	} else {
		document.profile.homepage.value=document.profile.linksubmissionurl.value;	
	}

	/*myhomepage = mylinksubmissionurl.split('/');
	alert(myhomepage[0]);
	alert(myhomepage[1]);
	alert(myhomepage[2]);*/

	
	return true;
}

function SelectAllMail(){
	//alert(document.view.ChkInbox[0].checked);
	if (document.view.selectall.checked == true) {
		val = true;
	} else {
		val = false;		
	}
	if (document.view.mailcount.value > 1) {	// Error was comming if only one email thats why this check
		for (var i=0; i<document.view.mailcount.value; i++) {
			//alert(i);
			document.view.ChkMail[i].checked=val;
		}
	}
}	


function DeleteComments(ID) {
	flag = false;
	if (document.view.mailcount.value > 1) {	// Error was comming if only one email thats why this check
		for (var i=0; i<document.view.mailcount.value; i++) {
			if (document.view.ChkMail[i].checked == true) {
				flag = true;
				break;
			}
		}
	} else {
		flag = true;
	}
	if (flag) {
		abc = confirm("Are you sure to delete the selected comments? ");
		if (abc == true){
				document.view.action.value = "delete";
				document.view.submit();
		}
	}else {
		alert("You must need to select at least one comment.");
	}
}

function ApproveComments(ID) {
	flag = false;
	if (document.view.mailcount.value > 1) {	// Error was comming if only one email thats why this check
		for (var i=0; i<document.view.mailcount.value; i++) {
			if (document.view.ChkMail[i].checked == true) {
				flag = true;
				break;
			}
		}
	} else {
		flag = true;
	}
	if (flag) {
		abc = confirm("Are you sure to delete the approve comments? ");
		if (abc == true){
				document.view.action.value = "approve";
				document.view.submit();
		}
	}else {
		alert("You must need to select at least one comment.");
	}
}
