function tutup()
{
	window.close()
}

function window_sponsor()
{
	win = window.open ('sponsorship.htm' ,'sponsor','scrollbars=yes,resizable=yes,width=620,height=400');
	win.focus();
}

function Confirm()
{
	ret = confirm("are you sure u wanna leave weddingku.com??");
	alert(ret);
	if (ret) window.close();
}

function new_windowX(productID,partnerID)
{
	var strURL="productdetail.asp?productID="  + productID + "&partnerID=" + partnerID ;
	win = window.open (strURL ,'product','scrollbars=yes,resizable=yes,width=510,height=500');
	win.focus();
	win.moveTo(0,0);
}
function new_window_ask()
{
	var strURL="ask.asp" ;
	win = window.open (strURL ,'ask','scrollbars=yes,resizable=no,width=510,height=220');
	win.focus();
	win.moveTo(0,0);
}


function new_windowAddress(partnerID)
{
	var strURL="address.asp?partnerID=" + partnerID ;
	win = window.open (strURL ,'address','scrollbars=yes,resizable=yes,width=510,height=300');
	win.focus();
	win.moveTo(0,0);
}
function window_sitetour()
{
	win = window.open ('../sitetour/default.htm' ,'sitetour','scrollbars=no,resizable=no,width=600,height=400');
	win.focus();
}


function input_verify_contactus()
{	
	if (document.frmContactUs.txtName.value =='')
    {
		alert("Harap isi Nama anda");
		document.frmContactUs.txtName.focus();
		return;
	}
	else
	{
		var strCom = document.frmContactUs.txtName.value;
		if (strCom.length < 3)
		{
			alert('Nama Anda terlalu pendek');
			document.frmContactUs.txtName.focus();
			return;
		}
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Nama anda tidak valid');
			document.frmContactUs.txtName.focus();
			return;
		}
	}	
	
	if ((document.frmContactUs.txtEmail.value =='')&&(document.frmContactUs.txtHP.value =='')&&(document.frmContactUs.txtPhone.value ==''))
    {		
		alert("Harap isi E-mail/HP/Phone anda");
		document.frmContactUs.txtEmail.focus();
		return;
	}
	
		if (document.frmContactUs.txtEmail.value != "" && !checkemail(document.frmContactUs.txtEmail.value)){
 			alert("Email yang Anda masukkan tidak valid");
  			document.frmContactUs.txtEmail.focus();
  			return;
 		}	
	
	if (!(document.frmContactUs.checkbox.checked)&&!(document.frmContactUs.checkbox2.checked)&&!(document.frmContactUs.checkbox3.checked))
	{
		alert("Anda belum memilih cara dihubungi");
		return;
	}
	else 	
	{
		if (document.frmContactUs.checkbox.checked)
		{
			if (document.frmContactUs.txtEmail.value =='')
			{		
				alert('Checkbox yang dipilih tidak tepat');
				return;
			}
		}
		if (document.frmContactUs.checkbox2.checked)
		{
			if (document.frmContactUs.txtHP.value =='')
			{		
				alert('Checkbox yang dipilih tidak tepat');
				return;
			}
		}		
		if (document.frmContactUs.checkbox3.checked)
		{
			if (document.frmContactUs.txtPhone.value =='')
			{		
				alert('Checkbox yang dipilih tidak tepat');
				return;
			}
		}
	}
	
	if (document.frmContactUs.select.value=='')
	{
		alert("Anda belum memilih jenis pertanyaan");
		document.frmContactUs.select.focus();
		return;
	}
	
	if (document.frmContactUs.txtComments.value=='')
	{
		alert("Harap isi Pertanyaan anda");
		document.frmContactUs.txtComments.focus();
		return ;
	}
	else
	{
		var strCom = document.frmContactUs.txtComments.value;
		if (strCom.length < 6) 
		{
			alert('Maaf, Pertanyaan Anda terlalu pendek!');
			document.frmContactUs.txtComments.focus();
			return ;		
		}
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Pertanyaan  anda tidak valid');
			document.frmContactUs.txtComments.focus();
			return ;
		}
	}
	
	document.frmContactUs.submit();
	
}

