
Ext.QuickTips.init(); 
Ext.form.Field.prototype.msgTarget = 'side';

/*  REQUEST MORE INFORMATION  */

function showRequestInfoWindow(){

	var riForm = new Ext.form.FormPanel({
		url:'/handler/requestInfoHandler.cfm',
		waitMsg:'Submitting your information...',
        labelWidth: 75, // label settings here cascade unless overridden
        frame:true,
        bodyStyle:'padding:5px 5px 0',
        defaults: {width: 260},
        defaultType: 'textfield',
        items: [{fieldLabel: 'Full Name*',
        		 name: 'name',
        		 allowBlank:false
        		 },
	    		{fieldLabel: 'Company',
                 name: 'company'},
                {fieldLabel: 'Title',
                 name: 'title'},
                {fieldLabel: 'State',
                 name: 'state'},
                {fieldLabel: 'Country',
                 name: 'country'},
				{fieldLabel: 'Email*',
                name: 'email',
                vtype:'email',
                allowBlank:false},
                {fieldLabel: 'Phone',
                 name: 'phone'},
                {fieldLabel: 'Comments',
                name: 'comments',
                xtype:'textarea',
                height:70}
                ],
        buttons: [this.submitButton = {
            text: 'Submit',
            type:'submit',
            handler: function (){riForm.getForm().submit({waitMsg:'Saving Data...'});}
        },
        this.cancelButton ={
            text: 'Cancel',
            handler: function (){
			 	riWindow.close();
            }
        }]
    });
    
    riForm.on('actionfailed', function(form, action){
    	Ext.Msg.alert('Request More Information', 'Your request contains errors and was not processed.<br/>Please check your information and resubmit.');
    }
    )
    riForm.on('actioncomplete', function(form, action){
    	Ext.Msg.alert('Request More Information', 'Your request has been processed.<br/>Thank you for your interest in Amkor Technology.');
    	riWindow.close();
    }
    )
    
    
	var riWindow = new Ext.Window({
		animateTarget:'infoWindow',
		modal:true,
		constrain :true,
        width: 400,
		title:'Request More Information',
		items: [riForm]});

	riWindow.show();
}

function getUpdateUrl()
{
	url = '#application.url.webroot#' + "/handler/requestInfoHandler.cfm";
	return (url);
}


/*  PRESS RELEASE SUBSCRIPTION  */

function showPRInfoWindow(){

	var prForm = new Ext.form.FormPanel({
		url:'/handler/subscriptionsHandler.cfm',
		waitMsg:'Submitting your information...',
        labelWidth: 75, // label settings here cascade unless overridden
        frame:true,
        bodyStyle:'padding:5px 5px 0',
        defaults: {width: 260},
        defaultType: 'textfield',
        items: [{fieldLabel: 'Full Name*',
        		 name: 'name',
        		 allowBlank:false },
	    		{fieldLabel: 'Company',
                 name: 'company'},
                {fieldLabel: 'Title',
                 name: 'title'},
				{fieldLabel: 'Email*',
                name: 'email',
                vtype:'email',
                allowBlank:false}],            
        buttons: [this.submitButton = {
            text: 'Submit',
            type:'submit',
            handler: function (){prForm.getForm().submit({waitMsg:'Saving Data...'});}
        },
        this.cancelButton ={
            text: 'Cancel',
            handler: function (){
			 	prWindow.close();
            }
        }]
    });
    
    prForm.on('actionfailed', function(form, action){
    	Ext.Msg.alert('Subscribe to Press Releases', 'Your subscription request contains errors and was not processed.<br/>Please check your information and resubmit.');
    }
    )
    prForm.on('actioncomplete', function(form, action){
    	Ext.Msg.alert('Subscribe to Press Releases', 'Your subscription request has been processed. Thank you for your interest in Amkor Technology.<br/><br/>Before you can receive our regular mailings, you must confirm your subscription by clicking the link in the email we have sent you.<br/>');
    	prWindow.close();
    }
    )
      
	var prWindow = new Ext.Window({
		animateTarget:'infoWindow',
		modal:true,
		constrain :true,
        width: 400,
		title:'Subscribe to Press Releases',
		items: [prForm]});

	prWindow.show();
}  

/* INPUT VALIDATION FOR OPEN TOOLED DRAWING LIST LOGIN */
function onSubmitForm(formid)
{
	var form = formid;
	var uid = form.userid.value;
	var pwd = form.password.value;
	var act = '';
	
	var trimUid = uid.replace(/^\s+|\s+$/g, '') ;
	var trimPwd = pwd.replace(/^\s+|\s+$/g, '') ;
	
	if (trimUid == "")
	{
		alert('Please enter a user name.');
	    form.userid.focus();
    	return false ;
	}
	
	if (trimPwd == "")
	{
		alert('Please enter a password.');
	    form.password.focus();
    	return false ;
	}
	
	act = 'ftp://' + trimUid + ':' + trimPwd + '@ftp1.amkor.com/dwgs';
	form.action = act;
	
return true;
}


/*  REQUEST A LOGIN FOR OPEN TOOLED DRAWING LIST */
function showOTDLoginRequestWindow(){

	var otdForm = new Ext.form.FormPanel({
		url:'/handler/requestOTDAccountHandler.cfm',
		waitMsg:'Submitting your information...',
        labelWidth: 75, // label settings here cascade unless overridden
        frame:true,
        bodyStyle:'padding:5px 5px 0',
        defaults: {width: 260},
        defaultType: 'textfield',
        items: [{fieldLabel: 'Full Name*',
        		 name: 'name',
        		 allowBlank:false },
	    		{fieldLabel: 'Company',
                 name: 'company'},
                {fieldLabel: 'Title',
                 name: 'title'},
				{fieldLabel: 'Email*',
                name: 'email',
                vtype:'email',
                allowBlank:false}],            
        buttons: [this.submitButton = {
            text: 'Submit',
            type:'submit',
            handler: function (){otdForm.getForm().submit({waitMsg:'Saving Data...'});}
        },
        this.cancelButton ={
            text: 'Cancel',
            handler: function (){
			 	otdWindow.close();
            }
        }]
    });
    
    otdForm.on('actionfailed', function(form, action){
    	Ext.Msg.alert('Open Tooled Drawing List Account Request', 'Your account request contains errors and was not processed.<br/><br/>Please check your information and resubmit.');
    }
    )
    otdForm.on('actioncomplete', function(form, action){
    	Ext.Msg.alert('Open Tooled Drawing List Account Request', 'Your request has been received and is being forwarded to the appropriate personnel.<br><br>If you have any questions, please contact the Amkor Webmaster (webmaster@amkor.com)<br/><br/>');
    	otdWindow.close();
    }
    )
      
	var otdWindow = new Ext.Window({
		animateTarget:'infoWindow',
		modal:true,
		constrain :true,
        width: 400,
		title:'Open Tooled Drawing List Account Request',
		items: [otdForm]});

	otdWindow.show();
}  