function input_verify_guestbook1()
{
	if (document.frmGuestBook.txtName.value =='')
  {
		alert("Harap isi Nama anda");
		document.frmGuestBook.txtName.focus();
		return;
	}
	else
	{
		var strCom = document.frmGuestBook.txtName.value;
		if (strCom.length < 3)
		{
			alert('Nama Anda terlalu pendek');
			document.frmGuestBook.txtName.focus();
			return;
		}
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Nama anda tidak valid');
			document.frmGuestBook.txtName.focus();
			return ;
		}
	}


		if (document.frmGuestBook.txtEmail.value != "" && !checkemail(document.frmGuestBook.txtEmail.value)){
 			alert("Email yang Anda masukkan tidak valid");
  			document.frmGuestBook.txtEmail.focus();
  			return;
 		}	
				
	if (document.frmGuestBook.txtPesan.value=='')
	{
		alert("Harap isi Pesan anda");
		document.frmGuestBook.txtPesan.focus();
		return ;
	}
	else
	{
		var strCom = document.frmGuestBook.txtPesan.value;
		if (strCom.length < 6) 
		{
			alert('Maaf, Pesan Anda terlalu pendek!');
			document.frmGuestBook.txtPesan.focus();
			return ;		
		}
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Pesan anda tidak valid');
			document.frmGuestBook.txtPesan.focus();
			return ;
		}
	}
	
	document.frmGuestBook.submit();
}


function input_verify_guestbook()
{
	if (document.frmGuestBook.txtName.value =='')
        {
		alert("Harap isi Nama anda");
		document.frmGuestBook.txtName.focus();
		return;
		}
	else
		{
		var strCom = document.frmGuestBook.txtName.value;
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Nama anda tidak valid');
			document.frmGuestBook.txtName.focus();
			return ;
		}
		}

	if (document.frmGuestBook.txtPesan.value=='')
		{
		alert("Harap isi Pesan anda");
		document.frmGuestBook.txtPesan.focus();
		return ;
		}
	else
		{
			var strCom = document.frmGuestBook.txtPesan.value;
			if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
			{
				alert('Pesan anda tidak valid');
				document.frmGuestBook.txtPesan.focus();
				return ;

			}
		}

	document.frmGuestBook.submit();
}


function input_verify_teman()
{

	if (document.form1.txtUName.value =='')
        {
		alert("Harap isi Nama anda");
		document.form1.txtUName.focus();
		return;
		}


	if (document.form1.txtName.value =='')
        {
		alert("Harap isi Nama Teman anda");
		document.form1.txtName.focus();
		return;
		}



	if (document.form1.txtEmail.value =='')
        {
		alert("Harap isi Email Teman anda");
		document.form1.txtEmail.focus();
		return;
		}

	if (document.form1.txtPesan.value=='')
		{
		alert("Harap isi Pesan anda");
		document.form1.txtPesan.focus();
		return ;
		}


	document.form1.submit();
}



function open_print()
{
	var strURL="guestlistprint.asp" ;
	win = window.open (strURL ,'print','scrollbars=yes,resizable=yes,width=640,height=500');
	win.focus();
	win.moveTo(0,0);
}

function advance(GuestListID)
{
	var strURL="guestlistadvance.asp?GuestListID="  + GuestListID  ;
	win = window.open (strURL ,'guestlistadvance','scrollbars=yes,resizable=no,width=510,height=300');
	win.focus();
}

function printWindow()
{
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}

function new_window3(packetID,partnerID,url)
{
//	var strURL= url + "packetdetail.asp?packetID="  + packetID + "&partnerID=" + partnerID ;
	var strURL= "collections/packetdetail.asp?packetID="  + packetID + "&partnerID=" + partnerID ;
	win = window.open (strURL ,'product','scrollbars=yes,resizable=yes,width=510,height=500');
	win.focus();
	win.moveTo(0,0);
}

function new_window2(packetID,partnerID)
{
	var strURL= "packetdetail.asp?packetID="  + packetID + "&partnerID=" + partnerID ;
	win = window.open (strURL ,'product','scrollbars=yes,resizable=yes,width=510,height=500');
	win.focus();
	win.moveTo(0,0);
}


function window_pick(pickID)
{
	var strURL="pickdetail.asp?pickID="  + pickID ;
	win = window.open (strURL ,'product','scrollbars=yes,resizable=yes,width=510,height=600');
	win.focus();
	win.moveTo(0,0);
}

function new_windowPartners(GroupID,PartnerID)
{
	var strURL="partnerdetail.asp?GroupID="  + GroupID + "&PartnerID=" + PartnerID ;
	win = window.open (strURL ,'product','scrollbars=yes,resizable=yes,width=510,height=500');
	win.focus();
	win.moveTo(0,0);
}

function input_verify_polling()
{
	kosong=true;


	for (i=0;i<=document.frmPolling.poll.length-1;i++)
		{
		if(document.frmPolling.poll[i].checked)
			{
			var strURL="polling.asp?poll="  + document.frmPolling.poll[i].value ;
			win = window.open (strURL,'polling','scrollbars=no,resizable=no,width=268,height=400' );
			win.focus();

			kosong=false;
			break;
			}
		}

	if (kosong==true)
		{
		alert("Harap masukkan pilihan Anda");
		document.frmPolling.poll[0].focus();
		return;
		}


}

function new_window()
{
			win = window.open ('polling.asp','polling','scrollbars=no,resizable=no,width=268,height=400' );
			win.focus();

}

function input_verify_askexpert()
{
	if (document.frmAsk.txtNama.value =='')
        {
		alert("Harap isi Nama anda");
		document.frmAsk.txtNama.focus();
		return;
		}
	else
		{
		var strCom = document.frmAsk.txtNama.value;
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Nama anda tidak valid');
			document.frmAsk.txtNama.focus();
			return ;
		}
		}

	if (document.frmAsk.txtEmail.value =='')
        {
		alert("Harap isi Email anda");
		document.frmAsk.txtEmail.focus();
		return;
		}
	else
		{
		var strCom = document.frmAsk.txtEmail.value;
		if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
		{
			alert('Email anda tidak valid');
			document.frmAsk.txtEmail.focus();
			return ;
		}
		}

	if (document.frmAsk.txtCategory.value=='xxx')
		{
		alert("Harap isi Category");
		document.frmAsk.txtCategory.focus();
		return ;
		}

	if (document.frmAsk.txtPertanyaan.value=='')
		{
		alert("Harap isi Pertanyaan anda");
		document.frmAsk.txtPertanyaan.focus();
		return ;
		}
	else
		{
			var strCom = document.frmAsk.txtPertanyaan.value;
			if (strCom.indexOf('<script') != -1 || strCom.indexOf('<%') != -1)
			{
				alert('Pertanyaan anda tidak valid');
				document.frmAsk.txtPertanyaan.focus();
				return ;

			}
		}

	document.frmAsk.submit();
}

function input_verify()
{
	if (document.frmLogin.txtusername.value == '')
	{
		alert ("Silahkan masukkan email anda terlebih dahulu");
		document.frmLogin.txtusername.focus();
		return;
	}
	if (document.frmLogin.txtpassword.value == '')
	{
		alert ("Silahkan masukkan password anda terlebih dahulu");
		document.frmLogin.txtpassword.focus();
		return;
	}

	document.frmLogin.submit();
}

function safemail(name, domain, subject, display) {
displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
document.write('<a href="mailto:' + name + '@' + domain + '?subject=' + subject + '">' + displayed + '</a>');
}

function input_verify_discuss()
{
	if (document.frmDiscuss.txtJudul.value == '')
	{
		alert ("Silahkan masukkan Judul pesan anda terlebih dahulu");
		document.frmDiscuss.txtJudul.focus();
		return;
	}
	if (document.frmDiscuss.txtPesan.value == '')
	{
		alert ("Silahkan masukkan pesan anda terlebih dahulu");
		document.frmDiscuss.txtPesan.focus();
		return;
	}

	document.frmDiscuss.submit();
}


function input_verify_discuss_nonmember()
{

	if (document.frmDiscuss.txtName.value == '')
	{
		alert ("Silahkan masukkan nama anda terlebih dahulu");
		document.frmDiscuss.txtName.focus();
		return;
	}

	if (document.frmDiscuss.txtJudul.value == '')
	{
		alert ("Silahkan masukkan Judul pesan anda terlebih dahulu");
		document.frmDiscuss.txtJudul.focus();
		return;
	}
	if (document.frmDiscuss.txtPesan.value == '')
	{
		alert ("Silahkan masukkan pesan anda terlebih dahulu");
		document.frmDiscuss.txtPesan.focus();
		return;
	}

	document.frmDiscuss.submit();
}


function input_verify_discuss2()
{
	if (document.frmDiscuss.txtPesan.value == '')
	{
		alert ("Silahkan masukkan pesan anda terlebih dahulu");
		document.frmDiscuss.txtPesan.focus();
		return;
	}

	document.frmDiscuss.submit();
}

function input_verify_discuss2_nonmember()
{

	if (document.frmDiscuss.txtName.value == '')
	{
		alert ("Silahkan masukkan nama anda terlebih dahulu");
		//sorry i hate to do this but this line below can make a java script errors, the back up file is 20031010function.js
		//document.frmDiscuss.txtName.focus();
		return;
	}

	if (document.frmDiscuss.txtPesan.value == '')
	{
		alert ("Silahkan masukkan pesan anda terlebih dahulu");
		document.frmDiscuss.txtPesan.focus();
		return;
	}

	document.frmDiscuss.submit();
}



function input_verify_discuss3()
{

	if (document.frmDiscuss.txtJudul.value == '')
	{
		alert ("Silahkan masukkan Judul pesan anda terlebih dahulu");
		document.frmDiscuss.txtJudul.focus();
		return;
	}

	if (document.frmDiscuss.txtPesan.value == '')
	{
		alert ("Silahkan masukkan pesan anda terlebih dahulu");
		document.frmDiscuss.txtPesan.focus();
		return;
	}

	document.frmDiscuss.submit();
}


function input_verify_discuss3_nonmember()
{
	if (document.frmDiscuss.txtName.value == '')
	{
		alert ("Silahkan masukkan nama anda terlebih dahulu");
		document.frmDiscuss.txtName.focus();
		return;
	}

	if (document.frmDiscuss.txtJudul.value == '')
	{
		alert ("Silahkan masukkan Judul pesan anda terlebih dahulu");
		document.frmDiscuss.txtJudul.focus();
		return;
	}
	if (document.frmDiscuss.txtPesan.value == '')
	{
		alert ("Silahkan masukkan pesan anda terlebih dahulu");
		document.frmDiscuss.txtPesan.focus();
		return;
	}

	document.frmDiscuss.submit();
}





function new_window_disc_reply(DiscussionID,DiscussionTypeID)
{
	var strURL="discussionreply.asp?DiscussionID=" + DiscussionID + "&DiscussionTypeID=" + DiscussionTypeID ;
	win = window.open (strURL ,'discussionreply','scrollbars=yes,resizable=no,width=510,height=220');
	win.focus();
	win.moveTo(0,0);
}

function new_window_disc_reply_nonmember(DiscussionID,DiscussionTypeID)
{
	var strURL="discussionreplynonmember.asp?DiscussionID=" + DiscussionID + "&DiscussionTypeID=" + DiscussionTypeID ;
	win = window.open (strURL ,'discussionreplynonmember','scrollbars=yes,resizable=no,width=510,height=220');
	win.focus();
	win.moveTo(0,0);
}

function new_window_disc_forum(DiscussionTypeID)
{
	var strURL="disc-addforum.asp?DiscussionTypeID=" + DiscussionTypeID ;
	win = window.open (strURL ,'discussionaddforum','scrollbars=yes,resizable=no,width=510,height=220');
	win.focus();
	win.moveTo(0,0);
}

function new_window_disc_forum_nonmember(DiscussionTypeID)
{
	var strURL="disc-addforumnonmember.asp?DiscussionTypeID=" + DiscussionTypeID ;
	win = window.open (strURL ,'discussionaddforumnonmember','scrollbars=yes,resizable=no,width=510,height=220');
	win.focus();
	win.moveTo(0,0);
}


function MVC_opennewWindow(url,name) {
	var width = screen.width * 3 / 4;
	var height = screen.height * 3 / 4;
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;;
	var myFeatures = "toolbar=yes,location=yes,status=yes,directories=no,menubar=yes,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left;
	var myWindow = window.open(url,name,myFeatures);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function verify_disc_search()
{
	if(document.frm.txtSearch.value == '')
	{
		alert('Silahkan masukkan keyword');
		document.frm.txtSearch.focus();
		return;
	}
	document.frm.submit();
}

// By Hengky I. (5/6/2004)
// validate Time format
function checkdate(intDay,intMonth,intYear) {
	var dtDate = new Date(intMonth + '/' + intDay + '/' + intYear )
    if (dtDate.getDate() != intDay && dtDate.getMonth() != intMonth-1) 
    	return false;
    else
    	return true;
}

// By Setiyo G. (16/7/2004)
// validate Time format
function checkTime(inputTime)
{
	var pos;
	pos=inputTime.indexOf(":");
	if (pos <= 0) {return false;}
	var intMinute=inputTime.substring(pos+1,inputTime.length);
	var intHour=inputTime.substring(0,pos);
	if (intMinute > 59 || intHour > 24)
		return false;
	else
		return true;
}

function textCounter(field, countfield, maxlimit)
{
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

// By Setiyo G. (16/7/2004)
// Validate email entry
function checkemail(email) {
    if (email.length < 11 || email.indexOf("@")==-1 || email.indexOf(".")==-1 || email.indexOf("!")!=-1 || email.indexOf("..")!=-1 || email.indexOf(".")==0 || email.indexOf(".")==email.length|| email.indexOf("neowed")!=-1 || email.indexOf("menaravisi")!=-1 || email.indexOf("weddingku")!=-1 || email.indexOf("test")!=-1 || email.indexOf("hjkl")!=-1 || email.indexOf("yuio")!=-1 || email.indexOf("zxcv")!=-1 || email.indexOf("asdf")!=-1 || email.indexOf("qwer")!=-1)
		return false;
    else {
		var pos;
		pos = email.indexOf("@");
		var mailbox=email.substring(0,pos);
		var domainname=email.substring(pos+1,email.length);
		var mailboxlast=mailbox.substring(mailbox.length-1,mailbox.length);
		var domainfirst=domainname.substring(0,1);
		var lastdigit=email.substring(email.length-1,email.length);
		var firstdigit=email.substring(0,1)
		if (mailbox.indexOf("-")==-1 && domainname.indexOf("_")==-1 && domainname.indexOf("@")==-1 && lastdigit.indexOf(".")==-1 && lastdigit.indexOf("-")==-1 && firstdigit.indexOf(".")==-1 && firstdigit.indexOf("_")==-1 && mailboxlast.indexOf(".")==-1 && mailboxlast.indexOf("_")==-1 && domainfirst.indexOf(".")==-1 && domainfirst.indexOf("-")==-1)
			return true;
		else
			return false;
    }
}

// By Setiyo G. (29/7/2004)
// Fill In text field with current Time
function fillTime(timefield) {
	var dtDate = new Date
    	var strTime

 	strTime=dtDate.getHours()
 	strTime=strTime + ':'
 	strTime=strTime + dtDate.getMinutes()
// strTime=strTime + ':' 
// strTime=strTime + dtDate.getSeconds()
 
	timefield.value = strTime
}

// By Setiyo G. (7/9/2004)
// validate phone entry, no repetition more than maxrep
function checkphone(strphone,maxrep)
{
    var i = 0;
    var j = 0;
    var repdigit = new Array(14);
    var digit= new Array(14);
    var repcnt=0;

    if (strphone.indexOf("12345")!=-1 || strphone.indexOf("00000")!=-1 || strphone.indexOf("11111")!=-1 || strphone.indexOf("22222")!=-1 || strphone.indexOf("33333")!=-1 || strphone.indexOf("44444")!=-1 || strphone.indexOf("55555")!=-1 || strphone.indexOf("66666")!=-1 || strphone.indexOf("77777")!=-1 || strphone.indexOf("88888")!=-1 || strphone.indexOf("99999")!=-1)
		return false;
    else {
	
    for (i = 0; i < strphone.length; i++) {
        repdigit[i] = 0;
	digit[i] = 0;
    }
    for (i = 0; i < strphone.length; i++) {
	digit[i]=strphone.substring(i,i+1);
    	for (j = 0; j <= i; j++) {
	    if (digit[j]==digit[i]) {
		repdigit[j]=repdigit[j]+1;
	    }
        }
    }
    for (i = 0; i < strphone.length; i++) {
	if (repdigit[i]>=maxrep) {
		repcnt=repcnt+1;
	}
    }
    if (repcnt>0)
		return false;
	else
		return true;   
    }
}
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];}
}